def test_Location(self): print( "test locations") la = bw.Location([[1, 0, 0, 4], [0, 1, 0, 8], [0, 0, 1, 12]]) lb = bw.Location([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) lc = bw.ComposedLocation([ (la, 2), (lb, 1) ]) ld = bw.ComposedLocation([ (lb, 2), (lc, 3) ]) with self.assertRaises(bw.ParamError): bw.Location([1,2,3]) with self.assertRaises(bw.ParamError): bw.Location([[1], [2], [3]]) with self.assertRaises(bw.ParamError): a = 1 b = 'a' lb = bw.Location([[a, b, a, b], [a, b, a, b], [a, b, a, b]])
def test_cube(self): shell = self._cube() #shell = self._permuted_cube() s1=bw.Solid([ shell ]) c1=bw.Compound([s1]) loc1=bw.Location([[0,0,1,0],[1,0,0,0],[0,1,0,0]]) loc2=bw.Location([[0,0,1,0],[1,0,0,0],[0,1,0,0]]) #dej tam tu druhou z prikladu cloc=bw.ComposedLocation([(loc1,1),(loc2,1)]) with open("_out_test_prism.brep", "w") as f: bw.write_model(f, c1, cloc) #bw.write_model(sys.stdout, c1, cloc) print(c1)
def make_brep_geometry(self): self.free_shapes = [shp_info for shp_info in self.all_shapes if shp_info.free] # sort down from solids to vertices self.free_shapes.sort(key=lambda shp: shp.dim(), reverse=True) free_shapes = [shp_info.shape for shp_info in self.free_shapes] compound = bw.Compound(free_shapes) compound.set_free_shapes() self.brep_file = os.path.abspath(self.basename + ".brep") with open(self.brep_file, 'w') as f: bw.write_model(f, compound, bw.Location()) self.make_gmsh_shape_dict()
def composed_location(): loc1=bw.Location([[0,0,1,0],[1,0,0,0],[0,1,0,0]]) loc2=bw.Location([[0,0,1,0],[1,0,0,0],[0,1,0,0]]) cloc=bw.ComposedLocation([(loc1,1),(loc2,1)]) return cloc