How to assign net class to net from python in with KiCad 7

I am trying to assign a net class to a net in python. What I tried is NETINFO_ITEM.SetNetClass, but that appears to have no effect, neither in the UI or when reading the net with NET_SETTINGS.GetEffectiveNetClass.

I feel like I need to modify the m_NetClassLabelAssignments field of the NET_SETTINGS, but I can’t find a way to access that from python.

For anyone running into the same issue, I haven’t found a way to do this. To work around that, I am using a patched version of KiCad 7, which has the line

%ignore NET_SETTINGS::m_NetClassLabelAssignments;

in pcbnew/python/swig/board_design_settings.i removed. Using that, I can assign net classes to nets by modifying that map from Python directly (the keys are the net names, the values the net classes)

1 Like

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