Skip to content

Commit

Permalink
Draft: Make Facebinders link-aware (fix errors in previous PR)
Browse files Browse the repository at this point in the history
Previous PR: FreeCAD#11081.
  • Loading branch information
Roy-043 committed Oct 23, 2023
1 parent c017386 commit 28e450e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Mod/Draft/draftobjects/facebinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def execute(self, obj):
if "Face" in sub:
try:
face = Part.getShape(sel[0], sub, needSubElement=True, retType=0)
area += face.Area
if offs_val:
if face.Surface.isPlanar():
norm = face.normalAt(0, 0)
Expand All @@ -86,14 +87,14 @@ def execute(self, obj):
else:
offs = face.makeOffsetShape(offs_val, 1e-7)
faces.extend(offs.Faces)
area += face.Area
else:
faces.append(face)
except Part.OCCError:
print("Draft: error building facebinder")
return
if not faces:
return
try:
sh = None
if extr_val:
extrs = []
for face in faces:
Expand All @@ -104,11 +105,13 @@ def execute(self, obj):
extr = face.makeOffsetShape(extr_val, 1e-7, fill=True)
extrs.extend(extr.Solids)
sh = extrs.pop()
sh = sh.multiFuse(extrs)
if len(faces) > 1:
if not sh:
sh = faces.pop()
if extrs:
sh = sh.multiFuse(extrs)
else:
sh = faces.pop()
if faces:
sh = sh.multiFuse(faces)
if len(faces) > 1:
if hasattr(obj, "Sew") and obj.Sew:
sh.sewShape()
if not hasattr(obj, "RemoveSplitter"):
Expand Down

0 comments on commit 28e450e

Please sign in to comment.