コード例 #1
0
    def test_to_scad(self):
        sphere = Sphere(2)
        cube = Cuboid(10, 10, 10)
        cylinder = Frustum(origin, Z, 11, 11)

        self.assertEqual(
            Difference([sphere, cube, cylinder]).to_scad(),
            ScadObject("difference", None, None, [
                sphere.to_scad(),
                cube.to_scad(),
                cylinder.to_scad(),
            ]))
コード例 #2
0
ファイル: test_union.py プロジェクト: deffi/cadlib
    def test_to_scad(self):
        sphere = Sphere(2)
        cube = Cuboid(10, 10, 10)
        cylinder = Frustum(origin, Z, 11, 11)

        self.assertEqual(
            Union([sphere, cube, cylinder]).to_scad(),
            ScadObject("union", None, None, [
                sphere.to_scad(),
                cube.to_scad(),
                cylinder.to_scad(),
            ]))

        # Empty
        self.assertEqual(
            Union([]).to_scad(), ScadObject("union", None, None, None))
コード例 #3
0
ファイル: test_csg.py プロジェクト: deffi/cadlib
    def test_to_scad(self):
        sphere = Sphere(2)
        cube = Cuboid(10, 10, 10)
        cylinder = Frustum(origin, Z, 5, 5)

        mixed = Union(
            [Intersection([sphere, cylinder]),
             Difference([cube, sphere])])
        self.assertEqual(
            mixed.to_scad(),
            ScadObject("union", None, None, [
                ScadObject(
                    "intersection", None, None,
                    [sphere.to_scad(), cylinder.to_scad()]),
                ScadObject("difference", None, None,
                           [cube.to_scad(), sphere.to_scad()]),
            ]))