def get_points_from_edge(edge): texp1 = TopologyExplorer(edge) points = [] for v in texp1.vertices(): apt = BRep_Tool_Pnt(v) points.append((apt.X(), apt.Y(), apt.Z())) return points
def hash_edge_lenght_to_face(faces): """ for every edge in the list `faces` loop through the edges of the face associate (hash) the edge lenght to point to the face :note: this approach would blow less if you use a tuple ( length, edge-mid-point ) the TopoDS_Edge entitiy has a HashCode method that might be actually a proper idea :param faces: :return: dict hashing all edge lengths """ _edge_length_to_face = {} _edge_length_to_edge = {} for f in faces: tp = TopologyExplorer(f) for e in tp.edges(): length = round(length_from_edge(e), 3) _edge_length_to_face[length] = f _edge_length_to_edge[length] = e return _edge_length_to_face, _edge_length_to_edge
def prop_soild(self, sol=TopoDS_Solid()): self.sol_builder = TopoDS_Builder() sol_exp = TopExp_Explorer(sol, TopAbs_FACE) sol_top = TopologyExplorer(sol) #print(self.cal_vol(sol), self.base_vol) print(sol_top.number_of_faces()) self.face_lst = TopTools_ListOfShape() self.face_cnt = [] self.face_num = 0 self.face_init(sol_exp.Current()) #self.sol_builder.Add(sol, sol_exp.Current()) sol_exp.Next() while sol_exp.More(): face = sol_exp.Current() self.face_expand(face) sol_exp.Next() if self.file == True: stp_file = "./shp/shp_{:04d}.stp".format(self.sol_num) write_step_file(sol, stp_file) stp_file = "./shp/shp_{:04d}_exp.stp".format(self.sol_num) new_shpe = TopoDS_Compound() self.sol_builder.Add(gp_Pnt()) # self.sol_builder.MakeCompSolid(new_shpe) #write_step_file(new_shpe, stp_file) # if self.show == True: # self.display.DisplayShape(self.face_cnt) """self.face_init(face)
def cut_solid_parts(array): from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Section from OCC.Core.BRepFeat import BRepFeat_SplitShape from OCC.TopTools import TopTools_ListIteratorOfListOfShape from OCC.Extend.TopologyUtils import TopologyExplorer from OCC.Core.TopoDS import TopoDS_Face #array contains several parts for i, si in enumerate(array): #for ki in si.dico: shpi = si.solid split = BRepFeat_SplitShape(shpi) for j, sj in enumerate(array): if i != j: shpj = sj.solid sect = BRepAlgoAPI_Section(shpi, shpj, False) sect.ComputePCurveOn1(True) sect.Approximation(True) sect.SetFuzzyValue(1.e-12) sect.Build() shpsect = sect.Shape() for edg in TopologyExplorer(shpsect).edges(): face = TopoDS_Face() if sect.HasAncestorFaceOn1(edg, face): split.Add(edg, face) split.Build() lst = TopTools_ListIteratorOfListOfShape(split.Modified(shpi)) while lst.More(): for face in TopologyExplorer(lst.Value()).faces(): array[i].splitsolid.append(face) lst.Next()
def fillet(event=None): display.EraseAll() box = BRepPrimAPI_MakeBox(gp_Pnt(-400, 0, 0), 200, 230, 180).Shape() fillet = BRepFilletAPI_MakeFillet(box) # Add fillet on each edge for e in TopologyExplorer(box).edges(): fillet.Add(20, e) blended_box = fillet.Shape() p_1 = gp_Pnt(250, 150, 75) s_1 = BRepPrimAPI_MakeBox(300, 200, 200).Shape() s_2 = BRepPrimAPI_MakeBox(p_1, 120, 180, 70).Shape() fused_shape = BRepAlgoAPI_Fuse(s_1, s_2).Shape() fill = BRepFilletAPI_MakeFillet(fused_shape) for e in TopologyExplorer(fused_shape).edges(): fill.Add(e) for i in range(1, fill.NbContours() + 1): length = fill.Length(i) radius = 0.15 * length fill.SetRadius(radius, i, 1) blended_fused_solids = fill.Shape() display.DisplayShape(blended_box) display.DisplayShape(blended_fused_solids, update=True)
def test_read_iges_45_shapes(self): all_shapes = read_iges_file(IGES_45_FACES, return_as_shapes=True, verbosity=True) self.assertEqual(len(all_shapes), 1) topo_explorer = TopologyExplorer(all_shapes[0]) self.assertEqual(topo_explorer.number_of_faces(), 45)
def fillet(event=None): Box = BRepPrimAPI_MakeBox(gp_Pnt(-400, 0, 0), 200, 230, 180).Shape() fillet_ = BRepFilletAPI_MakeFillet(Box) # Add fillet on each edge for e in TopologyExplorer(Box).edges(): fillet_.Add(20, e) blendedBox = fillet_.Shape() P1 = gp_Pnt(250, 150, 75) S1 = BRepPrimAPI_MakeBox(300, 200, 200).Shape() S2 = BRepPrimAPI_MakeBox(P1, 120, 180, 70).Shape() Fuse = BRepAlgoAPI_Fuse(S1, S2) FusedShape = Fuse.Shape() fill = BRepFilletAPI_MakeFillet(FusedShape) for e in TopologyExplorer(FusedShape).edges(): fill.Add(e) for i in range(1, fill.NbContours() + 1): length = fill.Length(i) Rad = 0.15 * length fill.SetRadius(Rad, i, 1) blendedFusedSolids = fill.Shape() display.EraseAll() display.DisplayShape(blendedBox) display.DisplayShape(blendedFusedSolids) display.FitAll()
def is_edges_ok(edge1, fillet, edge2): t1 = TopologyExplorer(edge1).number_of_vertices() t2 = TopologyExplorer(fillet).number_of_vertices() t3 = TopologyExplorer(edge2).number_of_vertices() if t1 == 0 or t2 == 0 or t3 == 0: return False else: return True
def recognize_batch(event=None): """ Menu item : process all the faces of a single shape """ # then traverse the topology using the Topo class t = TopologyExplorer(shp) # loop over faces only for f in t.faces(): # call the recognition function recognize_face(f)
def get_edge_points(edge): from OCC.Core.BRep import BRep_Tool_Pnt from OCC.Extend.TopologyUtils import TopologyExplorer t = TopologyExplorer(edge) points = [] for v in t.vertices(): apt = BRep_Tool_Pnt(v) points.append((apt.X(), apt.Y(), apt.Z())) return points
def import_as_multiple_shapes(event=None): compound = read_step_file( os.path.join('..', 'assets', 'models', 'as1_pe_203.stp')) t = TopologyExplorer(compound) display.EraseAll() for solid in t.solids(): color = Quantity_Color(random.random(), random.random(), random.random(), Quantity_TOC_RGB) display.DisplayColoredShape(solid, color) display.FitAll()
def import_into_gmsh_use_nativepointer(obj, geom_repr: str, model: gmsh.model) -> List[tuple]: from OCC.Extend.TopologyUtils import TopologyExplorer from ada import PrimBox ents = [] if geom_repr == ElemType.SOLID: geom = obj.solid t = TopologyExplorer(geom) geom_iter = t.solids() elif geom_repr == ElemType.SHELL: geom = obj.shell if type(obj) not in (PrimBox, ) else obj.geom t = TopologyExplorer(geom) geom_iter = t.faces() else: geom = obj.line t = TopologyExplorer(geom) geom_iter = t.edges() for shp in geom_iter: ents += model.occ.importShapesNativePointer(int(shp.this)) if len(ents) == 0: raise ValueError("No entities found") return ents
def test_edge_to_bezier(self): b = BRepPrimAPI_MakeTorus(30, 10).Shape() t = TopologyExplorer(b) for ed in t.edges(): is_bezier, bezier_curve, degree = edge_to_bezier(ed) self.assertTrue(isinstance(is_bezier, bool)) if not is_bezier: self.assertTrue(degree is None) self.assertTrue(bezier_curve is None) else: self.assertTrue(isinstance(degree, int))
def executeOnFile(file): global files_processed print('\n>> file', file_counter) compound = read_step_file(file, verbosity=False) # always 3 unknown entities ex = TopologyExplorer(compound) for face in ex.faces(): type_counter[BRepAdaptor_Surface(face).GetType()] += 1 if BRepAdaptor_Surface(face).GetType() == FILTER_TYPE: os.makedirs(OUTPUT_DIR, exist_ok=True) #TODO write model face to new file files_processed += 1
def parse_shape(self): assert self.shape_type is "Compound" self.config['shape'] = self.shape_type self.config['data'] = [] s_id = 1 t = TopologyExplorer(self.shape) for subshape in t.solids(): print(s_id) solid = Solid(subshape, "Solid", s_id) solid.parse_shape() self.config['data'].append(solid.config) s_id = s_id + 1
def move_to_box(iname, cname, wname, visualize=False): """Move foam to periodic box. Works on BREP files. Information about physical volumes is lost. Args: iname (str): input filename cname (str): output filename with cells wname (str): output filename with walls visualize (bool): show picture of foam morphology in box if True """ cells = TopoDS_Shape() builder = BRep_Builder() breptools_Read(cells, iname, builder) texp = TopologyExplorer(cells) solids = list(texp.solids()) cells = TopoDS_Compound() builder.MakeCompound(cells) box = BRepPrimAPI_MakeBox(gp_Pnt(1, -1, -1), 3, 3, 3).Shape() vec = gp_Vec(-1, 0, 0) solids = slice_and_move(solids, box, vec) box = BRepPrimAPI_MakeBox(gp_Pnt(-3, -1, -1), 3, 3, 3).Shape() vec = gp_Vec(1, 0, 0) solids = slice_and_move(solids, box, vec) box = BRepPrimAPI_MakeBox(gp_Pnt(-1, 1, -1), 3, 3, 3).Shape() vec = gp_Vec(0, -1, 0) solids = slice_and_move(solids, box, vec) box = BRepPrimAPI_MakeBox(gp_Pnt(-1, -3, -1), 3, 3, 3).Shape() vec = gp_Vec(0, 1, 0) solids = slice_and_move(solids, box, vec) box = BRepPrimAPI_MakeBox(gp_Pnt(-1, -1, 1), 3, 3, 3).Shape() vec = gp_Vec(0, 0, -1) solids = slice_and_move(solids, box, vec) box = BRepPrimAPI_MakeBox(gp_Pnt(-1, -1, -3), 3, 3, 3).Shape() vec = gp_Vec(0, 0, 1) solids = slice_and_move(solids, box, vec) create_compound(solids, cells, builder) breptools_Write(cells, cname) if visualize: display, start_display, _, _ = init_display() display.DisplayShape(cells, update=True) start_display() box = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 1, 1, 1).Shape() walls = BRepAlgoAPI_Cut(box, cells).Shape() breptools_Write(walls, wname) if visualize: display, start_display, _, _ = init_display() display.DisplayShape(walls, update=True) start_display()
def shape_faces_surface(): """ Compute the surface of each face of a shape """ # first create the shape the_shape = BRepPrimAPI_MakeBox(50., 30., 10.).Shape() # then loop over faces t = TopologyExplorer(the_shape) props = GProp_GProps() shp_idx = 1 for face in t.faces(): brepgprop_SurfaceProperties(face, props) face_surf = props.Mass() print("Surface for face nbr %i : %f" % (shp_idx, face_surf)) shp_idx += 1
def thick_solid(event=None): S = BRepPrimAPI_MakeBox(150, 200, 110).Shape() topo = TopologyExplorer(S) vert = next(topo.vertices()) shapes = TopTools_ListOfShape() for f in topo.faces_from_vertex(vert): shapes.Append(f) _thick_solid = BRepOffsetAPI_MakeThickSolid(S, shapes, 15, 0.01) display.EraseAll() display.DisplayShape(_thick_solid.Shape()) display.FitAll()
def OpenCascadeMeshHierarchy(stepfile, element_size, levels, comm=COMM_WORLD, distribution_parameters=None, callbacks=None, order=1, mh_constructor=MeshHierarchy, cache=True, verbose=True, gmsh="gmsh", project_refinements_to_cad=True, reorder=None): # OpenCascade doesn't give a nice error message if stepfile # doesn't exist, it segfaults ... try: from OCC.Core.STEPControl import STEPControl_Reader from OCC.Extend.TopologyUtils import TopologyExplorer except ImportError: raise ImportError("To use OpenCascadeMeshHierarchy, you must install firedrake with the OpenCascade python bindings (firedrake-update --opencascade).") if not os.path.isfile(stepfile): raise OSError("%s does not exist" % stepfile) step_reader = STEPControl_Reader() step_reader.ReadFile(stepfile) step_reader.TransferRoot() shape = step_reader.Shape() cad = TopologyExplorer(shape) dim = 3 if cad.number_of_solids() > 0 else 2 coarse = make_coarse_mesh(stepfile, cad, element_size, dim, comm=comm, distribution_parameters=distribution_parameters, cache=cache, verbose=verbose, gmsh=gmsh) mh = mh_constructor(coarse, levels, distribution_parameters=distribution_parameters, callbacks=callbacks, reorder=reorder) project_to_cad = project_mesh_to_cad_2d if dim == 2 else project_mesh_to_cad_3d if project_refinements_to_cad: for mesh in mh: project_to_cad(mesh, cad) mh.nested = False if order > 1: VFS = VectorFunctionSpace Ts = [ Function(VFS(mesh, "CG", order)).interpolate(mesh.coordinates) for mesh in mh] ho_meshes = [Mesh(T) for T in Ts] mh = HierarchyBase( ho_meshes, mh.coarse_to_fine_cells, mh.fine_to_coarse_cells, refinements_per_level=mh.refinements_per_level, nested=mh.nested ) if project_refinements_to_cad: for mesh in mh: project_to_cad(mesh, cad) else: project_to_cad(mh[0], cad) for i in range(1, len(mh)): prolong(Ts[i-1], Ts[i]) return mh
def _get_sorted_hlr_edges(self, topods_shape, ax=gp_Ax2(), export_hidden_edges=True, use_smooth_edges=False, use_sewn_edges=False): """ Return hidden and visible edges as two lists of edges """ hlr = HLRBRep_Algo() hlr.Add(topods_shape) projector = HLRAlgo_Projector(ax) hlr.Projector(projector) hlr.Update() hlr.Hide() hlr_shapes = HLRBRep_HLRToShape(hlr) # visible edges visible = [] visible_sharp_edges_as_compound = hlr_shapes.VCompound() if visible_sharp_edges_as_compound: visible += list(TopologyExplorer(visible_sharp_edges_as_compound).edges()) visible_smooth_edges_as_compound = hlr_shapes.Rg1LineVCompound() if visible_smooth_edges_as_compound and use_smooth_edges: visible += list(TopologyExplorer(visible_smooth_edges_as_compound).edges()) visible_sewn_edges_as_compound = hlr_shapes.RgNLineVCompound() if visible_sewn_edges_as_compound and use_sewn_edges: visible += list(TopologyExplorer(visible_sewn_edges_as_compound).edges()) visible_contour_edges_as_compound = hlr_shapes.OutLineVCompound() if visible_contour_edges_as_compound: visible += list(TopologyExplorer(visible_contour_edges_as_compound).edges()) #visible_isoparameter_edges_as_compound = hlr_shapes.IsoLineVCompound() #if visible_isoparameter_edges_as_compound: # visible += list(TopologyExplorer(visible_isoparameter_edges_as_compound).edges()) # hidden edges hidden = [] if export_hidden_edges: hidden_sharp_edges_as_compound = hlr_shapes.HCompound() if hidden_sharp_edges_as_compound: hidden += list(TopologyExplorer(hidden_sharp_edges_as_compound).edges()) hidden_smooth_edges_as_compound = hlr_shapes.Rg1LineHCompound() if hidden_smooth_edges_as_compound and use_smooth_edges: hidden += list(TopologyExplorer(hidden_smooth_edges_as_compound).edges()) hidden_sewn_edges_as_compound = hlr_shapes.RgNLineHCompound() if hidden_sewn_edges_as_compound and use_sewn_edges: hidden += list(TopologyExplorer(hidden_sewn_edges_as_compound).edges()) hidden_contour_edges_as_compound = hlr_shapes.OutLineHCompound() if hidden_contour_edges_as_compound: hidden += list(TopologyExplorer(hidden_contour_edges_as_compound).edges()) return visible, hidden
def prop_soild(self, sol=TopoDS_Solid()): sol_exp = TopExp_Explorer(sol, TopAbs_FACE) sol_top = TopologyExplorer(sol) print() print(sol, self.cal_vol(sol)) print(sol_top.number_of_faces()) self.face_init(sol_exp.Current()) sol_exp.Next() while sol_exp.More(): face = sol_exp.Current() self.face_expand(face) sol_exp.Next() self.tmp_face_n += 1 """self.face_init(face)
def Bulk_stptoimag(self): pass self.file_list = os.listdir(self.chose_document) print(self.file_list) for file in self.file_list: self.canva._display.EraseAll() self.canva._display.hide_triedron() self.canva._display.display_triedron() if "stp" in file or "step" in file or "iges" in file: try: if file == "iseg": continue else: read_path = os.path.join(self.chose_document, file) the_shape = read_step_file(read_path) name = file.split(".") ais_shape = AIS_ColoredShape(the_shape) for e in TopologyExplorer(the_shape).solids(): rnd_color = (random(), random(), random()) ais_shape.SetCustomColor(e, rgb_color(0.5, 0.5, 0.5)) self.canva._display.Context.Display(ais_shape, True) self.canva._display.FitAll() path = self.chose_document + "\\" + name[0] + ".bmp" self.canva._display.ExportToImage(path) except: pass self.statusbar.showMessage("状态:表格生成成功")
def ngon_to_face(points: NGon) -> TopoDS_Face: """Convert a Ngon to a BRep face with an underlying best-fit surface. Parameters ---------- points : sequence[point] Points defining a polygon. Returns ------- TopoDS_Face """ points = [gp_Pnt(*point) for point in points] poly = BRepBuilderAPI_MakePolygon() for point in points: poly.Add(point) poly.Build() poly.Close() edges = TopologyExplorer(poly.Wire()).edges() nsided = BRepFill_Filling() for edge in edges: nsided.Add(edge, GeomAbs_C0) nsided.Build() return nsided.Face()
def read_step_file(filename, return_as_shapes=False, verbosity=False): """ read the STEP file and returns a compound filename: the file path return_as_shapes: optional, False by default. If True returns a list of shapes, else returns a single compound verbosity: optionl, False by default. """ if not os.path.isfile(filename): raise FileNotFoundError("%s not found." % filename) step_reader = STEPControl_Reader() status = step_reader.ReadFile(filename) if status == IFSelect_RetDone: # check status if verbosity: failsonly = False step_reader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity) step_reader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity) transfer_result = step_reader.TransferRoot(1) assert transfer_result _nbs = step_reader.NbShapes() assert _nbs == 1 shape_to_return = step_reader.Shape(1) # a compound assert not shape_to_return.IsNull() else: raise AssertionError("Error: can't read file.") if return_as_shapes: shape_to_return = TopologyExplorer(shape_to_return).solids() return shape_to_return
def test_topabs_orientation_byref(self): # see Issue https://github.com/tpaviot/pythonocc-core/issues/1038 box = BRepPrimAPI_MakeBox(10, 20, 30).Shape() box_face = list(TopologyExplorer(box).faces())[0] facetopo = BRepClass_FaceExplorer(box_face) facetopo.InitWires() # get ready to explore wires/loops of this face edge_1 = BRepClass_Edge() edge_2 = BRepClass_Edge() edge_3 = BRepClass_Edge() edge_4 = BRepClass_Edge() facetopo.InitEdges() topabs_ori_1 = facetopo.CurrentEdge(edge_1) facetopo.NextEdge() topabs_ori_2 = facetopo.CurrentEdge(edge_2) facetopo.NextEdge() topabs_ori_3 = facetopo.CurrentEdge(edge_3) facetopo.NextEdge() topabs_ori_4 = facetopo.CurrentEdge(edge_4) self.assertEqual(topabs_ori_1, TopAbs_Orientation.TopAbs_REVERSED) self.assertEqual(topabs_ori_2, TopAbs_Orientation.TopAbs_REVERSED) self.assertEqual(topabs_ori_3, TopAbs_Orientation.TopAbs_FORWARD) self.assertEqual(topabs_ori_4, TopAbs_Orientation.TopAbs_FORWARD)
def recognize_batch(shp, event=None): """ Menu item : process all the faces of a single shape """ # loop over faces only for face in TopologyExplorer(shp).faces(): # call the recognition function recognize_face(face)
def variable_filleting(event=None): a_pnt = gp_Pnt(350, 0, 0) box_2 = BRepPrimAPI_MakeBox(a_pnt, 200, 200, 200).Shape() a_fillet = BRepFilletAPI_MakeFillet(box_2) tab_point = TColgp_Array1OfPnt2d(1, 6) p_1 = gp_Pnt2d(0., 8.) p_2 = gp_Pnt2d(0.2, 16.) p_3 = gp_Pnt2d(0.4, 25.) p_4 = gp_Pnt2d(0.6, 55.) p_5 = gp_Pnt2d(0.8, 28.) p_6 = gp_Pnt2d(1., 20.) tab_point.SetValue(1, p_1) tab_point.SetValue(2, p_2) tab_point.SetValue(3, p_3) tab_point.SetValue(4, p_4) tab_point.SetValue(5, p_5) tab_point.SetValue(6, p_6) expl3 = list(TopologyExplorer(box_2).edges()) a_fillet.Add(tab_point, expl3[9]) a_fillet.Build() if a_fillet.IsDone(): law_evolved_box = a_fillet.Shape() display.DisplayShape(law_evolved_box) else: print("aFillet not done.") display.FitAll()
def brep_feat_local_revolution(event=None): S = BRepPrimAPI_MakeBox(400., 250., 300.).Shape() faces = list(TopologyExplorer(S).faces()) F1 = faces[2] surf = BRep_Tool_Surface(F1) D = gp_OX() MW1 = BRepBuilderAPI_MakeWire() p1 = gp_Pnt2d(100., 100.) p2 = gp_Pnt2d(200., 100.) aline = GCE2d_MakeLine(p1, p2).Value() MW1.Add(BRepBuilderAPI_MakeEdge(aline, surf, 0., p1.Distance(p2)).Edge()) p1 = gp_Pnt2d(200., 100.) p2 = gp_Pnt2d(150., 200.) aline = GCE2d_MakeLine(p1, p2).Value() MW1.Add(BRepBuilderAPI_MakeEdge(aline, surf, 0., p1.Distance(p2)).Edge()) p1 = gp_Pnt2d(150., 200.) p2 = gp_Pnt2d(100., 100.) aline = GCE2d_MakeLine(p1, p2).Value() MW1.Add(BRepBuilderAPI_MakeEdge(aline, surf, 0., p1.Distance(p2)).Edge()) MKF1 = BRepBuilderAPI_MakeFace() MKF1.Init(surf, False, 1e-6) MKF1.Add(MW1.Wire()) FP = MKF1.Face() breplib_BuildCurves3d(FP) MKrev = BRepFeat_MakeRevol(S, FP, F1, D, 1, True) F2 = faces[4] MKrev.Perform(F2) display.EraseAll() display.DisplayShape(MKrev.Shape()) display.FitAll()
def test_x3d_edge(self): """Test: threejs 10 random boxes""" my_x3dom_renderer = x3dom_renderer.X3DomRenderer() for edg in TopologyExplorer(torus_shp).edges(): dict_shape, dict_edge = my_x3dom_renderer.DisplayShape( edg, mesh_quality=1.0) self.assertTrue(not dict_shape) self.assertTrue(dict_edge)
def test_edges_out_of_scope(self): # check pointers going out of scope face = next(topo.faces()) _edges = [] for edg in TopologyExplorer(face).edges(): _edges.append(edg) for edg in _edges: self.assertFalse(edg.IsNull())
t2 = time.monotonic() t_multi.Compute(parallel=True, mesh_quality=0.5) t3 = time.monotonic() delta_multi = t3 - t2 print("Test 1 Results:") print(" * single thread runtime: %.2fs" % delta_single) print(" * multi thread runtime: %.2fs" % delta_multi) print(" * muti/single=%.2f%%" % (delta_multi / delta_single * 100)) # TEST 2 : other step, with a loop over each subshape print("TEST 2 ===") shp3 = read_step_file(step_file) shp4 = read_step_file(step_file) topo1 = TopologyExplorer(shp3) t4 = time.monotonic() for solid in topo1.solids(): o = Tesselator(solid) o.Compute(parallel=False, mesh_quality=0.5) t5 = time.monotonic() delta_single = t5-t4 topo2 = TopologyExplorer(shp4) t6 = time.monotonic() for solid in topo2.solids(): o = Tesselator(solid) o.Compute(parallel=True, mesh_quality=0.5) t7 = time.monotonic() delta_multi = t7 - t6
def test_discretize_wire(self): tor = BRepPrimAPI_MakeTorus(50, 20).Shape() topo = TopologyExplorer(tor) for wire in topo.wires(): pnts = discretize_wire(wire) self.assertTrue(pnts)