示例#1
0
 def test_add_facets_updates_stats(self):
     '''Tests if adding new facets updates the mesh stats'''
     stl = Stl(asset('block.stl'))
     max_x = stl.stats['max']['x']
     bounding_diameter = stl.stats['bounding_diameter']
     stl.add_facets([(((0, 0, 0), (1, 1, 1), (max_x + 1, 0, 0)), (1, 0, 0))])
     assert max_x + 1 == stl.stats['max']['x']
     assert bounding_diameter < stl.stats['bounding_diameter']
示例#2
0
 def test_add_facets_updates_stats(self):
     '''Tests if adding new facets updates the mesh stats'''
     stl = Stl(asset('block.stl'))
     max_x = stl.stats['max']['x']
     bounding_diameter = stl.stats['bounding_diameter']
     stl.add_facets([(((0, 0, 0), (1, 1, 1), (max_x + 1, 0, 0)), (1, 0, 0))
                     ])
     assert max_x + 1 == stl.stats['max']['x']
     assert bounding_diameter < stl.stats['bounding_diameter']
示例#3
0
 def test_stats_are_same_with_created(self, type):
     ''''Test a manually constructed cube has the same stats as if loaded'''
     XYZ = ('x', 'y', 'z')
     stl1 = Stl(asset('block.stl'))
     if type == 'iterable':
         facets = [[[[v[a] for a in XYZ] for v in f['vertex']],
                    [f['normal'][a] for a in XYZ]] for f in stl1]
     else:
         facets = list(stl1)
     stl2 = Stl()
     stl2.add_facets(facets)
     stats1, stats2 = stl1.stats, stl2.stats
     for stats in (stats1, stats2):
         del stats['type']  # ASCII != INMEMORY
         del stats['original_num_facets']  # 12 != 0
         del stats['header']  # nothing != "solid  admesh"
     assert stats1 == stats2
示例#4
0
 def test_stats_are_same_with_created(self, type):
     ''''Test a manually constructed cube has the same stats as if loaded'''
     XYZ = ('x', 'y', 'z')
     stl1 = Stl(asset('block.stl'))
     if type == 'iterable':
         facets = [[[[v[a] for a in XYZ] for v in f['vertex']],
                    [f['normal'][a] for a in XYZ]] for f in stl1]
     else:
         facets = list(stl1)
     stl2 = Stl()
     stl2.add_facets(facets)
     stats1, stats2 = stl1.stats, stl2.stats
     for stats in (stats1, stats2):
         del stats['type']  # ASCII != INMEMORY
         del stats['original_num_facets']  # 12 != 0
         del stats['header']  # nothing != "solid  admesh"
     assert stats1 == stats2
示例#5
0
 def test_add_facets_increases_len(self):
     stl = Stl(asset('block.stl'))
     facet_count = len(stl)
     stl.add_facets([(((0, 0, 0), (1, 1, 1), (1, 0, 0)), (1, 0, 0))])
     assert len(stl) == facet_count + 1