Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add support for multiple models to vcarve op.
  • Loading branch information
mlampert committed Jan 25, 2021
1 parent d97a393 commit 31c9dba
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/Mod/Path/PathScripts/PathVcarve.py
Expand Up @@ -242,7 +242,7 @@ def _getPartEdges(self, obj, vWire, geom):
edges.append(_getPartEdge(e, geom))
return edges

def buildPathMedial(self, obj, Faces):
def buildPathMedial(self, obj, faces):
'''constructs a medial axis path using openvoronoi'''

def insert_many_wires(vd, wires):
Expand Down Expand Up @@ -271,7 +271,7 @@ def cutWire(edges):

VD.clear()
voronoiWires = []
for f in Faces:
for f in faces:
vd = Path.Voronoi()
insert_many_wires(vd, f.Wires)

Expand Down Expand Up @@ -321,31 +321,30 @@ def opExecute(self, obj):
"Engraver Cutting Edge Angle must be < 180 degrees.") + "\n")
return
try:
faces = []
if obj.Base:
PathLog.track()
for base in obj.Base:
faces = []
for sub in base[1]:
shape = getattr(base[0].Shape, sub)
if isinstance(shape, Part.Face):
faces.append(shape)

modelshape = Part.makeCompound(faces)

elif len(self.model) == 1 and self.model[0].isDerivedFrom('Sketcher::SketchObject') or \
self.model[0].isDerivedFrom('Part::Part2DObject'):
PathLog.track()
else:
for model in self.model:
if model.isDerivedFrom('Sketcher::SketchObject') or model.isDerivedFrom('Part::Part2DObject'):
faces.extend(model.Shape.Faces)

modelshape = self.model[0].Shape
self.buildPathMedial(obj, modelshape.Faces)
if faces:
self.buildPathMedial(obj, faces)
else:
PathLog.error(translate('PathVcarve', 'The Job Base Object has no engraveable element. Engraving operation will produce no output.'))

except Exception as e:
PathLog.error(e)
traceback.print_exc()
PathLog.error(translate('PathVcarve', 'The Job Base Object has \
no engraveable element. Engraving \
operation will produce no output.'))
raise e
#PathLog.error(e)
#traceback.print_exc()
PathLog.error(translate('PathVcarve', 'Error processing Base object. Engraving operation will produce no output.'))
#raise e

def opUpdateDepths(self, obj, ignoreErrors=False):
'''updateDepths(obj) ... engraving is always done at the top most z-value'''
Expand Down

0 comments on commit 31c9dba

Please sign in to comment.