Exemplo n.º 1
0
 def test_import_badformat(self):
     filename = 'test-files/bad_format.step'  # file exists, but is not a valid STEP file
     thing = Part.importer('step')(filename)
     # exception not raised before object is formed
     with self.assertRaises(ValueError):
         with suppress_stdout_stderr():
             thing.local_obj
Exemplo n.º 2
0
 def test_import_unicode(self):
     filename = u'test-files/cube.step'
     with suppress_stdout_stderr():
         cube = Part.importer('step')(filename)
         self.assertEqual(type(cube).__name__, 'cube_step')
         self.assertAlmostEqual(cube.bounding_box.xmin, -0.5)
         self.assertAlmostEqual(cube.bounding_box.xmax, 0.5)
Exemplo n.º 3
0
 def test_multipart_part(self):
     # When imported as a Part, geometry is unioned together
     filename = 'test-files/red_cube_blue_cylinder.step'
     with suppress_stdout_stderr():
         thing = Part.importer('step')(filename)
         # cylinder {5 < x < 15}, box {-10 < x < 0}
         # combined they should be {-10 < x < 15}
         self.assertAlmostEqual(thing.bounding_box.xmin, -10)
         self.assertAlmostEqual(thing.bounding_box.xmax, 15)
Exemplo n.º 4
0
 def test_import_nofile(self):
     filename = 'test-files/noexist.step'
     with self.assertRaises(ValueError):
         # exception raised before
         Part.importer('step')(filename)
Exemplo n.º 5
0
 def test_mangle_numberstart(self):
     filename = 'test-files/0123_noexist.step'
     part = Part.importer('step')(filename)
     self.assertEqual(type(part).__name__, '_0123_noexist_step')
Exemplo n.º 6
0
 def test_import(self):
     filename = 'test-files/cube.step'
     with suppress_stdout_stderr():
         cube = Part.importer('step')(filename)
         self.assertAlmostEqual(cube.bounding_box.xmin, -0.5)
         self.assertAlmostEqual(cube.bounding_box.xmax, 0.5)
Exemplo n.º 7
0
from cqparts import Part
Part.importer('step')('module.step').exporter('gltf')('module.gltf')