45 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
46 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
47 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
49 bool fusionner_entite_similaire,
52 STEPControl_Reader step_control_reader;
53 if(step_control_reader.ReadFile(file)!=IFSelect_RetDone)
55 std::cout <<
"*** OCC_FONCTION_V2017 : Erreur lecture fichier STEP ! ***" << std::endl;
58 step_control_reader.TransferRoots();
59 int nb_shape= step_control_reader.NbShapes();
60 for(
int i=1;i<nb_shape+1;i++)
62 TopoDS_Shape topods_shape = step_control_reader.Shape(i);
64 map_nouveau_mg_element_topologique,
65 map_nouveau_mg_element_cotopologique,
66 map_nouveau_mg_element_geometrique,
68 fusionner_entite_similaire,
82 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
83 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
84 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
86 bool fusionner_entite_similaire,
89 TopoDS_Shape topods_shape;
90 BRep_Builder brep_builder;
91 if(!BRepTools::Read(topods_shape,file,brep_builder))
93 std::cout <<
"*** OCC_FONCTION_V2017 : Erreur lecture fichier BREP ! ***" << std::endl;
97 map_nouveau_mg_element_topologique,
98 map_nouveau_mg_element_cotopologique,
99 map_nouveau_mg_element_geometrique,
101 fusionner_entite_similaire,
109 BRep_Builder brep_builder;
110 TopoDS_Compound Compound;
111 brep_builder.MakeCompound(Compound);
112 LISTE_MG_VOLUME::iterator it_volume;
118 LISTE_MG_COQUILLE::iterator it_coquille;
124 LISTE_MG_FACE::iterator it_face;
130 LISTE_MG_BOUCLE::iterator it_boucle;
136 LISTE_MG_ARETE::iterator it_arete;
142 LISTE_MG_SOMMET::iterator it_sommet;
148 BRepTools::Write(Compound,file);
156 Handle(TDocStd_Application) tdocstd_application =
new TDocStd_Application ();
157 Handle(TDocStd_Document) tdocstd_document;
158 tdocstd_application->NewDocument(
"NewDocumentFormat", tdocstd_document);
159 Handle(XmlXCAFDrivers_DocumentRetrievalDriver) retrivaldriver =
new XmlXCAFDrivers_DocumentRetrievalDriver;
160 Handle(XmlXCAFDrivers_DocumentStorageDriver) storagedriver =
new XmlXCAFDrivers_DocumentStorageDriver(
"");
161 tdocstd_application->DefineFormat(
"NewDocumentFormat",
"New format for OCAF documents",
"ocaf",retrivaldriver,storagedriver);
162 XCAFDoc_DocumentTool doctool;
163 Handle (XCAFDoc_ShapeTool) shapetool = doctool.ShapeTool(tdocstd_document->Main());
165 std::map<long,MG_IDENTIFICATEUR*> map_element_traite;
167 LISTE_MG_VOLUME::iterator it_volume;
173 LISTE_MG_COQUILLE::iterator it_coquille;
179 LISTE_MG_FACE::iterator it_face;
185 LISTE_MG_BOUCLE::iterator it_boucle;
191 LISTE_MG_ARETE::iterator it_arete;
197 LISTE_MG_SOMMET::iterator it_sommet;
203 TCollection_ExtendedString messagestatus;
204 tdocstd_application->SaveAs(tdocstd_document,file,messagestatus);
205 tdocstd_application->Close(tdocstd_document);
211 std::string str_file = file;
212 str_file.erase(str_file.end()-5,str_file.end());
213 Handle(TDocStd_Application) tdocstd_application =
new TDocStd_Application ();
214 Handle(TDocStd_Document) tdocstd_document;
215 Handle(XmlXCAFDrivers_DocumentRetrievalDriver) retrivaldriver =
new XmlXCAFDrivers_DocumentRetrievalDriver;
216 Handle(XmlXCAFDrivers_DocumentStorageDriver) storagedriver =
new XmlXCAFDrivers_DocumentStorageDriver(
"");
217 tdocstd_application->DefineFormat(
"NewDocumentFormat",
"New format for OCAF documents",
"ocaf",retrivaldriver,storagedriver);
218 PCDM_ReaderStatus read_status = tdocstd_application->Open((
char*)str_file.c_str(),tdocstd_document);
219 if(read_status!=PCDM_RS_OK)
221 std::cout <<
"*** OCC_FONCTION_V2017 : Erreur ouverture fichier OCAF ! ***" << std::endl;
224 XCAFDoc_DocumentTool doctool;
225 Handle (XCAFDoc_ShapeTool) shapetool = doctool.ShapeTool(tdocstd_document->Main());
226 TDF_LabelSequence lst_label_top_shape;
227 shapetool->GetShapes(lst_label_top_shape);
228 TDF_LabelSequence::Iterator it(lst_label_top_shape);
229 for(;it.More();it.Next())
231 TopoDS_Shape topods_shape = shapetool->GetShape(it.Value());
232 if(topods_shape.IsNull())
234 std::cout <<
"*** OCC_FONCTION_V2017 : Erreur lecture fichier OCAF ! ***" << std::endl;
237 TopTools_IndexedMapOfShape map_TopoDS_Solid;
238 TopExp::MapShapes(topods_shape,TopAbs_SOLID, map_TopoDS_Solid);
239 if(map_TopoDS_Solid.Extent()>1);
240 for(
int i=1;i<map_TopoDS_Solid.Extent()+1;i++)
242 TopoDS_Solid topods_solid = TopoDS::Solid(map_TopoDS_Solid.FindKey(i));
243 TDF_Label label_topods_solid = shapetool->FindShape(topods_solid);
244 if(!label_topods_solid.IsNull())
246 Handle(TDataStd_Name) nom =
new TDataStd_Name;
247 label_topods_solid.FindAttribute(TDataStd_Name::GetID(),nom);
248 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
249 label_topods_solid.FindAttribute(TDataStd_AsciiString::GetID(),num_string);
253 TopTools_IndexedMapOfShape map_TopoDS_Shell;
254 TopExp::MapShapes(topods_shape,TopAbs_SHELL, map_TopoDS_Shell);
255 for(
int i=1;i<map_TopoDS_Shell.Extent()+1;i++)
257 TopoDS_Shell topods_shell = TopoDS::Shell(map_TopoDS_Shell.FindKey(i));
258 TDF_Label label_topods_shell = shapetool->FindShape(topods_shell);
259 if(!label_topods_shell.IsNull())
261 Handle(TDataStd_Name) nom =
new TDataStd_Name;
262 label_topods_shell.FindAttribute(TDataStd_Name::GetID(),nom);
263 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
264 label_topods_shell.FindAttribute(TDataStd_AsciiString::GetID(),num_string);
268 TopTools_IndexedMapOfShape map_TopoDS_Face;
269 TopExp::MapShapes(topods_shape,TopAbs_FACE, map_TopoDS_Face);
270 for(
int i=1;i<map_TopoDS_Face.Extent()+1;i++)
272 TopoDS_Face topods_face = TopoDS::Face(map_TopoDS_Face.FindKey(i));
273 TDF_Label label_topods_face = shapetool->FindShape(topods_face);
274 if(!label_topods_face.IsNull())
276 Handle(TDataStd_Name) nom =
new TDataStd_Name;
277 label_topods_face.FindAttribute(TDataStd_Name::GetID(),nom);
278 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
279 label_topods_face.FindAttribute(TDataStd_AsciiString::GetID(),num_string);
283 TopTools_IndexedMapOfShape map_TopoDS_Wire;
284 TopExp::MapShapes(topods_shape,TopAbs_WIRE, map_TopoDS_Wire);
285 for(
int i=1;i<map_TopoDS_Wire.Extent()+1;i++)
287 TopoDS_Wire topods_wire = TopoDS::Wire(map_TopoDS_Wire.FindKey(i));
288 TDF_Label label_topods_wire = shapetool->FindShape(topods_wire);
289 if(!label_topods_wire.IsNull())
291 Handle(TDataStd_Name) nom =
new TDataStd_Name;
292 label_topods_wire.FindAttribute(TDataStd_Name::GetID(),nom);
293 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
294 label_topods_wire.FindAttribute(TDataStd_AsciiString::GetID(),num_string);
298 TopTools_IndexedMapOfShape map_TopoDS_Edge;
299 TopExp::MapShapes(topods_shape,TopAbs_EDGE, map_TopoDS_Edge);
300 for(
int i=1;i<map_TopoDS_Edge.Extent()+1;i++)
302 TopoDS_Edge topods_edge = TopoDS::Edge(map_TopoDS_Edge.FindKey(i));
303 TDF_Label label_topods_edge = shapetool->FindShape(topods_edge);
304 if(!label_topods_edge.IsNull())
306 Handle(TDataStd_Name) nom =
new TDataStd_Name;
307 label_topods_edge.FindAttribute(TDataStd_Name::GetID(),nom);
308 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
309 label_topods_edge.FindAttribute(TDataStd_AsciiString::GetID(),num_string);
310 if(nom->Get()!=
"Arete_degenere")
314 TopTools_IndexedMapOfShape map_TopoDS_Vertex;
315 TopExp::MapShapes(topods_shape,TopAbs_VERTEX, map_TopoDS_Vertex);
316 for(
int i=1;i<map_TopoDS_Vertex.Extent()+1;i++)
318 TopoDS_Vertex topods_vertex = TopoDS::Vertex(map_TopoDS_Vertex.FindKey(i));
319 TDF_Label label_topods_vertex = shapetool->FindShape(topods_vertex);
320 if(!label_topods_vertex.IsNull())
322 Handle(TDataStd_Name) nom =
new TDataStd_Name;
323 label_topods_vertex.FindAttribute(TDataStd_Name::GetID(),nom);
324 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
325 label_topods_vertex.FindAttribute(TDataStd_AsciiString::GetID(),num_string);
330 tdocstd_application->Close(tdocstd_document);
335 std::map< MG_ELEMENT_TOPOLOGIQUE*, MG_ELEMENT_TOPOLOGIQUE* >* map_nouveau_mg_element_topologique,
336 std::map< MG_ELEMENT_COTOPOLOGIQUE*, MG_ELEMENT_COTOPOLOGIQUE* >* map_nouveau_mg_element_cotopologique,
337 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
339 bool fusionner_entite_similaire,
343 switch(topods_shape.ShapeType())
345 case TopAbs_COMPOUND:
347 map_nouveau_mg_element_topologique,
348 map_nouveau_mg_element_cotopologique,
349 map_nouveau_mg_element_geometrique,
351 fusionner_entite_similaire,
353 case TopAbs_COMPSOLID:
355 map_nouveau_mg_element_topologique,
356 map_nouveau_mg_element_cotopologique,
357 map_nouveau_mg_element_geometrique,
359 fusionner_entite_similaire,
363 map_nouveau_mg_element_topologique,
364 map_nouveau_mg_element_cotopologique,
365 map_nouveau_mg_element_geometrique,
367 fusionner_entite_similaire,
371 map_nouveau_mg_element_topologique,
372 map_nouveau_mg_element_cotopologique,
373 map_nouveau_mg_element_geometrique,
376 fusionner_entite_similaire,
380 map_nouveau_mg_element_topologique,
381 map_nouveau_mg_element_cotopologique,
382 map_nouveau_mg_element_geometrique,
385 fusionner_entite_similaire,
389 map_nouveau_mg_element_topologique,
390 map_nouveau_mg_element_cotopologique,
391 map_nouveau_mg_element_geometrique,
394 fusionner_entite_similaire,
398 map_nouveau_mg_element_topologique,
399 map_nouveau_mg_element_cotopologique,
400 map_nouveau_mg_element_geometrique,
403 fusionner_entite_similaire,
407 map_nouveau_mg_element_topologique,
408 map_nouveau_mg_element_cotopologique,
409 map_nouveau_mg_element_geometrique,
413 fusionner_entite_similaire,
420 std::map< MG_ELEMENT_TOPOLOGIQUE*, MG_ELEMENT_TOPOLOGIQUE* >* map_nouveau_mg_element_topologique,
421 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
422 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
424 bool fusionner_entite_similaire,
428 TopTools_DataMapOfShapeShape map_TopoDS_Solid;
429 TopTools_DataMapOfShapeShape map_TopoDS_Shell;
430 TopTools_DataMapOfShapeShape map_TopoDS_Face;
431 TopTools_DataMapOfShapeShape map_TopoDS_Wire;
432 TopTools_DataMapOfShapeShape map_TopoDS_Edge;
433 TopTools_DataMapOfShapeShape map_TopoDS_Vertex;
443 for(TopTools_DataMapOfShapeShape::Iterator it_solid(map_TopoDS_Solid);it_solid.More();it_solid.Next())
445 TopoDS_Solid topods_solid = TopoDS::Solid(it_solid.Value());
447 map_nouveau_mg_element_topologique,
448 map_nouveau_mg_element_cotopologique,
449 map_nouveau_mg_element_geometrique,
451 fusionner_entite_similaire,
455 for(TopTools_DataMapOfShapeShape::Iterator it_shell(map_TopoDS_Shell);it_shell.More();it_shell.Next())
457 TopoDS_Shell topods_shell = TopoDS::Shell(it_shell.Value());
459 map_nouveau_mg_element_topologique,
460 map_nouveau_mg_element_cotopologique,
461 map_nouveau_mg_element_geometrique,
464 fusionner_entite_similaire,
468 for(TopTools_DataMapOfShapeShape::Iterator it_face(map_TopoDS_Face);it_face.More();it_face.Next())
470 TopoDS_Face topods_face = TopoDS::Face(it_face.Value());
472 map_nouveau_mg_element_topologique,
473 map_nouveau_mg_element_cotopologique,
474 map_nouveau_mg_element_geometrique,
477 fusionner_entite_similaire,
481 for(TopTools_DataMapOfShapeShape::Iterator it_wire(map_TopoDS_Wire);it_wire.More();it_wire.Next())
483 TopoDS_Wire topods_wire = TopoDS::Wire(it_wire.Value());
485 map_nouveau_mg_element_topologique,
486 map_nouveau_mg_element_cotopologique,
487 map_nouveau_mg_element_geometrique,
490 fusionner_entite_similaire,
494 for(TopTools_DataMapOfShapeShape::Iterator it_edge(map_TopoDS_Edge);it_edge.More();it_edge.Next())
496 TopoDS_Edge topods_edge = TopoDS::Edge(it_edge.Value());
498 map_nouveau_mg_element_topologique,
499 map_nouveau_mg_element_cotopologique,
500 map_nouveau_mg_element_geometrique,
503 fusionner_entite_similaire,
507 for(TopTools_DataMapOfShapeShape::Iterator it_vertex(map_TopoDS_Vertex);it_vertex.More();it_vertex.Next())
509 TopoDS_Vertex topods_vertex = TopoDS::Vertex(it_vertex.Value());
511 map_nouveau_mg_element_topologique,
512 map_nouveau_mg_element_cotopologique,
513 map_nouveau_mg_element_geometrique,
517 fusionner_entite_similaire,
523 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
524 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
525 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
527 bool fusionner_entite_similaire,
531 TopTools_IndexedMapOfShape map_volume;
532 TopExp::MapShapes(topods_compsolid,TopAbs_SOLID, map_volume);
533 for(
int i=1;i<map_volume.Extent()+1;i++)
535 TopoDS_Solid topods_solid = TopoDS::Solid(map_volume.FindKey(i));
537 map_nouveau_mg_element_topologique,
538 map_nouveau_mg_element_cotopologique,
539 map_nouveau_mg_element_geometrique,
541 fusionner_entite_similaire,
547 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
548 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
549 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
551 bool fusionner_entite_similaire,
555 if(topods_solid.IsNull()) std::cerr <<
"OCC_FONCTION_V2017::importer_TopoDS_Solid -> topods_solid.IsNull() !" << std::endl;
557 if(fusionner_entite_similaire)
565 if(map_nouveau_mg_element_topologique!=NULL) map_nouveau_mg_element_topologique->insert(std::pair<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*>(occ_volume,occ_volume));
568 mg_volume=occ_volume;
569 TopTools_IndexedMapOfShape map_shell;
570 TopExp::MapShapes(topods_solid,TopAbs_SHELL, map_shell);
571 for(
int i=1;i<map_shell.Extent()+1;i++)
573 TopoDS_Shell topods_shell = TopoDS::Shell(map_shell.FindKey(i));
575 map_nouveau_mg_element_topologique,
576 map_nouveau_mg_element_cotopologique,
577 map_nouveau_mg_element_geometrique,
580 fusionner_entite_similaire,
588 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
589 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
590 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
593 bool fusionner_entite_similaire,
597 if(topods_shell.IsNull()) std::cerr <<
"OCC_FONCTION_V2017::importer_TopoDS_Shell -> topods_shell.IsNull() !" << std::endl;
599 if(fusionner_entite_similaire)
604 if(mg_coquille==NULL)
606 if(mg_ele_topo_superieur!=NULL)
608 if(mg_ele_topo_superieur->
get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::COQUE)
612 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(occ_coquille,occ_coquille));
616 mg_coquille=occ_coquille;
618 else if(mg_ele_topo_superieur->
get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::VOLUME)
622 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(occ_coquille,occ_coquille));
626 mg_coquille=occ_coquille;
635 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(occ_coquille,occ_coquille));
638 mg_coquille=occ_coquille;
640 TopTools_IndexedMapOfShape map_face;
641 TopExp::MapShapes(topods_shell,TopAbs_FACE, map_face);
642 for(
int i=1;i<map_face.Extent()+1;i++)
644 TopoDS_Face topods_face = TopoDS::Face(map_face.FindKey(i));
646 map_nouveau_mg_element_topologique,
647 map_nouveau_mg_element_cotopologique,
648 map_nouveau_mg_element_geometrique,
651 fusionner_entite_similaire,
659 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
660 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
661 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
664 bool fusionner_entite_similaire,
668 if(topods_face.IsNull()) std::cerr <<
"OCC_FONCTION_V2017::importer_TopoDS_Face -> topods_face.IsNull() !" << std::endl;
670 if(fusionner_entite_similaire)
675 bool nouvelle_face=
false;
679 if(map_nouveau_mg_element_geometrique!=NULL) map_nouveau_mg_element_geometrique->insert(std::pair<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*>(occ_surface,occ_surface));
682 if(topods_face.Orientation()==TopAbs_FORWARD) sens_occ_face=1;
683 else sens_occ_face=-1;
684 OCC_FACE* occ_face =
new OCC_FACE(
"-1",occ_surface,sens_occ_face,topods_face,
this);
685 if(map_nouveau_mg_element_topologique!=NULL) map_nouveau_mg_element_topologique->insert(std::pair<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*>(occ_face,occ_face));
691 if(mg_coquille!=NULL )
697 int sens_mg_coquille;
699 if(occ_coquille->
get_TopoDS_Shell().Orientation()==TopAbs_FORWARD) sens_mg_coface=1;
700 else sens_mg_coface=-1;
706 if(occ_face->
get_TopoDS_Face().Orientation()==topods_face.Orientation())
710 else sens_mg_coface=-1;
713 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(mg_coface,mg_coface));
720 TopTools_IndexedMapOfShape map_wire;
721 TopExp::MapShapes(topods_face,TopAbs_WIRE, map_wire);
722 for(
int i=1;i<map_wire.Extent()+1;i++)
724 TopoDS_Wire topods_wire = TopoDS::Wire(map_wire.FindKey(i));
726 map_nouveau_mg_element_topologique,
727 map_nouveau_mg_element_cotopologique,
728 map_nouveau_mg_element_geometrique,
731 fusionner_entite_similaire,
740 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
741 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
742 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
745 bool fusionner_entite_similaire,
749 if(topods_wire.IsNull()) std::cerr <<
"OCC_FONCTION_V2017::importer_TopoDS_Wire -> topods_wire.IsNull() !" << std::endl;
751 if(fusionner_entite_similaire)
758 if(mg_ele_topo_superieur!=NULL)
760 if(mg_ele_topo_superieur->
get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE)
764 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(occ_boucle,occ_boucle));
768 mg_boucle=occ_boucle;
770 else if(mg_ele_topo_superieur->
get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::POUTRE)
774 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(occ_boucle,occ_boucle));
778 mg_boucle=occ_boucle;
784 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(occ_boucle,occ_boucle));
787 mg_boucle=occ_boucle;
789 BRepTools_WireExplorer Ex;
790 for(Ex.Init(topods_wire); Ex.More(); Ex.Next())
792 TopoDS_Edge topods_edge = TopoDS::Edge(Ex.Current());
795 map_nouveau_mg_element_topologique,
796 map_nouveau_mg_element_cotopologique,
797 map_nouveau_mg_element_geometrique,
800 fusionner_entite_similaire,
808 TopoDS_Wire *topods_wire,
809 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
810 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
811 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
814 bool fusionner_entite_similaire,
818 if(topods_edge.IsNull()) std::cerr <<
"OCC_FONCTION_V2017::importer_TopoDS_Edge -> topods_edge.IsNull() !" << std::endl;
820 if(BRep_Tool::Degenerated(topods_edge))
return NULL;
821 if(fusionner_entite_similaire)
826 bool nouvelle_arete=
false;
830 if (topods_edge.Orientation()==TopAbs_FORWARD) sens=1;
833 if(map_nouveau_mg_element_geometrique!=NULL) map_nouveau_mg_element_geometrique->insert(std::pair<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*>(occcourbe,occcourbe));
836 if(map_nouveau_mg_element_topologique!=NULL) map_nouveau_mg_element_topologique->insert(std::pair<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*>(occ_arete,occ_arete));
847 if (topods_edge.Orientation()==TopAbs_FORWARD) sens=1;
855 if(wire_occ_boucle.Orientation()==topods_wire->Orientation()) sens_boucle=1;
857 if (topods_edge.Orientation()==TopAbs_FORWARD) sens=sens_boucle;
858 else sens=-sens_boucle;
862 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(mg_coarete,mg_coarete));
869 topods_edge = ((
OCC_ARETE*)mg_arete)->get_TopoDS_Edge();
871 map_nouveau_mg_element_topologique,
872 map_nouveau_mg_element_cotopologique,
873 map_nouveau_mg_element_geometrique,
877 fusionner_entite_similaire,
880 map_nouveau_mg_element_topologique,
881 map_nouveau_mg_element_cotopologique,
882 map_nouveau_mg_element_geometrique,
886 fusionner_entite_similaire,
893 std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*> *map_nouveau_mg_element_topologique,
894 std::map<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*> *map_nouveau_mg_element_cotopologique,
895 std::map<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*> *map_nouveau_mg_element_geometrique,
899 bool fusionner_entite_similaire,
903 if(topods_vertex.IsNull()) std::cerr <<
"OCC_FONCTION_V2017::importer_TopoDS_Vertex -> topods_vertex.IsNull() !" << std::endl;
905 if(fusionner_entite_similaire)
910 bool nouveau_sommet=
false;
914 if(map_nouveau_mg_element_geometrique!=NULL) map_nouveau_mg_element_geometrique->insert(std::pair<MG_ELEMENT_GEOMETRIQUE*,MG_ELEMENT_GEOMETRIQUE*>(occ_point,occ_point));
917 if(map_nouveau_mg_element_topologique!=NULL) map_nouveau_mg_element_topologique->insert(std::pair<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*>(occ_sommet,occ_sommet));
919 mg_sommet=occ_sommet;
928 if(map_nouveau_mg_element_cotopologique!=NULL) map_nouveau_mg_element_cotopologique->insert(std::pair<MG_ELEMENT_COTOPOLOGIQUE*,MG_ELEMENT_COTOPOLOGIQUE*>(mg_cosommet,mg_cosommet));
959 std::pair<std::map<long,TopoDS_Shape>::iterator,
bool> p =
m_map_id_TopoDS_Shape.insert(std::pair<long,TopoDS_Shape>(
id,vertex));
960 if(!p.second)
return FAIL;
979 else if(recherche_avancee)
1006 std::pair<std::map<long,TopoDS_Shape>::iterator,
bool> p =
m_map_id_TopoDS_Shape.insert(std::pair<long,TopoDS_Shape>(
id,edge));
1007 if(!p.second)
return FAIL;
1026 else if(recherche_avancee)
1053 std::pair<std::map<long,TopoDS_Shape>::iterator,
bool> p =
m_map_id_TopoDS_Shape.insert(std::pair<long,TopoDS_Shape>(
id,wire));
1054 if(!p.second)
return FAIL;
1095 std::pair<std::map<long,TopoDS_Shape>::iterator,
bool> p =
m_map_id_TopoDS_Shape.insert(std::pair<long,TopoDS_Shape>(
id,face));
1096 if(!p.second)
return FAIL;
1114 else if(recherche_avancee)
1159 std::pair<std::map<long,TopoDS_Shape>::iterator,
bool> p =
m_map_id_TopoDS_Shape.insert(std::pair<long,TopoDS_Shape>(
id,shell));
1160 if(!p.second)
return FAIL;
1201 std::pair<std::map<long,TopoDS_Shape>::iterator,
bool> p =
m_map_id_TopoDS_Shape.insert(std::pair<long,TopoDS_Shape>(
id,solid));
1202 if(!p.second)
return FAIL;
1249 std::map< long int, MG_IDENTIFICATEUR* >& map_element_identifie,
1250 XCAFDoc_ShapeTool &shape_tool,
1251 TDF_Label &top_label_shape,
1255 std::map<long,MG_IDENTIFICATEUR*>::iterator it = map_element_identifie.find(occ_volume->
get_id());
1256 if(it==map_element_identifie.end())
1259 TDF_Label label_shape;
1262 label_shape=shape_tool.NewShape();
1263 shape_tool.SetShape(label_shape,topods_solid);
1264 top_label_shape=label_shape;
1269 label_shape=shape_tool.AddSubShape(top_label_shape,topods_solid);
1271 if(!label_shape.IsNull())
1273 Handle(TDataStd_Name) nom =
new TDataStd_Name;
1275 label_shape.AddAttribute(nom);
1276 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1278 label_shape.AddAttribute(num_string);
1279 map_element_identifie.insert(std::pair<long,MG_IDENTIFICATEUR*>(occ_volume->
get_id(),occ_volume));
1290 std::map< long int, MG_IDENTIFICATEUR* >& map_element_identifie,
1291 XCAFDoc_ShapeTool &shape_tool,
1292 TDF_Label &top_label_shape,
1296 std::map<long,MG_IDENTIFICATEUR*>::iterator it = map_element_identifie.find(occ_coquille->
get_id());
1297 if(it==map_element_identifie.end())
1299 TDF_Label label_shape;
1302 label_shape=shape_tool.NewShape();
1303 shape_tool.SetShape(label_shape,topods_shell);
1304 top_label_shape=label_shape;
1309 label_shape=shape_tool.AddSubShape(top_label_shape,topods_shell);
1311 if(!label_shape.IsNull())
1313 Handle(TDataStd_Name) nom =
new TDataStd_Name;
1314 if(label_shape.FindAttribute(TDataStd_Name::GetID(),nom)==
false)
1317 nom->Set(
"Coquille");
1318 label_shape.AddAttribute(nom);
1319 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1321 label_shape.AddAttribute(num_string);
1322 map_element_identifie.insert(std::pair<long,MG_IDENTIFICATEUR*>(occ_coquille->
get_id(),occ_coquille));
1331 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1332 label_shape.FindAttribute(TDataStd_AsciiString::GetID(),num_string);
1334 map_element_identifie.insert(std::pair<long,MG_IDENTIFICATEUR*>(occ_coquille->
get_id(),occ_coquille));
1346 std::map< long int, MG_IDENTIFICATEUR* >& map_element_identifie,
1347 XCAFDoc_ShapeTool &shape_tool,
1348 TDF_Label &top_label_shape,
1352 std::map<long,MG_IDENTIFICATEUR*>::iterator it = map_element_identifie.find(occ_face->
get_id());
1353 if(it==map_element_identifie.end())
1357 TDF_Label label_shape;
1360 label_shape=shape_tool.NewShape();
1361 shape_tool.SetShape(label_shape,topods_face);
1362 top_label_shape=label_shape;
1367 label_shape=shape_tool.AddSubShape(top_label_shape,topods_face);
1369 if(!label_shape.IsNull())
1371 Handle(TDataStd_Name) nom =
new TDataStd_Name;
1373 label_shape.AddAttribute(nom);
1374 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1376 label_shape.AddAttribute(num_string);
1377 map_element_identifie.insert(std::pair<long,MG_IDENTIFICATEUR*>(occ_face->
get_id(),occ_face));
1388 std::map< long int, MG_IDENTIFICATEUR* >& map_element_identifie,
1389 XCAFDoc_ShapeTool &shape_tool,
1390 TDF_Label &top_label_shape,
1394 std::map<long,MG_IDENTIFICATEUR*>::iterator it = map_element_identifie.find(occ_boucle->
get_id());
1395 if(it==map_element_identifie.end())
1398 TDF_Label label_shape;
1401 label_shape=shape_tool.NewShape();
1402 shape_tool.SetShape(label_shape,topods_wire);
1403 top_label_shape=label_shape;
1408 label_shape=shape_tool.AddSubShape(top_label_shape,topods_wire);
1410 if(!label_shape.IsNull())
1412 Handle(TDataStd_Name) nom =
new TDataStd_Name;
1414 label_shape.AddAttribute(nom);
1415 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1417 label_shape.AddAttribute(num_string);
1418 map_element_identifie.insert(std::pair<long,MG_IDENTIFICATEUR*>(occ_boucle->
get_id(),occ_boucle));
1429 std::map< long int, MG_IDENTIFICATEUR* >& map_element_identifie,
1430 XCAFDoc_ShapeTool &shape_tool,
1431 TDF_Label &top_label_shape,
1435 std::map<long,MG_IDENTIFICATEUR*>::iterator it = map_element_identifie.find(occ_arete->
get_id());
1436 if(it==map_element_identifie.end())
1440 TDF_Label label_shape;
1443 label_shape=shape_tool.NewShape();
1444 shape_tool.SetShape(label_shape,topods_edge);
1445 top_label_shape=label_shape;
1450 label_shape=shape_tool.AddSubShape(top_label_shape,topods_edge);
1452 if(!label_shape.IsNull())
1454 Handle(TDataStd_Name) nom =
new TDataStd_Name;
1456 label_shape.AddAttribute(nom);
1457 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1459 label_shape.AddAttribute(num_string);
1460 map_element_identifie.insert(std::pair<long,MG_IDENTIFICATEUR*>(occ_arete->
get_id(),occ_arete));
1468 std::map< long int, MG_IDENTIFICATEUR* >& map_element_identifie,
1469 XCAFDoc_ShapeTool &shape_tool,
1470 TDF_Label &top_label_shape,
1474 std::map<long,MG_IDENTIFICATEUR*>::iterator it = map_element_identifie.find(occ_sommet->
get_id());
1475 if(it==map_element_identifie.end())
1479 TDF_Label label_shape;
1482 label_shape=shape_tool.NewShape();
1483 shape_tool.SetShape(label_shape,topods_vertex);
1484 top_label_shape=label_shape;
1488 label_shape=shape_tool.AddSubShape(top_label_shape,topods_vertex);
1490 if(!label_shape.IsNull())
1492 Handle(TDataStd_Name) nom =
new TDataStd_Name;
1494 label_shape.AddAttribute(nom);
1495 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1497 label_shape.AddAttribute(num_string);
1498 map_element_identifie.insert(std::pair<long,MG_IDENTIFICATEUR*>(occ_sommet->
get_id(),occ_sommet));
1505 if(topods_shape.ShapeType()==TopAbs_EDGE)
1507 TopoDS_Edge topods_edge = TopoDS::Edge(topods_shape);
1508 if(BRep_Tool::Degenerated(topods_edge))
1510 TDF_Label label_shape;
1511 label_shape=shape_tool.AddSubShape(top_label_shape,topods_edge);
1512 if(!label_shape.IsNull())
1514 Handle(TDataStd_Name) nom =
new TDataStd_Name;
1515 nom->Set(
"Arete_degenere");
1516 label_shape.AddAttribute(nom);
1517 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1518 num_string->Set(
"Aucun objet MAGiC");
1519 label_shape.AddAttribute(num_string);
1525 TopTools_IndexedMapOfShape map_edge;
1526 TopExp::MapShapes(topods_shape,TopAbs_EDGE, map_edge);
1527 for(
int i=1;i<map_edge.Extent()+1;i++)
1529 TopoDS_Edge topods_edge = TopoDS::Edge(map_edge.FindKey(i));
1530 if(BRep_Tool::Degenerated(topods_edge))
1532 TDF_Label label_shape;
1533 label_shape=shape_tool.AddSubShape(top_label_shape,topods_edge);
1534 if(!label_shape.IsNull())
1536 Handle(TDataStd_Name) nom =
new TDataStd_Name;
1537 nom->Set(
"Arete_degenere");
1538 label_shape.AddAttribute(nom);
1539 Handle(TDataStd_AsciiString) num_string =
new TDataStd_AsciiString;
1540 num_string->Set(
"Aucun objet MAGiC");
1541 label_shape.AddAttribute(num_string);
1550 gp_Pnt
point = BRep_Tool::Pnt(vertex);
1551 NCollection_DataMap<TopoDS_Shape,MG_ELEMENT_TOPOLOGIQUE*,TopTools_ShapeMapHasher>::Iterator it(MapOfShape_MG_ELEMENT_TOPOLOGIQUE);
1552 for(;it.More();it.Next())
1554 if(it.Key().ShapeType()==TopAbs_VERTEX)
1556 TopoDS_Vertex vertex_compare = TopoDS::Vertex(it.Key());
1557 gp_Pnt point_compare = BRep_Tool::Pnt(vertex_compare);
1558 if(
point.IsEqual(point_compare,Precision::Confusion()))
1569 NCollection_DataMap<TopoDS_Shape,MG_ELEMENT_TOPOLOGIQUE*,TopTools_ShapeMapHasher>::Iterator it(MapOfShape_MG_ELEMENT_TOPOLOGIQUE);
1570 for(;it.More();it.Next())
1572 if(it.Key().ShapeType()==TopAbs_EDGE)
1574 TopoDS_Edge edge_compare = TopoDS::Edge(it.Key());
1576 Bnd_Box box_edge_compare;
1577 BRepBndLib::Add(edge,box_edge);
1578 BRepBndLib::Add(edge_compare,box_edge_compare);
1579 double centre_box_edge[3];
1580 double centre_box_edge_compare[3];
1581 double x0,y0,z0,x1,y1,z1;
1582 box_edge.Get(x0,y0,z0,x1,y1,z1);
1583 centre_box_edge[0] = x0+(x1-x0)/2.;
1584 centre_box_edge[1] = y0+(y1-y0)/2.;
1585 centre_box_edge[2] = z0+(z1-z0)/2.;
1586 box_edge_compare.Get(x0,y0,z0,x1,y1,z1);
1587 centre_box_edge_compare[0] = x0+(x1-x0)/2.;
1588 centre_box_edge_compare[1] = y0+(y1-y0)/2.;
1589 centre_box_edge_compare[2] = z0+(z1-z0)/2.;
1590 if((fabs(centre_box_edge[0]-centre_box_edge_compare[0])<Precision::Confusion()) &&
1591 (fabs(centre_box_edge[1]-centre_box_edge_compare[1])<Precision::Confusion()) &&
1592 (fabs(centre_box_edge[2]-centre_box_edge_compare[2])<Precision::Confusion()))
1594 bool correspondance=
true;
1595 gp_Pnt point_1_edge = BRep_Tool::Pnt(TopExp::FirstVertex(edge));
1596 gp_Pnt point_2_edge = BRep_Tool::Pnt(TopExp::LastVertex(edge));
1597 gp_Pnt point_1_edge_compare = BRep_Tool::Pnt(TopExp::FirstVertex(edge_compare));
1598 gp_Pnt point_2_edge_compare = BRep_Tool::Pnt(TopExp::LastVertex(edge_compare));
1600 if(!point_1_edge.IsEqual(point_1_edge_compare,Precision::Confusion()) && !point_1_edge.IsEqual(point_2_edge_compare,Precision::Confusion())) correspondance=
false;
1601 if(!point_2_edge.IsEqual(point_2_edge_compare,Precision::Confusion()) && !point_2_edge.IsEqual(point_1_edge_compare,Precision::Confusion())) correspondance=
false;
1604 GeomAPI_ProjectPointOnCurve projecteur;
1605 double u0_edge,u1_edge;
1606 double u0_edge_compare,u1_edge_compare;
1607 Handle(Geom_Curve) courbe_edge = BRep_Tool::Curve(edge,u0_edge,u1_edge);
1608 Handle(Geom_Curve) courbe_edge_compare = BRep_Tool::Curve(edge_compare,u0_edge_compare,u1_edge_compare);
1610 double pas = (u1_edge-u0_edge)/(
double)nb_pas;
1612 while(correspondance==
true && i<nb_pas)
1614 gp_Pnt
point = courbe_edge->Value(u0_edge+i*pas);
1615 projecteur.Init(
point,courbe_edge_compare,u0_edge_compare,u1_edge_compare);
1616 if(projecteur.NbPoints()==0) correspondance=
false;
1619 if(projecteur.LowerDistance()>Precision::Confusion())
1621 correspondance=
false;
1626 if(correspondance==
true)
1628 pas = (u1_edge_compare-u0_edge_compare)/(
double)nb_pas;
1630 while(correspondance==
true && i<nb_pas)
1632 gp_Pnt
point = courbe_edge_compare->Value(u0_edge_compare+i*pas);
1633 projecteur.Init(
point,courbe_edge,u0_edge,u1_edge);
1634 if(projecteur.NbPoints()==0) correspondance=
false;
1637 if(projecteur.LowerDistance()>Precision::Confusion())
1639 correspondance=
false;
1656 BRepBndLib::Add(face,box_face);
1657 double centre_box_face[3];
1658 double x0,y0,z0,x1,y1,z1;
1659 box_face.Get(x0,y0,z0,x1,y1,z1);
1660 centre_box_face[0] = x0+(x1-x0)/2.;
1661 centre_box_face[1] = y0+(y1-y0)/2.;
1662 centre_box_face[2] = z0+(z1-z0)/2.;
1663 NCollection_DataMap<TopoDS_Shape,MG_ELEMENT_TOPOLOGIQUE*,TopTools_ShapeMapHasher>::Iterator it(MapOfShape_MG_ELEMENT_TOPOLOGIQUE);
1664 for(;it.More();it.Next())
1666 if(it.Key().ShapeType()==TopAbs_FACE)
1668 TopoDS_Face face_compare = TopoDS::Face(it.Key());
1669 Bnd_Box box_face_compare;
1670 BRepBndLib::Add(face_compare,box_face_compare);
1671 double centre_box_face_compare[3];
1672 box_face_compare.Get(x0,y0,z0,x1,y1,z1);
1673 centre_box_face_compare[0] = x0+(x1-x0)/2.;
1674 centre_box_face_compare[1] = y0+(y1-y0)/2.;
1675 centre_box_face_compare[2] = z0+(z1-z0)/2.;
1676 if((fabs(centre_box_face[0]-centre_box_face_compare[0])<Precision::Confusion()) &&
1677 (fabs(centre_box_face[1]-centre_box_face_compare[1])<Precision::Confusion()) &&
1678 (fabs(centre_box_face[2]-centre_box_face_compare[2])<Precision::Confusion()))
1680 bool correspondance=
true;
1681 double u0_face, u1_face;
1682 double v0_face, v1_face;
1683 double u0_face_compare, u1_face_compare;
1684 double v0_face_compare, v1_face_compare;
1685 ShapeAnalysis::GetFaceUVBounds(face,u0_face,u1_face,v0_face,v1_face);
1686 ShapeAnalysis::GetFaceUVBounds(face_compare,u0_face_compare,u1_face_compare,v0_face_compare,v1_face_compare);
1687 GeomAPI_ProjectPointOnSurf projecteur;
1688 Handle(Geom_Surface) surface_face = BRep_Tool::Surface(face);
1689 Handle(Geom_Surface) surface_face_compare = BRep_Tool::Surface(face_compare);
1692 double pas_u = (u1_face-u0_face)/(
double)nb_pas_u;
1693 double pas_v = (v1_face-v0_face)/(
double)nb_pas_v;
1695 while(correspondance==
true && i<nb_pas_u)
1698 while(correspondance==
true && j<nb_pas_v)
1700 gp_Pnt
point = surface_face->Value(u0_face+i*pas_u,v0_face+j*pas_v);
1701 GeomAPI_ProjectPointOnSurf projecteur;
1702 projecteur.Init(
point,surface_face_compare,u0_face_compare,u1_face_compare,v0_face_compare,v1_face_compare);
1703 if(projecteur.IsDone() && projecteur.NbPoints()>0)
1705 if(((projecteur.NearestPoint().X()-
point.X())*(projecteur.NearestPoint().X()-
point.X())+
1706 (projecteur.NearestPoint().Y()-
point.Y())*(projecteur.NearestPoint().Y()-
point.Y())+
1707 (projecteur.NearestPoint().Z()-
point.Z())*(projecteur.NearestPoint().Z()-
point.Z()))>=Precision::Confusion())
1708 correspondance=
false;
1710 else correspondance=
false;
1711 if(correspondance==
true)
1713 BRepClass_FaceClassifier face_compare_classifier(face_compare,
point,Precision::Confusion());
1714 if(face_compare_classifier.State()==TopAbs_OUT)
1716 correspondance=
false;
1723 if(correspondance==
true)
1725 pas_u = (u1_face_compare-u0_face_compare)/(
double)nb_pas_u;
1726 pas_v = (v1_face_compare-v0_face_compare)/(
double)nb_pas_v;
1728 while(correspondance==
true && i<nb_pas_u)
1731 while(correspondance==
true && j<nb_pas_v)
1733 gp_Pnt
point = surface_face_compare->Value(u0_face_compare+i*pas_u,v0_face_compare+j*pas_v);
1734 GeomAPI_ProjectPointOnSurf projecteur;
1735 projecteur.Init(
point,surface_face,u0_face,u1_face,v0_face,v1_face);
1736 if(projecteur.IsDone() && projecteur.NbPoints()>0)
1738 if(((projecteur.NearestPoint().X()-
point.X())*(projecteur.NearestPoint().X()-
point.X())+
1739 (projecteur.NearestPoint().Y()-
point.Y())*(projecteur.NearestPoint().Y()-
point.Y())+
1740 (projecteur.NearestPoint().Z()-
point.Z())*(projecteur.NearestPoint().Z()-
point.Z()))>=Precision::Confusion())
1741 correspondance=
false;
1743 else correspondance=
false;
1744 if(correspondance==
true)
1746 BRepClass_FaceClassifier face_classifier(face,
point,Precision::Confusion());
1747 if(face_classifier.State()==TopAbs_OUT)
1749 correspondance=
false;
1756 if(correspondance==
true)
return (
OCC_FACE*)it.Value();
1767 TopTools_DataMapOfShapeShape& map_TopoDS_Solid,
1768 TopTools_DataMapOfShapeShape& map_TopoDS_Shell,
1769 TopTools_DataMapOfShapeShape& map_TopoDS_Face,
1770 TopTools_DataMapOfShapeShape& map_TopoDS_Wire,
1771 TopTools_DataMapOfShapeShape& map_TopoDS_Edge,
1772 TopTools_DataMapOfShapeShape& map_TopoDS_Vertex)
1775 TopTools_IndexedMapOfShape tmp_map_TopoDS_Solid;
1776 TopTools_IndexedMapOfShape tmp_map_TopoDS_Shell;
1777 TopTools_IndexedMapOfShape tmp_map_TopoDS_Face;
1778 TopTools_IndexedMapOfShape tmp_map_TopoDS_Wire;
1779 TopTools_IndexedMapOfShape tmp_map_TopoDS_Edge;
1780 TopTools_IndexedMapOfShape tmp_map_TopoDS_Vertex;
1782 TopExp::MapShapes(topods_compound,TopAbs_SOLID, tmp_map_TopoDS_Solid);
1783 TopExp::MapShapes(topods_compound,TopAbs_SHELL, tmp_map_TopoDS_Shell);
1784 TopExp::MapShapes(topods_compound,TopAbs_FACE, tmp_map_TopoDS_Face);
1785 TopExp::MapShapes(topods_compound,TopAbs_WIRE, tmp_map_TopoDS_Wire);
1786 TopExp::MapShapes(topods_compound,TopAbs_EDGE, tmp_map_TopoDS_Edge);
1787 TopExp::MapShapes(topods_compound,TopAbs_VERTEX, tmp_map_TopoDS_Vertex);
1789 for(TopTools_IndexedMapOfShape::Iterator it_solid(tmp_map_TopoDS_Solid);it_solid.More();it_solid.Next()) map_TopoDS_Solid.Bind(it_solid.Value(),it_solid.Value());
1790 for(TopTools_IndexedMapOfShape::Iterator it_shell(tmp_map_TopoDS_Shell);it_shell.More();it_shell.Next()) map_TopoDS_Shell.Bind(it_shell.Value(),it_shell.Value());
1791 for(TopTools_IndexedMapOfShape::Iterator it_face(tmp_map_TopoDS_Face);it_face.More();it_face.Next()) map_TopoDS_Face.Bind(it_face.Value(),it_face.Value());
1792 for(TopTools_IndexedMapOfShape::Iterator it_wire(tmp_map_TopoDS_Wire);it_wire.More();it_wire.Next()) map_TopoDS_Wire.Bind(it_wire.Value(),it_wire.Value());
1793 for(TopTools_IndexedMapOfShape::Iterator it_edge(tmp_map_TopoDS_Edge);it_edge.More();it_edge.Next()) map_TopoDS_Edge.Bind(it_edge.Value(),it_edge.Value());
1794 for(TopTools_IndexedMapOfShape::Iterator it_vertex(tmp_map_TopoDS_Vertex);it_vertex.More();it_vertex.Next()) map_TopoDS_Vertex.Bind(it_vertex.Value(),it_vertex.Value());
1796 tmp_map_TopoDS_Solid.Clear();
1797 tmp_map_TopoDS_Shell.Clear();
1798 tmp_map_TopoDS_Face.Clear();
1799 tmp_map_TopoDS_Wire.Clear();
1800 tmp_map_TopoDS_Edge.Clear();
1801 tmp_map_TopoDS_Vertex.Clear();
1803 for(TopTools_DataMapOfShapeShape::Iterator it_solid(map_TopoDS_Solid);it_solid.More();it_solid.Next())
1805 TopExp::MapShapes(it_solid.Value(),TopAbs_SHELL, tmp_map_TopoDS_Shell);
1806 TopExp::MapShapes(it_solid.Value(),TopAbs_FACE, tmp_map_TopoDS_Face);
1807 TopExp::MapShapes(it_solid.Value(),TopAbs_WIRE, tmp_map_TopoDS_Wire);
1808 TopExp::MapShapes(it_solid.Value(),TopAbs_EDGE, tmp_map_TopoDS_Edge);
1809 TopExp::MapShapes(it_solid.Value(),TopAbs_VERTEX, tmp_map_TopoDS_Vertex);
1811 for(TopTools_IndexedMapOfShape::Iterator it_shell(tmp_map_TopoDS_Shell);it_shell.More();it_shell.Next())
1812 if(map_TopoDS_Shell.IsBound(it_shell.Value())) map_TopoDS_Shell.UnBind(it_shell.Value());
1813 for(TopTools_IndexedMapOfShape::Iterator it_face(tmp_map_TopoDS_Face);it_face.More();it_face.Next())
1814 if(map_TopoDS_Face.IsBound(it_face.Value())) map_TopoDS_Face.UnBind(it_face.Value());
1815 for(TopTools_IndexedMapOfShape::Iterator it_wire(tmp_map_TopoDS_Wire);it_wire.More();it_wire.Next())
1816 if(map_TopoDS_Wire.IsBound(it_wire.Value())) map_TopoDS_Wire.UnBind(it_wire.Value());
1817 for(TopTools_IndexedMapOfShape::Iterator it_edge(tmp_map_TopoDS_Edge);it_edge.More();it_edge.Next())
1818 if(map_TopoDS_Edge.IsBound(it_edge.Value())) map_TopoDS_Edge.UnBind(it_edge.Value());
1819 for(TopTools_IndexedMapOfShape::Iterator it_vertex(tmp_map_TopoDS_Vertex);it_vertex.More();it_vertex.Next())
1820 if(map_TopoDS_Vertex.IsBound(it_vertex.Value())) map_TopoDS_Vertex.UnBind(it_vertex.Value());
1822 tmp_map_TopoDS_Shell.Clear();
1823 tmp_map_TopoDS_Face.Clear();
1824 tmp_map_TopoDS_Wire.Clear();
1825 tmp_map_TopoDS_Edge.Clear();
1826 tmp_map_TopoDS_Vertex.Clear();
1829 for(TopTools_DataMapOfShapeShape::Iterator it_shell(map_TopoDS_Shell);it_shell.More();it_shell.Next())
1831 TopExp::MapShapes(it_shell.Value(),TopAbs_FACE, tmp_map_TopoDS_Face);
1832 TopExp::MapShapes(it_shell.Value(),TopAbs_WIRE, tmp_map_TopoDS_Wire);
1833 TopExp::MapShapes(it_shell.Value(),TopAbs_EDGE, tmp_map_TopoDS_Edge);
1834 TopExp::MapShapes(it_shell.Value(),TopAbs_VERTEX, tmp_map_TopoDS_Vertex);
1836 for(TopTools_IndexedMapOfShape::Iterator it_face(tmp_map_TopoDS_Face);it_face.More();it_face.Next())
1837 if(map_TopoDS_Face.IsBound(it_face.Value())) map_TopoDS_Face.UnBind(it_face.Value());
1838 for(TopTools_IndexedMapOfShape::Iterator it_wire(tmp_map_TopoDS_Wire);it_wire.More();it_wire.Next())
1839 if(map_TopoDS_Wire.IsBound(it_wire.Value())) map_TopoDS_Wire.UnBind(it_wire.Value());
1840 for(TopTools_IndexedMapOfShape::Iterator it_edge(tmp_map_TopoDS_Edge);it_edge.More();it_edge.Next())
1841 if(map_TopoDS_Edge.IsBound(it_edge.Value())) map_TopoDS_Edge.UnBind(it_edge.Value());
1842 for(TopTools_IndexedMapOfShape::Iterator it_vertex(tmp_map_TopoDS_Vertex);it_vertex.More();it_vertex.Next())
1843 if(map_TopoDS_Vertex.IsBound(it_vertex.Value())) map_TopoDS_Vertex.UnBind(it_vertex.Value());
1845 tmp_map_TopoDS_Face.Clear();
1846 tmp_map_TopoDS_Wire.Clear();
1847 tmp_map_TopoDS_Edge.Clear();
1848 tmp_map_TopoDS_Vertex.Clear();
1851 for(TopTools_DataMapOfShapeShape::Iterator it_face(map_TopoDS_Face);it_face.More();it_face.Next())
1853 TopExp::MapShapes(it_face.Value(),TopAbs_WIRE, tmp_map_TopoDS_Wire);
1854 TopExp::MapShapes(it_face.Value(),TopAbs_EDGE, tmp_map_TopoDS_Edge);
1855 TopExp::MapShapes(it_face.Value(),TopAbs_VERTEX, tmp_map_TopoDS_Vertex);
1857 for(TopTools_IndexedMapOfShape::Iterator it_wire(tmp_map_TopoDS_Wire);it_wire.More();it_wire.Next())
1858 if(map_TopoDS_Wire.IsBound(it_wire.Value())) map_TopoDS_Wire.UnBind(it_wire.Value());
1859 for(TopTools_IndexedMapOfShape::Iterator it_edge(tmp_map_TopoDS_Edge);it_edge.More();it_edge.Next())
1860 if(map_TopoDS_Edge.IsBound(it_edge.Value())) map_TopoDS_Edge.UnBind(it_edge.Value());
1861 for(TopTools_IndexedMapOfShape::Iterator it_vertex(tmp_map_TopoDS_Vertex);it_vertex.More();it_vertex.Next())
1862 if(map_TopoDS_Vertex.IsBound(it_vertex.Value())) map_TopoDS_Vertex.UnBind(it_vertex.Value());
1864 tmp_map_TopoDS_Wire.Clear();
1865 tmp_map_TopoDS_Edge.Clear();
1866 tmp_map_TopoDS_Vertex.Clear();
1869 for(TopTools_DataMapOfShapeShape::Iterator it_wire(map_TopoDS_Face);it_wire.More();it_wire.Next())
1871 TopExp::MapShapes(it_wire.Value(),TopAbs_EDGE, tmp_map_TopoDS_Edge);
1872 TopExp::MapShapes(it_wire.Value(),TopAbs_VERTEX, tmp_map_TopoDS_Vertex);
1874 for(TopTools_IndexedMapOfShape::Iterator it_edge(tmp_map_TopoDS_Edge);it_edge.More();it_edge.Next())
1875 if(map_TopoDS_Edge.IsBound(it_edge.Value())) map_TopoDS_Edge.UnBind(it_edge.Value());
1876 for(TopTools_IndexedMapOfShape::Iterator it_vertex(tmp_map_TopoDS_Vertex);it_vertex.More();it_vertex.Next())
1877 if(map_TopoDS_Vertex.IsBound(it_vertex.Value())) map_TopoDS_Vertex.UnBind(it_vertex.Value());
1879 tmp_map_TopoDS_Edge.Clear();
1880 tmp_map_TopoDS_Vertex.Clear();
1883 for(TopTools_DataMapOfShapeShape::Iterator it_edge(map_TopoDS_Edge);it_edge.More();it_edge.Next())
1885 TopExp::MapShapes(it_edge.Value(),TopAbs_VERTEX, tmp_map_TopoDS_Vertex);
1887 for(TopTools_IndexedMapOfShape::Iterator it_vertex(tmp_map_TopoDS_Vertex);it_vertex.More();it_vertex.Next())
1888 if(map_TopoDS_Vertex.IsBound(it_vertex.Value())) map_TopoDS_Vertex.UnBind(it_vertex.Value());
1890 tmp_map_TopoDS_Vertex.Clear();