Skip to content

Commit

Permalink
Jaisekjames patch 1 (#368)
Browse files Browse the repository at this point in the history
Fix for below issue. testing needed.
#363
  • Loading branch information
jaisekjames committed Sep 9, 2024
1 parent 24b10b4 commit 9078a18
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions SheetMetalBendSolid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9078a18

Please sign in to comment.