← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Board statistics dialog


I just tried the board statistics dialog and looks good, I like it.

A thing I'd like to have to make it better is adding the number of vias to the statistics: Since making every hole in the pcb costs time, manufacturers calculate the price of the PCB using also that number.

Also the option to save or print a text with the statistics report would be nice.


On 20/07/19 20:48, Jeff Young wrote:
Hi Alex,

Looks good.  I’m going to go ahead and merge it and follow it up with a commit to make the GUI look a little better on MacOS.  I’ll send another reply when they’re pushed to master.


On 17 Jul 2019, at 23:45, Alexander Shuklin <jasuramme@xxxxxxx <mailto:jasuramme@xxxxxxx>> wrote:

Hi Jeff,
Have a nice flight. I found one more:
there's issue with menu item capitalization as well, so that will be in the pcb_actions.cpp

+//Show board statistics tool
+TOOL_ACTION PCB_ACTIONS::boardStatistics( "pcbnew.InspectionTool.ShowStatisticsDialog", AS_GLOBAL, +        0, LEGACY_HK_NAME( "Show Board Statistics" ), _( "Show Board Statistics" ),
+        _( "Shows board statistics" ), pcbnew_xpm );


    Среда, 17 июля 2019, 23:56 +03:00 от Jeff Young <jeff@xxxxxxxxx

    Hi Alex,

    I’m about to go on vacation myself so I’ll be on a plane all day
    tomorrow, but I’ll look at this when I get there.


    On 17 Jul 2019, at 19:06, Alexander Shuklin <jasuramme@xxxxxxx

    Hi Jeff,

    That's not a problem. Now I'm on 2 weeks vacation ))
    We don't use header capitalization in russian language, so it's
    sometimes confuses me.
    All done. You can find changed commit on github if you want.


    And patch in the attachment below.

    Best regards,

        Среда, 17 июля 2019, 15:18 +03:00 от Jeff Young

        Hi Alex,

        No need for apologies.  It’s a steep learning curve.

        Some more comments:

        1) Dialog items use sentence-capitalization and colons;
        dialog headers use title-capitalization and no colons.  So
        “Components:” should be “Components”, “Front side:” should be
        “Front Side”, etc.

        2) Right-align the StdButtonSizer (and give it right and left

        3) I don’t think this ever made it into the coding
        guidelines, but we prefer ctor initializers each on their own
        line (with the colon on the line above):

                padsType_t( PAD_ATTR_T aAttribute, wxString aTitle ) :
                        attribute( aAttribute ),
        title( aTitle ),
        qty( 0 )

        4) And yes, I would space-align the inspectMenu->AddItem
        calls that the Git checker messed up.

        If you don’t have time to make these fixes just holler and I
        can do it.


        On 17 Jul 2019, at 12:47, Alexander Shuklin
        <jasuramme@xxxxxxx> wrote:

        I'm very sorry. I know, that's stupid, but it takes so much
        time to get myself familiar with kicad code
        If it's not too late, can you look for newer patch, not one
        I sent this morning? Of course, I can make commit on top of
        it, but I think it doesn't make sense
        There only few changes, such as
        - code formatting
        - I usedFinishDialogSettings() instead of just Fit() as
        written in KiCad documentation
        - I changed tool name for
        "pcbnew.InspectionTool.ShowStatisticsDialog" so it would
        correspond to PCB_INSPECTION_TOOL::ShowStatisticsDialog method
        - And I changed wxString ( _( "some string " ) ) to just _(
        "some string" )
        That's link to github:
        and patch uploaded to this mail
        Sorry for that, but I've just understood that, during
        further doxygen documentation reading

            Среда, 17 июля 2019, 9:01 +03:00 от Alexander Shuklin

            Sorry for delay, there to much to do for my primary job.
            I hope that code will be alright.
            That's commit on the github:

            There's one thing. Git coding standards checkers writes

            +++ b/pcbnew/menubar_pcb_editor.cpp
            @@ -436,7 +436,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()

            -    inspectMenu->AddItem(
PCB_ACTIONS::boardStatistics, SELECTION_CONDITIONS::ShowAlways );
            +    inspectMenu->AddItem( PCB_ACTIONS::boardStatistics,
            SELECTION_CONDITIONS::ShowAlways );

            But I would leave whitespaces, for better code looking
            as all functions around use it

                Понедельник, 8 июля 2019, 17:03 +03:00 от Jeff Young

                Hi Alex,

                Have a look at the second half
                of DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow().
                 That code builds a read-only grid.  You could  then
                have columns for Top, Bottom, and Total.

                (BTW, I think we use Front/Back nomenclature rather
                than Top/Bottom.)


                On 8 Jul 2019, at 13:48, Alexander Shuklin

                Hi Jeff,
                that bug reports are some job to do)

                Well, reason why I went up with that
                top-side/bottom-side checkboxes is if you will want
                to count let's say SMD components on the bottom
                side, you can manage it with setting top one off.
                I'm not sure, how important it is. On the another
                hand, we could write down something like:
                THT components: top: 15, bottom: 32, total: 47
                SMD components: top: 14, bottom: 31, total: 45
                But that would be ugly as well.

                If there would be more options and more components
                properties, maybe better to write all data to
                wxTextCtrl then? Just in big text field, which you
                could copy. And that will be easy to change and expand.

                    Понедельник, 8 июля 2019, 14:24 +03:00 от Jeff
                    Young <jeff@xxxxxxxxx

                    Hi Alex,

                    I don’t like the top-side/bottom-side
                    checkboxes (because I want to see both numbers
                    at once), but I do like the other three.

                    I think we need to move to a list or grid
                    presentation, though.  One of the other
                    features we’ve talked about is user-defined
                    attributes, so there might be more things than
                    just THT, SMD and Virtual.


                    [1] https://bugs.launchpad.net/kicad/+bug/1789363
                    [2] https://bugs.launchpad.net/kicad/+bug/980919

                    On 8 Jul 2019, at 11:20, Alexander Shuklin
                    <jasuramme@xxxxxxx> wrote:

                    Hi!, I added stuff for footprints
                    THT,SMD,virtual properties and now it's
                    calculate area.
                    But for me dialog is not very straight forward
                    now. Can you please advice, what better to do?
                    I attached 2 pics. I think, maybe right way is
                    to add few checkboxes which will change dialog
                    data as soon as you pressed them?
                    Just look at pics and say what would be
                    better, as I'm in doubt.
                    Second one is in WxFormBuilder so it looks a
                    bit different.

                        Пятница, 5 июля 2019, 0:05 +03:00 от Jeff
                        Young <jeff@xxxxxxxxx>:

                        I agree that it shouldn’t be its own tool,
                        but PCB_EDITOR_CONTROL is getting too big.

                        Let’s just name this tool the
                        PCB_INSPECTION_TOOL, and then I’ll move
                        the highlight and list nets stuff, and the
                        DRC dialog to it later.  That’ll nicely
                        parallel the EE_INSPECTION_TOOL.


                        On 4 Jul 2019, at 21:56, Ian McInerney
                        <Ian.S.McInerney@xxxxxxxx> wrote:

                        This looks nice, but a few comments from
                        my initial usage of it:

                        1) When I use english units, your
                        statistics dialog gives the dimensions in
                        mils. It should probably give those in
                        inches instead, since that is what the
                        grid panel at the bottom gives.
                        2) Including the board area would also be
                        useful, definitely the area of the
                        bounding box, and possibly the area of
                        the actual PCB (but that is more
                        complicated). I know of several board
                        houses that charge based on area, so this
                        could provide a quick way to estimate
                        price for the user.
                        3) I am not sure I am a fan of the icon
                        used for the menu item, since this dialog
                        focuses on board statistics rather than
                        footprint statistics and that icon is
                        used mainly for footprint actions. Could
                        a variant of the pcbnew icon be used?

                        While the code as you gave works, I think
                        the following changes could be beneficial:
                        1) It seems that this action could just
                        be added to PCB_EDITOR_CONTROL as the
                        action "pcbnew.Control.BoardStatistics"
                        rather than creating a new tool just for
                        2) I think the launching of the window
                        could be simplified if you used a modal
                        window instead (see
                        the Modal and Modeless section). Then you
                        don't have to keep track of the window
                        pointer, and could actually just make
                        launching this a single function instead
                        of an entire class (this would go nicely
                        with point #1).
                        3) The function to start the window
                        should be TransferDataToWindow, not
                        TransferDataFromWindow. FromWindow is
                        called when the window is destroyed and
                        ToWindow is called when it is created.
                        Also, it is called automatically when the
                        window is started, so there is no need to
                        manually call it.

                        Other code parts:
                        1) There are some lines that are too long
                        in dialog_board_statistics.cpp (max 100
                        characters per line)
                        2) There are a few whitespace errors when
                        applying it:
                        Applying: added board statistics dialog,
                        which shows info for production and assembly
                        trailing whitespace.
                                        /* if pin has drill with
                        width==0 and height==0, we
                        new blank line at EOF.
                        warning: 2 lines add whitespace errors.

                        Overall though it looks pretty nice.


                        On Thu, Jul 4, 2019 at 3:07 PM Шуклин
                        Александр <jasuramme@xxxxxxx> wrote:

                            Hi, that's first time I try to
                            contribute to KiCad and write to
                            Launchpad mailing lists, so please,
                            don't beat me to hard )))
                            I really miss some board statistic
                            dialog, where you can see quantity of
                            SMD pads, THT pads, board dimensions,
                            all the stuff, you need for PCB
                            production and assembly. There was
                            also issue in the bug tracker
                            And like guy from bug issue, I moved
                            from Altium Designer and miss that
                            dialog as well.
                            Can you please look at that and
                            commit if you think it's useful or
                            tell me what to change.
                            That's my commit in the github:
                            and branch:
                            and there's also patch and dialogs
                            pics in the attachment.

Post to  :kicad-developers@xxxxxxxxxxxxxxxxxxx
More help  :https://help.launchpad.net/ListHelp

                        Post to
                        More help

                    Alexander Shuklin

                Alexander Shuklin

            Alexander Shuklin

        Alexander Shuklin

    Alexander Shuklin

Alexander Shuklin

Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Follow ups