Closed gauravmm closed 6 months ago
I can't figure out how to add a net to the API, or even if I need to bother at all. I'll run some experiments and then decide, but if you know something about this let me know.
I feel like adding Nets to the PCB shouldn't be necessary. Won't all the Nets we need exist from importing the schematic? Also- Thanks you for taking the time to write this plugin, I have found it very useful.
I think its used to associate traces with nets. I've no idea if KiCAD will infer the nets automatically, or something else.
Under kicad 6.0 nets.AppendNet() appears to add a new net to the NETINFO_LIST:
>> import pcbnew
>> board = pcbnew.GetBoard()
>> nets = board.GetNetInfo()
>> newNet = pcbnew.NETINFO_ITEM(board)
>> newNet.SetNetname("test");
>> board.GetNetCount()
1
>> nets.AppendNet(newNet)
>> board.GetNetCount()
2
We could just return the \<no net> net:
board.FindNet(0)
I'll take a look at this soon, sorry about the delay. Thanks for figuring this out!
We could just return the
net: board.FindNet(0)
That works great! Thanks for figuring this out, I'll merge this to master now.
Here's what needs to be done to support KiCAD 8:
GetSheetfile
andGetSheetname
(Thanks @OfficialDyray)FP_TEXT
toPCB_FIELD
(Thanks @OfficialDyray)nets.AppendNet
infind_or_set_net