def helicalextrusion(wire, height, angle, double_helix = False): direction = bool(angle < 0) if double_helix: first_spine = makeHelix(height * 2. * np.pi / abs(angle), 0.5 * height, 10., 0, direction) first_solid = first_spine.makePipeShell([wire], True, True) second_solid = first_solid.mirror(fcvec([0.,0.,0.]), fcvec([0,0,1])) faces = first_solid.Faces + second_solid.Faces faces = [f for f in faces if not on_mirror_plane(f, 0., fcvec([0., 0., 1.]))] solid = makeSolid(makeShell(faces)) mat = App.Matrix() mat.move(fcvec([0, 0, 0.5 * height])) return solid.transformGeometry(mat) else: first_spine = makeHelix(height * 2 * np.pi / abs(angle), height, 10., 0, direction) first_solid = first_spine.makePipeShell([wire], True, True) return first_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 / 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, double_helix=False): direction = bool(angle < 0) if double_helix: first_spine = makeHelix(height * 2. * np.pi / abs(angle), 0.5 * height, 10., 0, direction) first_solid = first_spine.makePipeShell([wire], True, True) second_solid = first_solid.mirror( fcvec([0., 0., 0.]), fcvec([0, 0, 1])) faces = first_solid.Faces + second_solid.Faces faces = [f for f in faces if not on_mirror_plane( f, 0., fcvec([0., 0., 1.]))] solid = makeSolid(makeShell(faces)) mat = App.Matrix() mat.move(fcvec([0, 0, 0.5 * height])) return solid.transformGeometry(mat) else: first_spine = makeHelix(height * 2 * np.pi / abs(angle), height, 10., 0, direction) first_solid = first_spine.makePipeShell([wire], True, True) return first_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)
def helicalextrusion(wire, height, angle): 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)) solid = auxspine.makePipeShell([wire], True, True) return solid