Where pcbnew.GetAbbreviatedUnitsLabel() go now?

Hi,
Does any one know python pcbnew.GetAbbreviatedUnitsLabel() in 4.0.7 used to obtain current setting unit is in 5.x? Thanks.

Since nobody offered a better answer I’ll provide my non-answer.

That function is defined in base_units.h of the source code. As far as I can tell it was never explicitly imported into swig files, which means it was accidentally exposed in API by proxy of including other headers that depended on it. At some point chain of headers was broken or files were moved around and now that function is no longer exported. ¯\_(ツ)_/¯

That’s the side effect of the way python api is implemented right now. Recently some unit tests were added for basic python API functionality to avoid such unintentional breakages but it’s far from full coverage.

Oh well :-). So what is the current internal unit the python API use? mm, mil, or current user setting on the GUI ?

I think pcbnew uses micrometers all the time internally and so does API.

pcbnew IU: 1nm
gerbview IU: 10nm
eeschema IU: 1mil
page layout IU: 1µm

Most pcbnew calls use the IUs but not all.

3 Likes

@Seth_h, The problem is that - If the python script cannot get the current working unit from pcbnew. It cannot talk to the user in the same unit that they chosen. So should I ask for this feature from the bug track ?

Yes. It’s a regression that no one else has reported.

Should I ask for in bug track?

commit b426b9e7840065c271278dc135aa453302d2428c
Author: Seth Hillbrand <@>
Date: Tue Feb 19 05:46:08 2019 -0800

pcbnew: Re-add missing user units python

When moving user user units out of the global, we missed that Python
calls were using it.  This re-adds a function to retrieve user units
allowing the python scripts to show users dialogs in their preferred
units.
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.