Esempio n. 1
0
 def execute(self, fp):
     fp.rack.m = fp.module.Value
     fp.rack.z = fp.teeth
     fp.rack.pressure_angle = fp.pressure_angle.Value * np.pi / 180.
     fp.rack.thickness = fp.thickness.Value
     fp.rack.beta = fp.beta.Value * np.pi / 180.
     fp.rack.head = fp.head
     fp.rack._update()
     pts = fp.rack.points()
     pol = Wire(makePolygon(list(map(fcvec, pts))))
     if fp.beta.Value == 0:
         face = Face(Wire(pol))
         fp.Shape = face.extrude(fcvec([0., 0., fp.height.Value]))
     elif fp.double_helix:
         beta = fp.beta.Value * np.pi / 180.
         pol2 = Part.Wire(pol)
         pol2.translate(fcvec([0., np.tan(beta) * fp.height.Value / 2, fp.height.Value / 2]))
         pol3 = Part.Wire(pol)
         pol3.translate(fcvec([0., 0., fp.height.Value]))
         fp.Shape = makeLoft([pol, pol2, pol3], True, True)
     else:
         beta = fp.beta.Value * np.pi / 180.
         pol2 = Part.Wire(pol)
         pol2.translate(fcvec([0., np.tan(beta) * fp.height.Value, fp.height.Value]))
         fp.Shape = makeLoft([pol, pol2], True)
Esempio n. 2
0
 def execute(self, fp):
     fp.gear.m = fp.module.Value
     fp.gear.z = fp.teeth
     fp.gear.z1 = fp.inner_diameter.Value
     fp.gear.z2 = fp.outer_diameter.Value
     fp.gear.clearance = fp.clearance
     fp.gear.backlash = fp.backlash.Value
     fp.gear._update()
     pts = fp.gear.points(num=fp.numpoints)
     rotated_pts = pts
     rot = rotation(-fp.gear.phipart)
     for i in range(fp.gear.z - 1):
         rotated_pts = list(map(rot, rotated_pts))
         pts.append(np.array([pts[-1][-1], rotated_pts[0][0]]))
         pts += rotated_pts
     pts.append(np.array([pts[-1][-1], pts[0][0]]))
     wi = []
     for i in pts:
         out = BSplineCurve()
         out.interpolate(list(map(fcvec, i)))
         wi.append(out.toShape())
     wi = Wire(wi)
     if fp.height.Value == 0:
         fp.Shape = wi
     elif fp.beta.Value == 0:
         sh = Face(wi)
         fp.Shape = sh.extrude(App.Vector(0, 0, fp.height.Value))
     else:
         fp.Shape = helicalextrusion(
             wi, fp.height.Value, fp.height.Value * np.tan(fp.beta.Value * np.pi / 180) * 2 / fp.gear.d, fp.double_helix)
Esempio n. 3
0
 def execute(self, fp):
     fp.gear.m = fp.module.Value
     fp.gear.z = fp.teeth
     fp.gear.z1 = fp.inner_diameter.Value
     fp.gear.z2 = fp.outer_diameter.Value
     fp.gear.clearance = fp.clearance
     fp.gear.backlash = fp.backlash.Value
     fp.gear._update()
     pts = fp.gear.points(num=fp.numpoints)
     rotated_pts = pts
     rot = rotation(-fp.gear.phipart)
     for i in range(fp.gear.z - 1):
         rotated_pts = list(map(rot, rotated_pts))
         pts.append(np.array([pts[-1][-1], rotated_pts[0][0]]))
         pts += rotated_pts
     pts.append(np.array([pts[-1][-1], pts[0][0]]))
     wi = []
     for i in pts:
         out = BSplineCurve()
         out.interpolate(list(map(fcvec, i)))
         wi.append(out.toShape())
     wi = Wire(wi)
     if fp.beta.Value == 0:
         sh = Face(wi)
         fp.Shape = sh.extrude(App.Vector(0, 0, fp.height.Value))
     else:
         fp.Shape = helicalextrusion(
             wi, fp.height.Value, fp.height.Value * np.tan(fp.beta.Value * np.pi / 180) * 2 / fp.gear.d, fp.double_helix)
Esempio n. 4
0
 def execute(self, fp):
     fp.rack.m = fp.module.Value
     fp.rack.z = fp.teeth
     fp.rack.pressure_angle = fp.pressure_angle.Value * pi / 180.
     fp.rack.thickness = fp.thickness.Value
     fp.rack.beta = fp.beta.Value * pi / 180.
     fp.rack.head = fp.head
     fp.rack._update()
     pts = fp.rack.points()
     pol = Wire(makePolygon(list(map(fcvec, pts))))
     if fp.beta.Value == 0:
         face = Face(Wire(pol))
         fp.Shape = face.extrude(fcvec([0., 0., fp.height.Value]))
     elif fp.double_helix:
         beta = fp.beta.Value * pi / 180.
         pol2 = Part.Wire(pol)
         pol2.translate(
             fcvec(
                 [0.,
                  tan(beta) * fp.height.Value / 2, fp.height.Value / 2]))
         pol3 = Part.Wire(pol)
         pol3.translate(fcvec([0., 0., fp.height.Value]))
         fp.Shape = makeLoft([pol, pol2, pol3], True, True)
     else:
         beta = fp.beta.Value * pi / 180.
         pol2 = Part.Wire(pol)
         pol2.translate(
             fcvec([0., tan(beta) * fp.height.Value, fp.height.Value]))
         fp.Shape = makeLoft([pol, pol2], True)
Esempio n. 5
0
 def execute(self, fp):
     fp.gear.m_n = fp.module
     fp.gear.z = fp.teeth
     fp.gear.undercut = fp.undercut
     fp.gear.shift = fp.shift
     fp.gear.alpha = fp.alpha * pi / 180.
     fp.gear.beta = fp.beta * pi / 180
     fp.gear.clearence = fp.clearence
     fp.gear.backslash = fp.backslash
     fp.gear._update()
     pts = fp.gear.points(num = fp.numpoints)
     w1 = []
     for i in pts:
         out = BSplineCurve()
         out.interpolate(map(fcvec,i))
         w1.append(out)
     s = Shape(w1)
     wi0 = Wire(s.Edges)
     wi=[]
     for i in range(fp.gear.z):
         rot = App.Matrix()
         rot.rotateZ(i*fp.gear.phipart)
         wi.append(wi0.transformGeometry(rot))
     wi = Wire(wi)
     if fp.beta == 0:
         sh = Face(wi)
         fp.Shape = sh.extrude(App.Vector(0,0,fp.height))            
     else:
         fp.Shape = helicalextrusion(wi, fp.height, fp.height * tan(fp.gear.beta) * 2 / fp.gear.d)
Esempio n. 6
0
 def execute(self, fp):
     self.cycloidegear.m = fp.module
     self.cycloidegear.z = fp.teeth
     self.cycloidegear.d1 = fp.inner_diameter
     self.cycloidegear.d2 = fp.outer_diameter
     self.cycloidegear.clearence = fp.clearence
     self.cycloidegear.backslash = fp.backslash
     self.cycloidegear._update()
     pts = self.cycloidegear.points(num = fp.numpoints)
     w1 = []
     for i in pts:
         out = BSplineCurve()
         out.interpolate(map(fcvec,i))
         w1.append(out)
     s = Shape(w1)
     wi0 = Wire(s.Edges)
     wi=[]
     for i in range(self.cycloidegear.z):
         rot = App.Matrix()
         rot.rotateZ(i*self.cycloidegear.phipart)
         wi.append(wi0.transformGeometry(rot))
     wi = Wire(wi)
     if fp.beta == 0:
         sh = Face(wi)
         fp.Shape = sh.extrude(App.Vector(0,0,fp.height))            
     else:
         fp.Shape = helicalextrusion(wi, fp.height, fp.height * tan(fp.beta * pi / 180) * 2 / self.cycloidegear.d)
Esempio n. 7
0
    def execute(self, fp):
        super(InvoluteGear, self).execute(fp)
        fp.gear.double_helix = fp.double_helix
        fp.gear.m_n = fp.module.Value
        fp.gear.z = fp.teeth
        fp.gear.undercut = fp.undercut
        fp.gear.shift = fp.shift
        fp.gear.pressure_angle = fp.pressure_angle.Value * np.pi / 180.
        fp.gear.beta = fp.beta.Value * np.pi / 180
        fp.gear.clearance = fp.clearance
        fp.gear.backlash = fp.backlash.Value * \
            (-fp.reversed_backlash + 0.5) * 2.
        fp.gear.head = fp.head
        # checksbackwardcompatibility:
        if "properties_from_tool" in fp.PropertiesList:
            fp.gear.properties_from_tool = fp.properties_from_tool
        fp.gear._update()
        pts = fp.gear.points(num=fp.numpoints)
        rotated_pts = pts
        rot = rotation(-fp.gear.phipart)
        for i in range(fp.gear.z - 1):
            rotated_pts = list(map(rot, rotated_pts))
            pts.append(np.array([pts[-1][-1], rotated_pts[0][0]]))
            pts += rotated_pts
        pts.append(np.array([pts[-1][-1], pts[0][0]]))
        if not fp.simple:
            wi = []
            for i in pts:
                out = BSplineCurve()
                out.interpolate(list(map(fcvec, i)))
                wi.append(out.toShape())
            wi = Wire(wi)
            if fp.height.Value == 0:
                fp.Shape = wi
            elif fp.beta.Value == 0:
                sh = Face(wi)
                fp.Shape = sh.extrude(App.Vector(0, 0, fp.height.Value))
            else:
                fp.Shape = helicalextrusion(
                    wi, fp.height.Value, fp.height.Value * np.tan(fp.gear.beta) * 2 / fp.gear.d, fp.double_helix)
        else:
            rw = fp.gear.dw / 2
            fp.Shape = Part.makeCylinder(rw, fp.height.Value)

        # computed properties
        fp.dw = "{}mm".format(fp.gear.dw)
        fp.transverse_pitch = "{}mm".format(fp.gear.pitch)
        # checksbackwardcompatibility:
        if not "da" in fp.PropertiesList:
            self.add_limiting_diameter_properties(fp)
        fp.da = "{}mm".format(fp.gear.da)
        fp.df = "{}mm".format(fp.gear.df)
Esempio n. 8
0
    def execute(self, fp):
        fp.gear.m_n = fp.module.Value
        fp.gear.z = fp.teeth
        fp.gear.undercut = fp.undercut
        fp.gear.shift = fp.shift
        fp.gear.alpha = fp.alpha.Value * pi / 180.
        fp.gear.beta = fp.beta.Value * pi / 180
        fp.gear.clearence = fp.clearence
        fp.gear.backlash = fp.backlash.Value
        fp.gear._update()
        pts = fp.gear.points(num=fp.numpoints)
        if not fp.simple:
            wi = []
            for i in pts:
                out = BSplineCurve()
                out.interpolate(map(fcvec, i))
                wi.append(out)
            s = Wire(Shape(wi).Edges)
            wi = []
            for i in range(fp.gear.z):
                rot = App.Matrix()
                rot.rotateZ(-i * fp.gear.phipart)
                tooth_rot = s.transformGeometry(rot)
                if i != 0:
                    pt_0 = wi[-1].Edges[-1].Vertexes[0].Point
                    pt_1 = tooth_rot.Edges[0].Vertexes[-1].Point
                    wi.append(Wire([Line(pt_0, pt_1).toShape()]))
                wi.append(tooth_rot)
            pt_0 = wi[-1].Edges[-1].Vertexes[0].Point
            pt_1 = wi[0].Edges[0].Vertexes[-1].Point
            wi.append(Wire([Line(pt_0, pt_1).toShape()]))

            wi = Wire(wi)
            fp.Shape = wi
            if fp.beta.Value == 0:
                sh = Face(wi)
                fp.Shape = sh.extrude(App.Vector(0, 0, fp.height.Value))
            else:
                fp.Shape = helicalextrusion(
                    wi, fp.height.Value, fp.height.Value * tan(fp.gear.beta) * 2 / fp.gear.d)
        else:
            rw = fp.gear.dw / 2
            circle = Part.Circle(App.Vector(0, 0, 0), App.Vector(0, 0, 1), rw)
            wire = Part.Wire(circle.toShape())
            face = Part.Face(wire)
            fp.Shape = face.extrude(App.Vector(0, 0, fp.height.Value))
Esempio n. 9
0
 def execute(self, fp):
     fp.rack.m = fp.module.Value
     fp.rack.z = fp.teeth
     fp.rack.pressure_angle = fp.pressure_angle.Value * np.pi / 180.
     fp.rack.thickness = fp.thickness.Value
     fp.rack.beta = fp.beta.Value * np.pi / 180.
     fp.rack.head = fp.head
     # checksbackwardcompatibility:
     if "clearance" in fp.PropertiesList:
         fp.rack.clearance = fp.clearance
     if "properties_from_tool" in fp.PropertiesList:
         fp.rack.properties_from_tool = fp.properties_from_tool
     if "add_endings" in fp.PropertiesList:
         fp.rack.add_endings = fp.add_endings
     if "simplified" in fp.PropertiesList:
         fp.rack.simplified = fp.simplified
     fp.rack._update()
     pts = fp.rack.points()
     pol = Wire(makePolygon(list(map(fcvec, pts))))
     if fp.height.Value == 0:
         fp.Shape = pol
     elif fp.beta.Value == 0:
         face = Face(Wire(pol))
         fp.Shape = face.extrude(fcvec([0., 0., fp.height.Value]))
     elif fp.double_helix:
         beta = fp.beta.Value * np.pi / 180.
         pol2 = Part.Wire(pol)
         pol2.translate(
             fcvec([
                 0.,
                 np.tan(beta) * fp.height.Value / 2, fp.height.Value / 2
             ]))
         pol3 = Part.Wire(pol)
         pol3.translate(fcvec([0., 0., fp.height.Value]))
         fp.Shape = makeLoft([pol, pol2, pol3], True, True)
     else:
         beta = fp.beta.Value * np.pi / 180.
         pol2 = Part.Wire(pol)
         pol2.translate(
             fcvec([0., np.tan(beta) * fp.height.Value, fp.height.Value]))
         fp.Shape = makeLoft([pol, pol2], True)
     # computed properties
     if "transverse_pitch" in fp.PropertiesList:
         fp.transverse_pitch = "{} mm".format(
             fp.rack.compute_properties()[2])
Esempio n. 10
0
 def execute(self, fp):
     fp.gear.double_helix = fp.double_helix
     fp.gear.m_n = fp.module.Value
     fp.gear.z = fp.teeth
     fp.gear.undercut = fp.undercut
     fp.gear.shift = fp.shift
     fp.gear.pressure_angle = fp.pressure_angle.Value * pi / 180.
     fp.gear.beta = fp.beta.Value * pi / 180
     fp.gear.clearance = fp.clearance
     fp.gear.backlash = fp.backlash.Value * (-fp.reversed_backlash +
                                             0.5) * 2.
     fp.gear.head = fp.head
     fp.gear._update()
     pts = fp.gear.points(num=fp.numpoints)
     rotated_pts = pts
     rot = rotation(-fp.gear.phipart)
     for i in range(fp.gear.z - 1):
         rotated_pts = list(map(rot, rotated_pts))
         pts.append(numpy.array([pts[-1][-1], rotated_pts[0][0]]))
         pts += rotated_pts
     pts.append(numpy.array([pts[-1][-1], pts[0][0]]))
     if not fp.simple:
         wi = []
         for i in pts:
             out = BSplineCurve()
             out.interpolate(list(map(fcvec, i)))
             wi.append(out.toShape())
         wi = Wire(wi)
         if fp.beta.Value == 0:
             sh = Face(wi)
             fp.Shape = sh.extrude(App.Vector(0, 0, fp.height.Value))
         else:
             fp.Shape = helicalextrusion(
                 wi, fp.height.Value,
                 fp.height.Value * tan(fp.gear.beta) * 2 / fp.gear.d,
                 fp.double_helix)
     else:
         rw = fp.gear.dw / 2
         circle = Part.Circle(App.Vector(0, 0, 0), App.Vector(0, 0, 1), rw)
         wire = Part.Wire(circle.toShape())
         face = Part.Face(wire)
         fp.Shape = face.extrude(App.Vector(0, 0, fp.height.Value))
Esempio n. 11
0
 def execute(self, fp):
     pass
     fp.gear.m = fp.module.Value
     fp.gear.z = fp.teeth
     fp.gear.z1 = fp.inner_diameter.Value
     fp.gear.z2 = fp.outer_diameter.Value
     fp.gear.clearence = fp.clearence
     fp.gear.backlash = fp.backlash.Value
     fp.gear._update()
     pts = fp.gear.points(num=fp.numpoints)
     wi = []
     for i in pts:
         out = BSplineCurve()
         out.interpolate(map(fcvec, i))
         wi.append(out)
     s = Wire(Shape(wi).Edges)
     wi = []
     for i in range(fp.gear.z):
         rot = App.Matrix()
         rot.rotateZ(-i * fp.gear.phipart)
         tooth_rot = s.transformGeometry(rot)
         if i != 0:
             pt_0 = wi[-1].Edges[-1].Vertexes[0].Point
             pt_1 = tooth_rot.Edges[0].Vertexes[-1].Point
             wi.append(Wire([Line(pt_0, pt_1).toShape()]))
         wi.append(tooth_rot)
     pt_0 = wi[-1].Edges[-1].Vertexes[0].Point
     pt_1 = wi[0].Edges[0].Vertexes[-1].Point
     wi.append(Wire([Line(pt_0, pt_1).toShape()]))
     wi = Wire(wi)
     if fp.beta.Value == 0:
         sh = Face(wi)
         fp.Shape = sh.extrude(App.Vector(0, 0, fp.height.Value))
     else:
         pass
         fp.Shape = helicalextrusion(
             wi, fp.height.Value, fp.height.Value * tan(fp.beta.Value * pi / 180) * 2 / fp.gear.d)
Esempio n. 12
0
 def execute(self, fp):
     fp.gear.double_helix = fp.double_helix
     fp.gear.m_n = fp.module.Value
     fp.gear.z = fp.teeth
     fp.gear.undercut = fp.undercut
     fp.gear.shift = fp.shift
     fp.gear.pressure_angle = fp.pressure_angle.Value * np.pi / 180.
     fp.gear.beta = fp.beta.Value * np.pi / 180
     fp.gear.clearance = fp.clearance
     fp.gear.backlash = fp.backlash.Value * (-fp.reversed_backlash + 0.5) * 2.
     fp.gear.head = fp.head
     fp.gear._update()
     pts = fp.gear.points(num=fp.numpoints)
     rotated_pts = pts
     rot = rotation(-fp.gear.phipart)
     for i in range(fp.gear.z - 1):
         rotated_pts = list(map(rot, rotated_pts))
         pts.append(np.array([pts[-1][-1], rotated_pts[0][0]]))
         pts += rotated_pts
     pts.append(np.array([pts[-1][-1], pts[0][0]]))
     if not fp.simple:
         wi = []
         for i in pts:
             out = BSplineCurve()
             out.interpolate(list(map(fcvec, i)))
             wi.append(out.toShape())
         wi = Wire(wi)
         if fp.beta.Value == 0:
             sh = Face(wi)
             fp.Shape = sh.extrude(App.Vector(0, 0, fp.height.Value))
         else:
             fp.Shape = helicalextrusion(
                 wi, fp.height.Value, fp.height.Value * np.tan(fp.gear.beta) * 2 / fp.gear.d, fp.double_helix)
     else:
         rw = fp.gear.dw / 2
         fp.Shape=Part.makeCylinder(rw,fp.height.Value)
Esempio n. 13
0
    def execute(self,fp):
        b = fp.pin_circle_radius
        d = fp.roller_diameter
        e = fp.eccentricity
        n = fp.teeth_number
        p = b/n
        s = fp.segment_count
        ang = fp.pressure_angle_lim
        c = fp.pressure_angle_offset

        q = 2*math.pi/float(s)

        # Find the pressure angle limit circles
        minAngle = -1.0
        maxAngle = -1.0
        for i in range(0, 180):
            x = self.calc_pressure_angle(p, d, n, i * math.pi / 180.)
            if ( x < ang) and (minAngle < 0):
                minAngle = float(i)
            if (x < -ang) and (maxAngle < 0):
                maxAngle = float(i-1)

        minRadius = self.calc_pressure_limit(p, d, e, n, minAngle * math.pi / 180.)
        maxRadius = self.calc_pressure_limit(p, d, e, n, maxAngle * math.pi / 180.)
        # unused
        # Wire(Part.makeCircle(minRadius,App.Vector(-e, 0, 0)))
        # Wire(Part.makeCircle(maxRadius,App.Vector(-e, 0, 0)))

        App.Console.PrintMessage("Generating cam disk\r\n")
        #generate the cam profile - note: shifted in -x by eccentricicy amount
        i=0
        x = self.calc_x(p, d, e, n, q*i / float(n))
        y = self.calc_y(p, d, e, n, q*i / n)
        x, y = self.check_limit(x,y,maxRadius,minRadius,c)
        points = [App.Vector(x-e, y, 0)]
        for i in range(0,s):
            x = self.calc_x(p, d, e, n, q*(i+1) / n)
            y = self.calc_y(p, d, e, n, q*(i+1) / n)
            x, y = self.check_limit(x, y, maxRadius, minRadius, c)
            points.append([x-e, y, 0])

        wi = make_bspline_wire([points])
        wires = []
        mat= App.Matrix()
        mat.move(App.Vector(e, 0., 0.))
        mat.rotateZ(2 * np.pi / n)
        mat.move(App.Vector(-e, 0., 0.))
        for _ in range(n):
            wi = wi.transformGeometry(mat)
            wires.append(wi)

        cam = Face(Wire(wires))
        #add a circle in the center of the cam
        if fp.hole_radius.Value:
            centerCircle = Face(Wire(Part.makeCircle(fp.hole_radius.Value, App.Vector(-e, 0, 0))))
            cam = cam.cut(centerCircle)

        to_be_fused = []
        if fp.show_disk0==True:
            if fp.disk_height.Value==0:
                to_be_fused.append(cam)
            else:
                to_be_fused.append(cam.extrude(App.Vector(0, 0, fp.disk_height.Value)))

        #secondary cam disk
        if fp.show_disk1==True:
            App.Console.PrintMessage("Generating secondary cam disk\r\n")
            second_cam = cam.copy()
            mat= App.Matrix()
            mat.rotateZ(np.pi)
            mat.move(App.Vector(-e, 0, 0))
            if n%2 == 0:
                mat.rotateZ(np.pi/n)
            mat.move(App.Vector(e, 0, 0))
            second_cam = second_cam.transformGeometry(mat)
            if fp.disk_height.Value==0:
                to_be_fused.append(second_cam)
            else:
                to_be_fused.append(second_cam.extrude(App.Vector(0, 0, -fp.disk_height.Value)))

        #pins
        if fp.show_pins==True:
            App.Console.PrintMessage("Generating pins\r\n")
            pins = []
            for i in range(0, n + 1):
                x = p * n * math.cos(2 * math.pi / (n + 1) * i)
                y = p * n * math.sin(2 * math.pi / (n + 1) * i)
                pins.append(Wire(Part.makeCircle(d / 2, App.Vector(x, y, 0))))

            pins = Face(pins)

            z_offset = -fp.pin_height.Value / 2;

            if fp.center_pins==True:
                if fp.show_disk0==True and fp.show_disk1==False:
                    z_offset += fp.disk_height.Value / 2;
                elif fp.show_disk0==False and fp.show_disk1==True:
                    z_offset += -fp.disk_height.Value / 2;
            #extrude
            if z_offset!=0:
                pins.translate(App.Vector(0, 0, z_offset))
            if fp.pin_height!=0:
                pins = pins.extrude(App.Vector(0, 0, fp.pin_height.Value))

            to_be_fused.append(pins);

        if to_be_fused:
            fp.Shape = Part.makeCompound(to_be_fused)