Пример #1
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")
Пример #2
0
    def test_sparse_json(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))
        stl = blockmodel.stl

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

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

        col = blockmodel.collada
        f = open(data_path("made/sparse_test.dae"), "w")
        f.write(col)
        f.close()


        csv = blockmodel.csv
        f = open(data_path("made/sparse_test.csv"), "w")
        f.write(csv)
        f.close()

        self.assertFileMatches("ref/sparse_test.csv", "made/sparse_test.csv")
Пример #3
0
    def test_sparse_json(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))
        stl = blockmodel.stl

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

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

        col = blockmodel.collada
        f = open(data_path("made/sparse_test.dae"), "w")
        f.write(col)
        f.close()

        csv = blockmodel.csv
        f = open(data_path("made/sparse_test.csv"), "w")
        f.write(csv)
        f.close()

        self.assertFileMatches("ref/sparse_test.csv", "made/sparse_test.csv")
Пример #4
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")