Skip to content

Commit

Permalink
[OpenSCAD] Add piecewise helix for OCCT < 7.5
Browse files Browse the repository at this point in the history
Address a hang when using older versions of OCC to create a rotated
extrusion. This approximates the auxilliary spine as set of line
segments formed from the helix, rather than using the helix directly.
  • Loading branch information
chennes committed Mar 29, 2021
1 parent b18caba commit fbd6b04
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Mod/OpenSCAD/OpenSCADFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,17 @@ def createGeometry(self,fp):
left_handed = True
else:
left_handed = False

auxiliary_spine = Part.makeHelix(pitch, height, radius, 0.0, left_handed)

# OCC versions before 7.5 had a problem with using a helix as the auxilliary spine, so approximate
# it piecewise
occ_version = Part.OCC_VERSION.split(".")
if int(occ_version[0]) <= 7 and int(occ_version[1]) < 5:
num_points = int(max(3,num_revolutions * 36)) # Every ten degrees is adequate
wire = auxiliary_spine.Wires[0]
points = wire.discretize(Number=num_points)
auxiliary_spine = Part.makePolygon(points)

faces = [lower_face,upper_face]
for wire1,wire2 in zip(lower_face.Wires,upper_face.Wires):
Expand Down

0 comments on commit fbd6b04

Please sign in to comment.