From 9078a1838fbb381a7b9839db8316d6dea42bfbf3 Mon Sep 17 00:00:00 2001 From: jaisekjames <44542605+jaisekjames@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:27:39 +0530 Subject: [PATCH] Jaisekjames patch 1 (#368) Fix for below issue. testing needed. https://github.com/shaise/FreeCAD_SheetMetal/issues/363 --- SheetMetalBendSolid.py | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/SheetMetalBendSolid.py b/SheetMetalBendSolid.py index a4a0ab3..4d069ac 100644 --- a/SheetMetalBendSolid.py +++ b/SheetMetalBendSolid.py @@ -229,18 +229,36 @@ def bend_solid(sel_face, sel_edge, bend_r, thickness, neutral_radius, axis, flip face_elt = shape.Face1 - wrapped_faces = wrap_face( - sel_face, neutral_radius, axis, normal, zero_vert, center, zero_vert_normal - ) - edge_list = Part.__sortEdges__(wrapped_faces) + outWire = sel_face.OuterWire + #Part.show(outWire, "outWire") + wrap_wire = wrap_face(outWire, neutral_radius, axis, normal, zero_vert, center, zero_vert_normal) + edge_list = Part.__sortEdges__(wrap_wire) wire = Part.Wire(edge_list) - next_face = Part.Face(face_elt.Surface, wire) - next_face.validate() - next_face.check(True) # No output = good - - if not flipped: - bent_solid = next_face.makeOffsetShape(thickness, 0.0, fill=True) + #Part.show(myWire, "myWire") + OuterFace = Part.Face(face_elt.Surface, wire) + #f.check(True) + OuterFace.validate() + #Part.show(OuterFace, "OuterFace") + OuterFace.check(True) # No output = good + #Part.show(OuterFace, "OuterFace") + for fWire in sel_face.Wires : + if not(outWire.isEqual(fWire)) : + wrap_wire = wrap_face(fWire, neutral_radius, axis, normal, zero_vert, center, zero_vert_normal) + edge_list = Part.__sortEdges__(wrap_wire) + wire = Part.Wire(edge_list) + #Part.show(myWire, "myWire") + InnerFace = Part.Face(face_elt.Surface, wire) + #f.check(True) + InnerFace.validate() + #Part.show(InnerFace, "InnerFace") + InnerFace.check(True) # No output = good + #Part.show(InnerFace, "InnerFace") + OuterFace = OuterFace.cut(InnerFace) + + if not(flipped) : + bent_solid = OuterFace.makeOffsetShape(thickness, 0.0, fill = True) else: - bent_solid = next_face.makeOffsetShape(-thickness, 0.0, fill=True) + bent_solid = OuterFace.makeOffsetShape(-thickness, 0.0, fill = True) + #Part.show(bendsolid, "bendsolid") return bent_solid