Accessing the "Do not place" attribute from pcbnew

57 views
Skip to first unread message

Daniel O'Connor

unread,
Apr 10, 2023, 9:09:54 AM4/10/23
to dev...@kicad.org
Hi,
I'd like to modify a plugin to honour the DNP flag - it runs in pcbnew as an action plugin - however I can't see how I can get the flag.

Does anyone know how I can do that? (or if it's possible :)

I also wonder how hard it would be to add a flag to the 3d viewer to not display parts which have the DNP flag fitted.


Also, while looking through the Kicad code to try and see how it worked I found this in kicad/cli/command_export_sch_bom.cpp:
bomJob->m_groupSymbols = m_argParser.get<bool>( ARG_GROUP_SYMBOLS );
bomJob->m_groupSymbols = m_argParser.get<bool>( ARG_EXCLUDE_DNP );

It seems like the first assignment is dead (assuming there aren't any side effects)..

Thanks.

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum

Seth Hillbrand

unread,
Apr 10, 2023, 9:34:36 AM4/10/23
to KiCad Developers
Hi Daniel-

Your access it like this:

for fp in b.Footprints():
    p = fp.GetProperties()
    if 'dnp' in p.keys():
        print("DNP: " + fp.GetReference())

--
You received this message because you are subscribed to the Google Groups "KiCad Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to devlist+u...@kicad.org.
To view this discussion on the web visit https://groups.google.com/a/kicad.org/d/msgid/devlist/DFDEF3E1-A90F-4CC9-9206-D53F1467DBDD%40dons.net.au.

Mike Williams

unread,
Apr 10, 2023, 1:25:02 PM4/10/23
to dev...@kicad.org
Hi Daniel,

I needed the Do not place attribute properly propagated to footprints as part of some work on the BOM exporter I have been doing. I went ahead and added a toggle to the 3D viewer for showing/hiding models for footprints with DNP set.

Mike

Daniel O'Connor

unread,
Apr 10, 2023, 7:45:11 PM4/10/23
to dev...@kicad.org
Hi Seth,

> On 10 Apr 2023, at 23:04, Seth Hillbrand <se...@kipro-pcb.com> wrote:
> Your access it like this:
>
> for fp in b.Footprints():
> p = fp.GetProperties()
> if 'dnp' in p.keys():
> print("DNP: " + fp.GetReference())

Thanks, that works a treat.

Daniel O'Connor

unread,
Apr 10, 2023, 7:45:35 PM4/10/23
to dev...@kicad.org
Hi Mike,

> On 11 Apr 2023, at 02:54, Mike Williams <mikebw...@gmail.com> wrote:
>
> I needed the Do not place attribute properly propagated to footprints as part of some work on the BOM exporter I have been doing. I went ahead and added a toggle to the 3D viewer for showing/hiding models for footprints with DNP set.

Excellent, thanks :)
Reply all
Reply to author
Forward
0 new messages