removing vias from a copy of the list to avoid to invalidate the iterators in C++

This commit is contained in:
easyw
2019-11-05 10:07:20 +01:00
parent f3d0485ff7
commit da2a1335e2
2 changed files with 7 additions and 6 deletions

View File

@ -349,11 +349,12 @@ STEP = '-'
# timestmap again available
#target_tracks = filter(lambda x: (x.GetNetname().upper() == self.netname), self.pcb.GetTracks())
target_tracks = filter(lambda x: (x.GetNetname() == self.netname), self.pcb.GetTracks())
for via in target_tracks:
# pprint.pprint(via.GetTimeStamp())
if via.Type() == PCB_VIA_T:
if via.GetTimeStamp() == 33:
self.pcb.RemoveNative(via)
target_tracks_cp = list(target_tracks)
l = len (target_tracks_cp)
for i in range(l):
if target_tracks_cp[i].Type() == PCB_VIA_T:
if target_tracks_cp[i].GetTimeStamp() == 33:
self.pcb.RemoveNative(target_tracks_cp[i])
self.RefillBoardAreas()
return # no need to run the rest of logic

View File

@ -71,7 +71,7 @@ class FillAreaAction(pcbnew.ActionPlugin):
PopulateNets("GND", a)
modal_result = a.ShowModal()
if modal_result == wx.ID_OK:
wx.LogMessage('Via Stitching: Version 1.4')
wx.LogMessage('Via Stitching: Version 1.5')
if 1: # try:
fill = FillArea.FillArea()
fill.SetStepMM(float(a.m_StepMM.GetValue().replace(',', '.')))