Пример #1
0
    def test_schematic_steps(self):

        blockmodel = BlockModel.from_schematic_file(data_path("ref/cup2.schematic"))
        obj = blockmodel.obj
        f = open(data_path("made/cup2.obj"), "w")
        f.write(obj)
        f.close()

        self.assertFileMatches("ref/cup2.obj", "made/cup2.obj")

        x3d = blockmodel.x3d

        f = open(data_path("made/cup2.x3d"), "w")
        f.write(x3d)
        f.close()

        stl = blockmodel.stl

        f = open(data_path("made/cup2.stl"), "wb")
        f.write(stl)
        f.close()

        self.assertFileMatches("ref/cup2.stl", "made/cup2.stl")

        col = blockmodel.collada

        f = open(data_path("made/cup2.dae"), "w")
        f.write(col)
        f.close()
Пример #2
0
    def test_schematic_steps(self):

        blockmodel = BlockModel.from_schematic_file(
            data_path("ref/cup2.schematic"))
        obj = blockmodel.obj
        f = open(data_path("made/cup2.obj"), "w")
        f.write(obj)
        f.close()

        self.assertFileMatches("ref/cup2.obj", "made/cup2.obj")

        x3d = blockmodel.x3d

        f = open(data_path("made/cup2.x3d"), "w")
        f.write(x3d)
        f.close()

        stl = blockmodel.stl

        f = open(data_path("made/cup2.stl"), "wb")
        f.write(stl)
        f.close()

        self.assertFileMatches("ref/cup2.stl", "made/cup2.stl")

        col = blockmodel.collada

        f = open(data_path("made/cup2.dae"), "w")
        f.write(col)
        f.close()
Пример #3
0
    def test_sparse_json_to_schematic(self):

        as_list = [[7, 4, 2, 2, 0],
                    [8, 4, 2, 2, 0],
                    [9, 4, 2, 2, 0],
                    [9, 4, 3, 2, 0],
                    [9, 4, 4, 2, 0],
                    [8, 4, 4, 2, 0],
                    [7, 4, 4, 2, 0],
                    [7, 4, 3, 2, 0]]


        blockmodel = BlockModel.from_sparse_json(json.dumps(as_list))
        schematic = blockmodel.schematic

        f = open(data_path("made/sparse_2_schematic_test.schematic"), "wb")
        f.write(schematic)
        f.close()

        blockmodel = BlockModel.from_schematic_file(data_path("made/sparse_2_schematic_test.schematic"))

        obj = blockmodel.obj
        f = open(data_path("made/sparse_obj.obj"), "w")
        f.write(obj)
        f.close()

        self.assertFileMatches("ref/sparse_obj.obj", "made/sparse_obj.obj")
Пример #4
0
    def test_schematic_2(self):

        blockmodel = BlockModel.from_schematic_file(data_path("ref/new5.schematic"))

        x3d = blockmodel.x3d

        f = open(data_path("made/bum.x3d"), "w")
        f.write(x3d)
        f.close()
Пример #5
0
    def test_schematic_2(self):

        blockmodel = BlockModel.from_schematic_file(
            data_path("ref/new5.schematic"))

        x3d = blockmodel.x3d

        f = open(data_path("made/bum.x3d"), "w")
        f.write(x3d)
        f.close()
Пример #6
0
    def test_png_to_schematic(self):

        f = open(data_path("ref/block.png"), "rb")
        as_png = f.read()
        f.close()

        blockmodel = BlockModel.from_png(as_png)

        schematic = blockmodel.schematic

        f = open(data_path("made/png_2_schematic_test.schematic"), "wb")
        f.write(schematic)
        f.close()

        blockmodel = BlockModel.from_schematic_file(data_path("made/png_2_schematic_test.schematic"))

        obj = blockmodel.obj
        f = open(data_path("made/png_2_obj.obj"), "w")
        f.write(obj)
        f.close()

        self.assertFileMatches("ref/png_2_obj.obj", "made/png_2_obj.obj")
Пример #7
0
    def test_sparse_json_to_schematic(self):

        as_list = [[7, 4, 2, 2, 0], [8, 4, 2, 2, 0], [9, 4, 2, 2, 0],
                   [9, 4, 3, 2, 0], [9, 4, 4, 2, 0], [8, 4, 4, 2, 0],
                   [7, 4, 4, 2, 0], [7, 4, 3, 2, 0]]

        blockmodel = BlockModel.from_sparse_json(json.dumps(as_list))
        schematic = blockmodel.schematic

        f = open(data_path("made/sparse_2_schematic_test.schematic"), "wb")
        f.write(schematic)
        f.close()

        blockmodel = BlockModel.from_schematic_file(
            data_path("made/sparse_2_schematic_test.schematic"))

        obj = blockmodel.obj
        f = open(data_path("made/sparse_obj.obj"), "w")
        f.write(obj)
        f.close()

        self.assertFileMatches("ref/sparse_obj.obj", "made/sparse_obj.obj")
Пример #8
0
    def test_png_to_schematic(self):

        f = open(data_path("ref/block.png"), "rb")
        as_png = f.read()
        f.close()

        blockmodel = BlockModel.from_png(as_png)

        schematic = blockmodel.schematic

        f = open(data_path("made/png_2_schematic_test.schematic"), "wb")
        f.write(schematic)
        f.close()

        blockmodel = BlockModel.from_schematic_file(
            data_path("made/png_2_schematic_test.schematic"))

        obj = blockmodel.obj
        f = open(data_path("made/png_2_obj.obj"), "w")
        f.write(obj)
        f.close()

        self.assertFileMatches("ref/png_2_obj.obj", "made/png_2_obj.obj")
Пример #9
0
 def test_save_csv(self):
     model = BlockModel.from_schematic_file(data_path("ref/cup2.schematic"))
     made_file_path = data_path("made/test.csv")
     model.save_as_csv(made_file_path)
     self.assertTrue(os.path.exists(data_path("made/test.csv")))
Пример #10
0
 def test_save_stl(self):
     model = BlockModel.from_schematic_file(data_path("ref/cup2.schematic"))
     made_file_path = data_path("made/test.stl")
     model.save_as_stl(made_file_path)
     self.assertFileMatches("ref/cup2.stl", "made/test.stl")
Пример #11
0
 def test_save_csv(self):
     model = BlockModel.from_schematic_file(data_path("ref/cup2.schematic"))
     made_file_path = data_path("made/test.csv")
     model.save_as_csv(made_file_path)
     self.assertTrue(os.path.exists(data_path("made/test.csv")))
Пример #12
0
 def test_save_stl(self):
     model = BlockModel.from_schematic_file(data_path("ref/cup2.schematic"))
     made_file_path = data_path("made/test.stl")
     model.save_as_stl(made_file_path)
     self.assertFileMatches("ref/cup2.stl", "made/test.stl")