MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
occ_cg_op_bool_difference.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// occ_cg_op_bool_difference.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:55 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #ifdef ALL_OCC
24 #include "mg_definition.h"
25 #include "mg_cg_modele.h"
26 #include "mg_cg_forme.h"
27 #include "mg_cg_forme_volume.h"
28 
29 #include "mg_volume.h"
30 
31 #include "occ_ot_cg.h"
32 #include "occ_fonction_v2017.h"
33 #include "occ_volume.h"
34 
35 #include <BRepAlgoAPI_Cut.hxx>
36 
37 
39  int semantique,
40  MG_CG_FORME* mgcg_forme_entree_1,
41  MG_CG_FORME* mgcg_forme_entree_2): MG_CG_OP_BOOL_DIFFERENCE(mgcg_modele,semantique,mgcg_forme_entree_1,mgcg_forme_entree_2)
42 {
43 
44 }
45 
47  int semantique,
48  int etat,
49  long unsigned int num,
50  MG_CG_FORME* mgcg_forme_entree_1,
51  MG_CG_FORME* mgcg_forme_entree_2,
52  long int id_mgcg_forme_sortie): MG_CG_OP_BOOL_DIFFERENCE(mgcg_modele,semantique,etat,num,mgcg_forme_entree_1,mgcg_forme_entree_2,id_mgcg_forme_sortie)
53 {
54 
55 }
56 
57 
59 {
60 
61 }
62 
63 
65 {
66 
67 }
68 
70 {
71  if(m_mgcg_modele==NULL)
72  {
73  std::cout << "*** ERREUR : OCC_CG_OP_BOOL_DIFFERENCE::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
74  return FAIL;
75  }
80 }
81 
82 int OCC_CG_OP_BOOL_DIFFERENCE::construire(bool fusionner_entite_similaire,
83  double precision,
84  bool importer_triangulation,
85  double epsilon_triangulation)
86 {
87  if(m_mgcg_modele==NULL)
88  {
89  std::cout << "*** ERREUR : OCC_CG_OP_BOOL_DIFFERENCE::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
90  return FAIL;
91  }
92  BRepAlgoAPI_Cut brep_cut;
93  TopTools_ListOfShape list_of_shape_arguments;
95  brep_cut.SetArguments(list_of_shape_arguments);
96  TopTools_ListOfShape list_of_shape_tools;
98  brep_cut.SetTools(list_of_shape_tools);
99  brep_cut.Build();
100  if(!brep_cut.IsDone())
101  {
102  std::cout << "*** ERREUR : OCC_CG_OP_BOOL_DIFFERENCE::construire_forme -> ECHEC de BRepAlgoAPI_Cut ***" << std::endl;
103  return FAIL;
104  }
105  TopoDS_Shape shape_resultat = brep_cut.Shape();
108  shape_resultat,
109  occ_fonction,
111  fusionner_entite_similaire,
112  precision,
113  importer_triangulation,
114  epsilon_triangulation);
115  m_mgcg_modele->ajouter_mgcg_forme(forme_resultat);
116  change_mgcg_forme_sortie(forme_resultat);
119  change_etat(MG_CG_OPERATEUR::ETAT_OPERATEUR::CONSTRUIT);
120  return OK;
121 }
122 #endif
virtual void change_mgcg_operateur_parent(MG_CG_OPERATEUR *mgcg_operateur)
Definition: mg_cg_forme.cpp:91
virtual bool get_importer_triangulation(void)
virtual int ajouter_mgcg_forme(MG_CG_FORME *mgcg_forme)
virtual double get_precision(void)
virtual bool get_fusionner_entite_similaire(void)
virtual MG_GEOMETRIE * get_mg_geometrie(void)
virtual void mise_a_jout_lien_mg_element_mgcg_forme(MG_CG_FORME *mgcg_forme)
virtual double get_epsilon_triangulation(void)
virtual MG_CG_FORME * get_mgcg_forme_entree_1(void)
virtual MG_CG_FORME * get_mgcg_forme_entree_2(void)
virtual MG_CG_FORME * get_mgcg_forme_sortie(void)
virtual int change_mgcg_forme_sortie(MG_CG_FORME *mgcg_forme)
MG_CG_MODELE * m_mgcg_modele
virtual void change_etat(int etat_operateur)
class OCC_FONCTION & get_occ_fonction(void)
OCC_CG_OP_BOOL_DIFFERENCE(MG_CG_MODELE *mgcg_modele, int semantique, MG_CG_FORME *mgcg_forme_entree_1, MG_CG_FORME *mgcg_forme_entree_2)
static void get_listofTopoDS_Shape(std::map< MG_CG_FORME *, MG_CG_FORME * > *map_forme, TopTools_ListOfShape &listofshape)
Definition: occ_ot_cg.cpp:538
static MG_CG_FORME * creer_MG_CG_FORME(MG_CG_MODELE *mgcg_modele, TopoDS_Shape topods_shape, OCC_FONCTION *occ_fonction, MG_GEOMETRIE *mg_geometrie, bool fusionner_entite_similaire=false, double precision=1e-6, bool importer_triangulation=false, double epsilon_triangulation=1.)
Definition: occ_ot_cg.cpp:34
const int OK
Definition: mg_definition.h:38
const int FAIL
Definition: mg_definition.h:39