Example #1
0
 def test_circle_probe(self):
     radius = 30
     angle = zencad.deg(45)
     start = zencad.deg(45)
     stop = zencad.deg(60)
     zencad.circle(r=radius, wire=True)
     zencad.circle(r=radius, angle=angle, wire=True)
     zencad.circle(r=radius, angle=(start, stop), wire=True)
     zencad.circle(r=radius, wire=False)
     zencad.circle(r=radius, angle=angle, wire=False)
     zencad.circle(r=radius, angle=(start, stop), wire=False)
Example #2
0
    def test_sphere_probe(self):
        radius = 20
        minPitch = zencad.deg(-10)
        maxPitch = zencad.deg(20)
        yaw = zencad.deg(130)

        zencad.sphere(r=radius)
        zencad.sphere(r=radius, yaw=yaw)
        zencad.sphere(r=radius, pitch=(minPitch, maxPitch))
        zencad.sphere(r=radius, yaw=yaw, pitch=maxPitch)
        zencad.sphere(r=radius, yaw=yaw, pitch=(minPitch, maxPitch))
Example #3
0
 def test_ellipse_probe(self):
     radius = 50
     radius2 = 30
     angle = zencad.deg(45)
     start = zencad.deg(45)
     stop = zencad.deg(60)
     zencad.ellipse(r1=radius, r2=radius2, wire=True)
     zencad.ellipse(r1=radius, r2=radius2, angle=angle, wire=True)
     zencad.ellipse(r1=radius, r2=radius2, angle=(start, stop), wire=True)
     zencad.ellipse(r1=radius, r2=radius2, wire=False)
     zencad.ellipse(r1=radius, r2=radius2, angle=angle, wire=False)
     zencad.ellipse(r1=radius, r2=radius2, angle=(start, stop), wire=False)
Example #4
0
    def __init__(self, socket=False, center=False):
        super().__init__()

        self.width = y
        self.length = x
        self.cheight = z + hz / 2
        self.height = z + hz

        if socket:
            self.model = charger_tp4056_model()
            self.model = self.model.back(y / 2).left(x).down(
                z + hz / 2).rotateY(-zencad.deg(90)).rotateZ(-zencad.deg(90))
            self.iobj = self.add_shape(self.model)
Example #5
0
    def test_ellipse_probe(self):
        radius = 50
        radius2 = 30
        angle = zencad.deg(45)
        start = zencad.deg(45)
        stop = zencad.deg(60)
        zencad.ellipse(r1=radius, r2=radius2, wire=True)
        zencad.ellipse(r1=radius, r2=radius2, angle=angle, wire=True)
        zencad.ellipse(r1=radius, r2=radius2, angle=(start, stop), wire=True)
        zencad.ellipse(r1=radius, r2=radius2, wire=False)
        zencad.ellipse(r1=radius, r2=radius2, angle=angle, wire=False)
        zencad.ellipse(r1=radius, r2=radius2, angle=(start, stop), wire=False)

        with self.assertRaises(Exception):
            zencad.ellipse(r1=radius2, r2=radius, wire=True)
Example #6
0
 def test_cylinder_probe(self):
     radius = 20
     height = 30
     yaw = zencad.deg(130)
     zencad.cylinder(r=radius, h=height, center=True)
     zencad.cylinder(r=radius, h=height, yaw=yaw, center=True)
     zencad.cylinder(r=radius, h=height, center=False)
     zencad.cylinder(r=radius, h=height, yaw=yaw, center=False)
Example #7
0
 def test_helix_probe(self):
     r = 20
     h = 20
     step = 2
     angle = zencad.deg(15)
     zencad.helix(r, h, step, left=True)
     zencad.helix(r, h, step, angle=angle, left=True)
     zencad.helix(r, h, step, left=False)
     zencad.helix(r, h, step, angle=angle, left=False)
Example #8
0
    def test_torus_probe(self):
        centralRadius = 20
        localRadius = 3
        yaw = zencad.deg(130)

        minPitch = zencad.deg(-10)
        maxPitch = zencad.deg(20)

        zencad.torus(r1=centralRadius, r2=localRadius)
        zencad.torus(r1=centralRadius, r2=localRadius, yaw=yaw)
        zencad.torus(r1=centralRadius,
                     r2=localRadius,
                     pitch=(minPitch, maxPitch))
        zencad.torus(r1=centralRadius,
                     r2=localRadius,
                     yaw=yaw,
                     pitch=(minPitch, maxPitch))
        zencad.torus(r1=centralRadius, r2=localRadius, yaw=yaw, pitch=maxPitch)
Example #9
0
    def test_cone_probe(self):
        topRadius = 20
        botRadius = 10
        height = 30
        yaw = zencad.deg(130)

        zencad.cone(r1=botRadius, r2=topRadius, h=height, center=True)
        zencad.cone(r1=botRadius, r2=topRadius, h=height, yaw=yaw, center=True)
        zencad.cone(r1=0, r2=topRadius, h=height, center=True)
        zencad.cone(r1=botRadius, r2=0, h=height, center=True)

        zencad.cone(r1=botRadius, r2=topRadius, h=height, center=False)
        zencad.cone(r1=botRadius,
                    r2=topRadius,
                    h=height,
                    yaw=yaw,
                    center=False)
        zencad.cone(r1=0, r2=topRadius, h=height, center=False)
        zencad.cone(r1=botRadius, r2=0, h=height, center=False)
Example #10
0
    def test_rotate(self):
        x = 10
        y = 20
        z = 30
        v = 10

        pnt = zencad.point(x, y, z)

        ang = zencad.deg(v)
        self.assertEqual(
            zencad.rotateX(ang)(pnt),
            zencad.point(x,
                         y * math.cos(ang) - z * math.sin(ang),
                         z * math.cos(ang) + y * math.sin(ang)))

        self.assertEqual(
            zencad.rotateY(ang)(pnt),
            zencad.point(x * math.cos(ang) + z * math.sin(ang), y,
                         z * math.cos(ang) - x * math.sin(ang)))

        self.assertEqual(
            zencad.rotateZ(ang)(pnt),
            zencad.point(x * math.cos(ang) - y * math.sin(ang),
                         y * math.cos(ang) + x * math.sin(ang), z))
Example #11
0
 def test_revol(self):
     zencad.revol(zencad.ngon(r=10, n=10).rotateX(zencad.deg(90)).right(30))
     zencad.revol(
         zencad.ngon(r=10, n=10).rotateX(zencad.deg(90)).right(30),
         yaw=zencad.deg(120),
     )
Example #12
0
 def test_halfspace_probe(self):
     (zencad.sphere(r=10) - zencad.halfspace().rotateX(zencad.deg(150)))
     (zencad.sphere(r=10) ^ zencad.halfspace().rotateX(zencad.deg(150)))