Skip to content

Commit

Permalink
Merge pull request FreeCAD#11156 from Roy-043/Draft-Make-Facebinders-…
Browse files Browse the repository at this point in the history
…link-aware-fix-errors-in-previous-PR

Draft: Make Facebinders link-aware (fix errors in previous PR)
  • Loading branch information
Roy-043 authored Oct 23, 2023
2 parents 5ced1c2 + 28e450e commit e6a3470
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 e6a3470

Please sign in to comment.