def get_pad_pos_angle_layer_net(mod_name, pad_name): mod = get_mod(mod_name) pad = get_pad(mod_name, pad_name) layer = get_mod_layer(mod_name) return (pnt.from_unit(pad.GetPosition(), UnitMM), mod.GetOrientation() / 10, layer, pad.GetNet())
def add_line(a, b, layer='Edge.Cuts', width=2): pnt_a = pnt.to_unit(vec2.round(a, PointDigits), UnitMM) pnt_b = pnt.to_unit(vec2.round(b, PointDigits), UnitMM) if True: aa = pnt.from_unit(pnt_a, UnitMM) bb = pnt.from_unit(pnt_b, UnitMM) length = vec2.distance(bb, aa) if length == 0: print("add_line: identical", a) return elif length < 0.001: #print( length, a, b ) None line = pcbnew.DRAWSEGMENT() line.SetStart(pnt_a) line.SetEnd(pnt_b) line.SetLayer(pcb.GetLayerID(layer)) line.SetWidth(scalar_to_unit(width, UnitMM)) pcb.Add(line) return line
def get_mod_pos_angle(mod_name): mod = get_mod(mod_name) return (pnt.from_unit(mod.GetPosition(), UnitMM), mod.GetOrientation() / 10)
def get_pad_pos_net(mod_name, pad_name): pad = get_pad(mod_name, pad_name) return pnt.from_unit(pad.GetPosition(), UnitMM), pad.GetNet()
def get_via_pos_net(via): return pnt.from_unit(via.GetPosition(), UnitMM), via.GetNet()