29 #include <BRepAlgoAPI_BuilderAlgo.hxx>
41 long unsigned int num,
44 long int id_mgcg_forme_inclusion_sortie,
49 mgcg_forme_inclusion_entree,
50 mgcg_forme_matrice_entree,
51 id_mgcg_forme_inclusion_sortie,
52 id_mgcg_forme_matrice_sortie)
71 std::cerr <<
"*** ERREUR : OCC_CG_OP_INCLUSION_MATRICE::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
82 bool importer_triangulation,
83 double epsilon_triangulation)
88 std::cerr <<
"*** ERREUR : OCC_CG_OP_INCLUSION_MATRICE::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
91 BRepAlgoAPI_BuilderAlgo brep_fragment;
92 TopTools_ListOfShape list_of_shape_arguments;
93 TopTools_ListOfShape list_of_shape_inclusion;
94 TopTools_ListOfShape list_of_shape_matrice;
99 brep_fragment.SetArguments(list_of_shape_arguments);
100 brep_fragment.Build();
101 if(!brep_fragment.IsDone())
103 std::cout <<
"*** ERREUR : OCC_CG_OP_INCLUSION_MATRICE::construire_forme -> ECHEC de BRepAlgoAPI_BuilderAlgo ***" << std::endl;
106 TopoDS_Shape shape_resultat = brep_fragment.Shape();
107 Bnd_Box box_inclusion;
109 TopTools_ListOfShape::Iterator it_shape;
110 for(it_shape.Init(list_of_shape_inclusion);it_shape.More();it_shape.Next())
112 BRepBndLib::AddOptimal(it_shape.Value(),box_inclusion,
false);
114 for(it_shape.Init(list_of_shape_matrice);it_shape.More();it_shape.Next())
116 BRepBndLib::AddOptimal(it_shape.Value(),box_matrice,
false);
120 BRep_Builder brep_builder;
121 TopoDS_Compound Compound_inclusion;
122 TopoDS_Compound Compound_matrice;
123 brep_builder.MakeCompound(Compound_inclusion);
124 brep_builder.MakeCompound(Compound_matrice);
125 if(shape_resultat.ShapeType()==TopAbs_COMPOUND)
127 TopTools_DataMapOfShapeShape map_TopoDS_Solid;
128 TopTools_DataMapOfShapeShape map_TopoDS_Shell;
129 TopTools_DataMapOfShapeShape map_TopoDS_Face;
130 TopTools_DataMapOfShapeShape map_TopoDS_Wire;
131 TopTools_DataMapOfShapeShape map_TopoDS_Edge;
132 TopTools_DataMapOfShapeShape map_TopoDS_Vertex;
140 TopTools_DataMapOfShapeShape::Iterator it_solid;
141 for(it_solid.Initialize(map_TopoDS_Solid);it_solid.More();it_solid.Next())
145 brep_builder.Add(Compound_inclusion,it_solid.Value());
147 else brep_builder.Add(Compound_matrice,it_solid.Value());
149 TopTools_DataMapOfShapeShape::Iterator it_shell;
150 for(it_shell.Initialize(map_TopoDS_Shell);it_shell.More();it_shell.Next())
154 brep_builder.Add(Compound_inclusion,it_shell.Value());
156 else brep_builder.Add(Compound_matrice,it_shell.Value());
158 TopTools_DataMapOfShapeShape::Iterator it_face;
159 for(it_face.Initialize(map_TopoDS_Face);it_face.More();it_face.Next())
163 brep_builder.Add(Compound_inclusion,it_face.Value());
165 else brep_builder.Add(Compound_matrice,it_face.Value());
167 TopTools_DataMapOfShapeShape::Iterator it_wire;
168 for(it_wire.Initialize(map_TopoDS_Wire);it_wire.More();it_wire.Next())
172 brep_builder.Add(Compound_inclusion,it_wire.Value());
174 else brep_builder.Add(Compound_matrice,it_wire.Value());
176 TopTools_DataMapOfShapeShape::Iterator it_edge;
177 for(it_edge.Initialize(map_TopoDS_Edge);it_edge.More();it_edge.Next())
181 brep_builder.Add(Compound_inclusion,it_edge.Value());
183 else brep_builder.Add(Compound_matrice,it_edge.Value());
185 TopTools_DataMapOfShapeShape::Iterator it_vertex;
186 for(it_vertex.Initialize(map_TopoDS_Vertex);it_vertex.More();it_vertex.Next())
190 brep_builder.Add(Compound_inclusion,it_vertex.Value());
192 else brep_builder.Add(Compound_matrice,it_vertex.Value());
195 else std::cout <<
"*** ERREUR : OCC_CG_OP_INCLUSION_MATRICE::construire_forme -> ShapeType!=TopAbs_COMPOUND ***" << std::endl;
200 fusionner_entite_similaire,
202 importer_triangulation,
203 epsilon_triangulation);
211 fusionner_entite_similaire,
213 importer_triangulation,
214 epsilon_triangulation);
220 change_etat(MG_CG_OPERATEUR::ETAT_OPERATEUR::CONSTRUIT);
227 BRepBndLib::AddOptimal(shape_objet,box_objet,
false);
228 double x0_obj,y0_obj,z0_obj,x1_obj,y1_obj,z1_obj;
229 double x0_comp,y0_comp,z0_comp,x1_comp,y1_comp,z1_comp;
230 box_objet.Get(x0_obj,y0_obj,z0_obj,x1_obj,y1_obj,z1_obj);
231 box_comparateur.Get(x0_comp,y0_comp,z0_comp,x1_comp,y1_comp,z1_comp);
232 if((x0_obj>=(x0_comp-precision)) && (x1_obj<=(x1_comp+precision)))
233 if((y0_obj>=(y0_comp-precision)) && (y1_obj<=(y1_comp+precision)))
234 if((z0_obj>=(z0_comp-precision)) && (z1_obj<=(z1_comp+precision)))