def helicalextrusion(wire, height, angle): face_a = Face(wire) face_b = face_a.copy() face_transform = App.Matrix() face_transform.rotateZ(angle) face_transform.move(App.Vector(0, 0, height)) face_b.transformShape(face_transform) spine = Wire(Line(fcvec([0., 0, 0]), fcvec([0, 0, height])).toShape()) auxspine = makeHelix(height * 2 * pi / abs(angle), height, 10., 0, bool(angle < 0)) faces = [face_a, face_b] pipeshell = BRepOffsetAPI.MakePipeShell(spine) pipeshell.setSpineSupport(spine) pipeshell.add(wire) pipeshell.setAuxiliarySpine(auxspine, True, False) assert (pipeshell.isReady()) pipeshell.build() faces.extend(pipeshell.shape().Faces) fullshell = Shell(faces) solid = Solid(fullshell) if solid.Volume < 0: solid.reverse() assert (solid.Volume >= 0) return (solid)
def helicalextrusion(wire, height, angle): face_a = Face(wire) face_b = face_a.copy() face_transform = App.Matrix() face_transform.rotateZ(angle) face_transform.move(App.Vector(0,0,height)) face_b . transformShape(face_transform) step = 2 + int(angle / pi * 4 ) angleinc = angle / (step - 1) zinc = height / (step-1) spine = makePolygon([(0, 0, i * zinc) for i in range(step)]) auxspine = makePolygon( [ (cos(i * angleinc), sin(i * angleinc), i * height/(step-1))for i in range(step) ]) faces=[face_a,face_b ] pipeshell = BRepOffsetAPI.MakePipeShell(spine) pipeshell.setSpineSupport(spine) pipeshell.add(wire) pipeshell.setAuxiliarySpine(auxspine,True,False) assert(pipeshell.isReady()) pipeshell.build() faces.extend(pipeshell.shape().Faces) fullshell = Shell(faces) solid = Solid(fullshell) if solid.Volume < 0: solid.reverse() assert(solid.Volume >= 0) return(solid)
def helicalextrusion(wire, height, angle): face_a = Face(wire) face_b = face_a.copy() face_transform = App.Matrix() face_transform.rotateZ(angle) face_transform.move(App.Vector(0, 0, height)) face_b . transformShape(face_transform) spine = Wire(Line(fcvec([0., 0, 0]), fcvec([0, 0, height])).toShape()) auxspine = makeHelix(height * 2 * pi / angle, height, 1.) faces = [face_a, face_b] pipeshell = BRepOffsetAPI.MakePipeShell(spine) pipeshell.setSpineSupport(spine) pipeshell.add(wire) pipeshell.setAuxiliarySpine(auxspine, True, False) assert(pipeshell.isReady()) pipeshell.build() faces.extend(pipeshell.shape().Faces) fullshell = Shell(faces) solid = Solid(fullshell) if solid.Volume < 0: solid.reverse() assert(solid.Volume >= 0) return(solid)