MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
occ_cg_op_bool_fragment.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_fragment.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:54 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_BuilderAlgo.hxx>
36 
38  int semantique,
39  MG_CG_FORME* mgcg_forme_entree_1,
40  MG_CG_FORME* mgcg_forme_entree_2): MG_CG_OP_BOOL_FRAGMENT(mgcg_modele,semantique,mgcg_forme_entree_1,mgcg_forme_entree_2)
41 {
42 
43 }
44 
46  int semantique,
47  int etat,
48  long unsigned int num,
49  MG_CG_FORME* mgcg_forme_entree_1,
50  MG_CG_FORME* mgcg_forme_entree_2,
51  long int id_mgcg_forme_sortie): MG_CG_OP_BOOL_FRAGMENT(mgcg_modele,semantique,etat,num,mgcg_forme_entree_1,mgcg_forme_entree_2,id_mgcg_forme_sortie)
52 {
53 }
54 
56 {
57 }
58 
60 {
61 }
62 
64 {
65  if(m_mgcg_modele==NULL)
66  {
67  std::cout << "*** ERREUR : OCC_CG_OP_BOOL_FRAGMENT::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
68  return FAIL;
69  }
74 }
75 
76 int OCC_CG_OP_BOOL_FRAGMENT::construire(bool fusionner_entite_similaire,
77  double precision,
78  bool importer_triangulation,
79  double epsilon_triangulation)
80 {
81  if(m_mgcg_modele==NULL)
82  {
83  std::cout << "*** ERREUR : OCC_CG_OP_BOOL_FRAGMENT::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
84  return FAIL;
85  }
86  BRepAlgoAPI_BuilderAlgo brep_fragment;
87  TopTools_ListOfShape list_of_shape_arguments;
90  brep_fragment.SetArguments(list_of_shape_arguments);
91  brep_fragment.Build();
92  if(!brep_fragment.IsDone())
93  {
94  std::cout << "*** ERREUR : OCC_CG_OP_BOOL_FRAGMENT::construire_forme -> ECHEC de BRepAlgoAPI_BuilderAlgo ***" << std::endl;
95  return FAIL;
96  }
97  TopoDS_Shape shape_resultat = brep_fragment.Shape();
100  shape_resultat,
101  occ_fonction,
103  fusionner_entite_similaire,
104  precision,
105  importer_triangulation,
106  epsilon_triangulation);
107  m_mgcg_modele->ajouter_mgcg_forme(forme_resultat);
108  change_mgcg_forme_sortie(forme_resultat);
111  change_etat(MG_CG_OPERATEUR::ETAT_OPERATEUR::CONSTRUIT);
112  return OK;
113 }
114 #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_FRAGMENT(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