MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
occ_cg_op_transf_translation.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_transf_translation.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:53 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #ifdef ALL_OCC
24 #include "occ_ot_cg.h"
25 #include "mg_definition.h"
26 #include "mg_cg_modele.h"
27 #include "mg_geometrie.h"
28 #include "mg_cg_forme.h"
29 #include <BRepBuilderAPI_Transform.hxx>
30 #include <gp_Trsf.hxx>
31 #include <BRep_Builder.hxx>
32 #include <gp_Vec.hxx>
34  int semantique,
35  MG_CG_FORME* mgcg_forme_entree): MG_CG_OP_TRANSF_TRANSLATION(mgcg_modele,semantique, mgcg_forme_entree)
36 {
37 
38 }
39 
41  int semantique,
42  int etat,
43  long unsigned int num,
44  MG_CG_FORME* mgcg_forme_entree,
45  long int id_mgcg_forme_sortie): MG_CG_OP_TRANSF_TRANSLATION(mgcg_modele,semantique,etat,num,mgcg_forme_entree,id_mgcg_forme_sortie)
46 {
47 
48 }
49 
51 {
52 
53 }
54 
56 {
57 
58 }
59 
61 {
62  if(m_mgcg_modele==NULL)
63  {
64  std::cout << "*** ERREUR : OCC_CG_OP_TRANSF_TRANSLATION::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
65  return FAIL;
66  }
71 }
72 
73 int OCC_CG_OP_TRANSF_TRANSLATION::construire(bool fusionner_entite_similaire, double precision, bool importer_triangulation, double epsilon_triangulation)
74 {
75  if(m_mgcg_modele==NULL)
76  {
77  std::cout << "*** ERREUR : OCC_CG_OP_TRANSF_TRANSLATION::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
78  return FAIL;
79  }
80  TopTools_ListOfShape list_of_shape;
82  BRep_Builder brep_builder;
83  TopoDS_Compound Compound_forme_entree;
84  brep_builder.MakeCompound(Compound_forme_entree);
85  TopTools_ListOfShape::Iterator it_shape;
86  for(it_shape.Init(list_of_shape);it_shape.More();it_shape.Next())
87  {
88  brep_builder.Add(Compound_forme_entree,it_shape.Value());
89  }
90  gp_Trsf transformation;
91  transformation.SetTranslation(gp_Vec(m_vecteur_translation[0],m_vecteur_translation[1],m_vecteur_translation[2]));
92  BRepBuilderAPI_Transform brep_transform(transformation);
93  brep_transform.Perform(Compound_forme_entree,true);
94  if(!brep_transform.IsDone())
95  {
96  std::cout << "*** ERREUR : OCC_CG_OP_TRANSF_TRANSLATION::construire_forme -> ECHEC de BRepBuilderAPI_Transform ***" << std::endl;
97  return FAIL;
98  }
99  TopoDS_Shape shape_resultat = brep_transform.Shape();
102  shape_resultat,
103  occ_fonction,
105  fusionner_entite_similaire,
106  precision,
107  importer_triangulation,
108  epsilon_triangulation);
109  m_mgcg_modele->ajouter_mgcg_forme(forme_resultat);
110  change_mgcg_forme_sortie(forme_resultat);
113  change_etat(MG_CG_OPERATEUR::ETAT_OPERATEUR::CONSTRUIT);
114  return OK;
115 }
116 
117 
118 #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 int change_mgcg_forme_sortie(MG_CG_FORME *mgcg_forme)
virtual MG_CG_FORME * get_mgcg_forme_entree(void)
virtual MG_CG_FORME * get_mgcg_forme_sortie(void)
MG_CG_MODELE * m_mgcg_modele
virtual void change_etat(int etat_operateur)
class OCC_FONCTION & get_occ_fonction(void)
OCC_CG_OP_TRANSF_TRANSLATION(MG_CG_MODELE *mgcg_modele, int semantique, MG_CG_FORME *mgcg_forme_entree)
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