Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the objects Label of unfolded objects. #352

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions SheetMetalUnfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,12 @@ def processUnfold(
if shape is None:
raise UnfoldException()

unfoldShape = FreeCAD.ActiveDocument.addObject("Part::Feature", "Unfold")
try:
unfoldBaseName = object.Parents[0][0].Label + "_Unfolded"
except:
unfoldBaseName = "Unfolded"

unfoldShape = FreeCAD.ActiveDocument.addObject("Part::Feature", unfoldBaseName)
unfoldShape.Shape = shape

if genSketch:
Expand All @@ -3163,7 +3168,7 @@ def processUnfold(

if not splitSketches:
edges.append(foldEdges)
unfold_sketch = generateSketch(edges, "Unfold_Sketch", sketchColor)
unfold_sketch = generateSketch(edges, unfoldBaseName + "_Sketch", sketchColor)
FreeCAD.ActiveDocument.recompute()

if splitSketches:
Expand All @@ -3189,7 +3194,7 @@ def processUnfold(
FreeCAD.ActiveDocument.recompute()

unfold_sketch_outline = generateSketch(
owEdgs, "Unfold_Sketch_Outline", sketchColor
owEdgs, unfoldBaseName + "_Sketch_Outline", sketchColor
)

if tidy:
Expand All @@ -3209,7 +3214,7 @@ def processUnfold(
intEdgs.append(e)
if len(intEdgs) > 0:
unfold_sketch_internal = generateSketch(
intEdgs, "Unfold_Sketch_Internal", internalSketchColor
intEdgs, unfoldBaseName + "_Sketch_Internal", internalSketchColor
)

except Exception as e:
Expand All @@ -3224,7 +3229,7 @@ def processUnfold(

if len(foldLines) > 0 and splitSketches:
unfold_sketch_bend = generateSketch(
foldEdges, "Unfold_Sketch_bends", bendSketchColor
foldEdges, unfoldBaseName + "_Sketch_bends", bendSketchColor
)

if FreeCAD.GuiUp:
Expand Down