Skip to content

Commit

Permalink
Improve progress reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
mitxela committed Feb 26, 2023
1 parent 46de68d commit c0a4fb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 10 additions & 4 deletions round_tracks_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,20 @@ def run( self, event ):
self.addIntermediateTracks(scaling = classes[classname]['scaling'], netclass = classname, native = True, onlySelection = anySelected, avoid_junctions = avoid)
else:
for i in range(classes[classname]['passes']):
self.addIntermediateTracks(scaling = classes[classname]['scaling'], netclass = classname, native = False, onlySelection = anySelected, avoid_junctions = avoid)
self.addIntermediateTracks(scaling = classes[classname]['scaling'], netclass = classname, native = False, onlySelection = anySelected, avoid_junctions = avoid, msg=f", pass {i+1}")

# Track selection apparently de-syncs if we've modified it
if anySelected:
for t in self.board.GetTracks():
t.ClearSelected()

RebuildAllZones(self.board)
# if m_AutoRefillZones is set, we should skip here, but PCBNEW_SETTINGS is not exposed to swig
# ZONE_FILLER has SetProgressReporter, but PROGRESS_REPORTER is also not available, so we can't use it
# even zone.SetNeedRefill(False) doesn't prevent it running twice
self.prog.Pulse("Rebuilding zones...")
wx.Yield()
filler = pcbnew.ZONE_FILLER(self.board)
filler.Fill(self.board.Zones())

if bool(self.prog):
self.prog.Destroy()
Expand Down Expand Up @@ -173,7 +179,7 @@ def validate_all_data (self):
self.config['classes'] = new_config
self.config['checkboxes'] = {'new_file':self.do_create.IsChecked(), 'native':self.use_native.IsChecked(), 'avoid_junctions':self.avoid_junctions.IsChecked()}

def addIntermediateTracks( self, scaling = RADIUS_DEFAULT, netclass = None, native = False, onlySelection = False, avoid_junctions = False):
def addIntermediateTracks( self, scaling = RADIUS_DEFAULT, netclass = None, native = False, onlySelection = False, avoid_junctions = False, msg=""):

# A 90 degree bend will get a maximum radius of this amount
RADIUS = pcbnew.FromMM(scaling /(math.sin( math.pi/4 )+1))
Expand Down Expand Up @@ -371,7 +377,7 @@ def addIntermediateTracks( self, scaling = RADIUS_DEFAULT, netclass = None, nati
if onlySelection:
arc.SetSelected()

self.prog.Pulse(f"Netclass: {netclass}, {netcode} of {len(netcodes)}")
self.prog.Pulse(f"Netclass: {netclass}, {netcode+1} of {len(netcodes)}{msg}")

for t in tracksToRemove:
board.Remove(t)
Expand Down
4 changes: 0 additions & 4 deletions round_tracks_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ def reverseTrack(t1):
t1.SetStart(ep)
t1.SetEnd(sp)

def RebuildAllZones(pcb):
filler = pcbnew.ZONE_FILLER(pcb)
filler.Fill(pcb.Zones())

# determines whether 2 points are close enough to be considered identical
def similarPoints(p1, p2):
return (((p1.x > p2.x - tolerance) and (p1.x < p2.x + tolerance)) and ((p1.y > p2.y - tolerance) and (p1.y < p2.y + tolerance)))
Expand Down

0 comments on commit c0a4fb8

Please sign in to comment.