For tracks that have to cross multiple reference frames it is helpful to be able to add points to them, where each new point is computed in the current matrix. I hacked something together in my code to do this, which might be useful to figure out how to add it to the library.
class Track:
def __init__(self, painter, net=None):
self.painter = painter
self.net = net
self.prev = None
def add(self, x, y):
new_xy = self.painter._local_to_world(x,y)
if self.prev is None:
self.prev = new_xy
return
track = pcbnew.PCB_TRACK(self.painter.pcb)
track.SetWidth(pcbnew.FromMM(self.painter.draw_width))
track.SetLayer(self.painter.layers[self.painter.draw_layer])
if self.net is not None:
track.SetNet(self.painter._find_net(self.net))
track.SetStart(self.prev)
track.SetEnd(new_xy)
self.prev = new_xy
return self.painter._add_item(track)
For tracks that have to cross multiple reference frames it is helpful to be able to add points to them, where each new point is computed in the current matrix. I hacked something together in my code to do this, which might be useful to figure out how to add it to the library.