Do you need to net name changed in just the board file? or in the schematic as well?If you need to change it in the Schematic as well, you can’t do that using the current scripting interface. You probably should be creating nets in the schematic (this is just a warning).
Or is it a new net-class that you would like to create (trace, space, via sizes and so on)?
I’d like to change the net code for my traces and pads, in the board file, via Python.
I’m very stuck as to how I’d go about creating a new net code though.
(The reason I need to do this, is because when I create the tracks programmatically via Python at the moment, they seem to get assigned to the ‘default’ net, which means that when I add components from the schematic to the PCB, they seem to try to use the tracks I created via Python, which I don’t want to happen)
File “/usr/local/lib/python2.7/dist-packages/pcbnew.py”, line 7125, in init
def init(self, *args, **kwargs): raise AttributeError(“No constructor defined - class is abstract”)
AttributeError: No constructor defined - class is abstract
Here is the C++ constructor for the NETINFO_ITEM class
NETINFO_ITEM( BOARD* aParent, const wxString& aNetName, int aNetCode )
There is a aNetCode. Some more reading and it does not seem to be the way to construct a net, it is only the container for some information about the net i.e. name, parent, and the number id of the net.
BTW why is that you would like to create nets in the layout not in the schematic anyways. This seems a little backwards to what I would think the normal method would be.
Did anyone get a working version of this ?
Seems some comments back in Feb around bugs, as best I can tell NETINFO_ITEM exists in new builds, but it seems the syntax above is not quite right here ( #14 & #15) ?
Change of a Reference seems as simple as part.SetReference(“U2n”),
but a change of a Netname seems more complex, but surely is possible ?
What is the simplest way to
a) globally rename a net ?
b) add a new net name ?
I did some investigations today. Couldn’t find a way. NETINFO_ITEM is reported as abstract from the scripting side, but when I look at the c++ code there are certainly a couple occurances of new NETINFO_ITEM(...). That means it’s not actually abstract.
I’ve already updated the bug report, lets see if anyone responds.