Fix undo/redo sample action plugin for latest API
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10212
This commit is contained in:
parent
134b09004b
commit
bb388d47fc
|
@ -38,7 +38,7 @@ class testundoredo1(ActionPlugin):
|
||||||
for track in pcb.GetTracks():
|
for track in pcb.GetTracks():
|
||||||
pcb.RemoveNative(track)
|
pcb.RemoveNative(track)
|
||||||
|
|
||||||
for draw in pcb.m_Drawings:
|
for draw in pcb.GetDrawings():
|
||||||
pcb.RemoveNative(draw)
|
pcb.RemoveNative(draw)
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,15 +83,15 @@ class testundoredo2(ActionPlugin):
|
||||||
footprint.Add(pad_s0)
|
footprint.Add(pad_s0)
|
||||||
footprint.Add(pad_s1)
|
footprint.Add(pad_s1)
|
||||||
|
|
||||||
e = EDGE_MODULE(footprint)
|
e = FP_SHAPE(footprint)
|
||||||
e.SetStart0(wxPointMM(-1,0))
|
e.SetStart0(wxPointMM(-1,0))
|
||||||
e.SetEnd0(wxPointMM(0,0))
|
e.SetEnd0(wxPointMM(0,0))
|
||||||
e.SetWidth(FromMM(0.2))
|
e.SetWidth(FromMM(0.2))
|
||||||
e.SetLayer(F_SilkS)
|
e.SetLayer(F_SilkS)
|
||||||
e.SetShape(S_SEGMENT)
|
e.SetShape(S_SEGMENT)
|
||||||
module.Add(e)
|
footprint.Add(e)
|
||||||
module.SetPosition(wxPointMM(random.randint(20,200),random.randint(20,150)))
|
footprint.SetPosition(wxPointMM(random.randint(20,200),random.randint(20,150)))
|
||||||
return module
|
return footprint
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class testundoredo2(ActionPlugin):
|
||||||
random.seed()
|
random.seed()
|
||||||
|
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
seg = DRAWSEGMENT()
|
seg = PCB_SHAPE()
|
||||||
seg.SetLayer( random.choice([Edge_Cuts,Cmts_User,Eco1_User,Eco2_User]) )
|
seg.SetLayer( random.choice([Edge_Cuts,Cmts_User,Eco1_User,Eco2_User]) )
|
||||||
seg.SetStart( wxPointMM( random.randint(10,100),
|
seg.SetStart( wxPointMM( random.randint(10,100),
|
||||||
random.randint(10,100) ) )
|
random.randint(10,100) ) )
|
||||||
|
@ -109,11 +109,11 @@ class testundoredo2(ActionPlugin):
|
||||||
self.pcb.Add( seg )
|
self.pcb.Add( seg )
|
||||||
|
|
||||||
if i%2 == 0:
|
if i%2 == 0:
|
||||||
t = TRACK(None)
|
t = PCB_TRACK(None)
|
||||||
else:
|
else:
|
||||||
t = VIA(None)
|
t = PCB_VIA(None)
|
||||||
#t.SetLayerPair(segments['layerPair'][0],segments['layerPair'][1])
|
#t.SetLayerPair(segments['layerPair'][0],segments['layerPair'][1])
|
||||||
t.SetViaType(VIA_THROUGH)
|
t.SetViaType(VIATYPE_THROUGH)
|
||||||
t.SetDrill(FromMM(random.randint(1,20)/10.0))
|
t.SetDrill(FromMM(random.randint(1,20)/10.0))
|
||||||
t.SetStart(wxPointMM(random.randint(100,150),random.randint(100,150)))
|
t.SetStart(wxPointMM(random.randint(100,150),random.randint(100,150)))
|
||||||
t.SetEnd(wxPointMM(random.randint(100,150),random.randint(100,150)))
|
t.SetEnd(wxPointMM(random.randint(100,150),random.randint(100,150)))
|
||||||
|
@ -121,7 +121,7 @@ class testundoredo2(ActionPlugin):
|
||||||
t.SetLayer(random.choice([F_Cu,B_Cu]))
|
t.SetLayer(random.choice([F_Cu,B_Cu]))
|
||||||
self.pcb.Add(t)
|
self.pcb.Add(t)
|
||||||
|
|
||||||
self.createFPCXModule(random.randint(2,40))
|
self.createFPCXFootprint(random.randint(2,40))
|
||||||
|
|
||||||
|
|
||||||
class testundoredo3(ActionPlugin):
|
class testundoredo3(ActionPlugin):
|
||||||
|
@ -138,15 +138,15 @@ class testundoredo3(ActionPlugin):
|
||||||
area = pcb.GetArea(i)
|
area = pcb.GetArea(i)
|
||||||
area.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
area.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||||
|
|
||||||
for module in pcb.GetFootprints():
|
for footprint in pcb.GetFootprints():
|
||||||
module.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
footprint.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||||
if random.randint(0,10) > 5:
|
if random.randint(0,10) > 5:
|
||||||
module.Flip(module.GetPosition())
|
footprint.Flip(footprint.GetPosition(), True)
|
||||||
|
|
||||||
for track in pcb.GetTracks():
|
for track in pcb.GetTracks():
|
||||||
track.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
track.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||||
|
|
||||||
for draw in pcb.m_Drawings:
|
for draw in pcb.GetDrawings():
|
||||||
draw.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
draw.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue