def test_stl_importer_happy_topology(): r"""import iges file containing a box and test topology""" # binary STL importer = StlImporter(path_from_file(__file__, "./models_in/box_binary.stl")) topo = Topo(importer.shape) # assert len(topo.solids()) == 1 assert len([i for i in topo.shells()]) == 1 assert topo.shells().next().Closed() is True # direct method on TopoDS_Shell assert len([i for i in topo.faces()]) == 108 assert len([i for i in topo.edges()]) == 162 # ascii STL importer = StlImporter(path_from_file(__file__, "./models_in/box_ascii.stl")) topo = Topo(importer.shape) # assert len(topo.solids) == 1 assert len([i for i in topo.shells()]) == 1 assert topo.shells().next().Closed() is True assert len([i for i in topo.faces()]) == 108 assert len([i for i in topo.edges()]) == 162
def test_stl_importer_2_boxes(): r"""Import an iges file containing 2 distinct boxes and test topology Notes ----- This shows the current limitations of the IgesImporter as 2 boxes cannot be distinguished from one another """ # binary STL importer = StlImporter(path_from_file(__file__, "./models_in/2_boxes_binary.stl")) topo = Topo(importer.shape) assert len([i for i in topo.shells()]) == 2 assert topo.shells().next().Closed() is True assert [i for i in topo.shells()][1].Closed() is True assert topo.number_of_faces() == 108 * 2 assert topo.number_of_edges() == 162 * 2 # ascii STL importer = StlImporter(path_from_file(__file__, "./models_in/2_boxes_ascii.stl")) topo = Topo(importer.shape) assert len([i for i in topo.shells()]) == 2 assert topo.shells().next().Closed() is True assert [i for i in topo.shells()][1].Closed() is True assert topo.number_of_faces() == 108 * 2 assert topo.number_of_edges() == 162 * 2