Scripting Fabrication Attributes in Pcbnew

Hey folks. I have a dilemma. I really like using the “Config” field property in Eeschema to specify a board variant. This makes excluding certain components from KiBOM’s BOM nice and easy, and overall works well. The issue I have is how to make those excluded components “virtual” in Pcbnew, so they aren’t rendered. Currently this is a manual process.

I’m thinking I could script this. There are two things that I need help with:

  1. How do I access a component’s fabrication attributes via Python? I can’t seem to find useful object in the pcbnew.MODULE class reference.
  2. Is there a way to access Eeschema field properties from Pcbnew without manually parsing each .sch file? Looking specifically for the “Config” field value that I specify.

I’d appreciate it.

In 5.1 there is no easy way to do this (i.e. you’ll have to parse .sch files)
In 5.99 custom fields are propagated to pcbnew and can be read with GetProperties() method.

1 Like

I don’t have answers, at least at the moment. But just for your information, assembly variants have been discussed in

I think using v5.99 could be better. At least it has real “Show” property for 3D models instead of relying on this strange “virtual”. It will also have eeschema python API, although not yet. The symbol properties are propagated to the layout, unlike in v5.1.

Very nice, I’m looking forward to v6. Not sure I’m adventurous enough to give 5.99 a try at the moment… but then again, those features sure are tempting… thanks for the feedback!

5.99 can be installed alongside the stable version.
KiCad 5.1 projects are forward compatible but 5.99 projects are not backward compatible i.e. once they are converted to 5.99 you can’t open them with 5.1.x

Nevertheless, you can safely duplicate and open a 5.1 project to try 5.99 on the copy.