MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
occ_cg_op_transf_echelle.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_echelle.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 "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>
33 
35  int semantique,
36  MG_CG_FORME* mgcg_forme_entree): MG_CG_OP_TRANSF_ECHELLE(mgcg_modele,semantique, mgcg_forme_entree)
37 {
38 
39 }
40 
42  int semantique,
43  int etat,
44  long unsigned int num,
45  MG_CG_FORME* mgcg_forme_entree,
46  long int id_mgcg_forme_sortie): MG_CG_OP_TRANSF_ECHELLE(mgcg_modele,semantique,etat,num,mgcg_forme_entree,id_mgcg_forme_sortie)
47 {
48 
49 }
50 
52 {
53 
54 }
55 
57 {
58 
59 }
60 
62 {
63  if(m_mgcg_modele==NULL)
64  {
65  std::cout << "*** ERREUR : OCC_CG_OP_TRANSF_ECHELLE::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
66  return FAIL;
67  }
72 }
73 
74 int OCC_CG_OP_TRANSF_ECHELLE::construire(bool fusionner_entite_similaire, double precision, bool importer_triangulation, double epsilon_triangulation)
75 {
76  if(m_mgcg_modele==NULL)
77  {
78  std::cout << "*** ERREUR : OCC_CG_OP_TRANSF_ECHELLE::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
79  return FAIL;
80  }
81  TopTools_ListOfShape list_of_shape;
83  BRep_Builder brep_builder;
84  TopoDS_Compound Compound_forme_entree;
85  brep_builder.MakeCompound(Compound_forme_entree);
86  TopTools_ListOfShape::Iterator it_shape;
87  for(it_shape.Init(list_of_shape);it_shape.More();it_shape.Next())
88  {
89  brep_builder.Add(Compound_forme_entree,it_shape.Value());
90  }
91  gp_Trsf transformation;
92  transformation.SetScale(gp_Pnt(m_centre_echelle[0],m_centre_echelle[1],m_centre_echelle[2]),m_facteur_echelle);
93  BRepBuilderAPI_Transform brep_transform(transformation);
94  brep_transform.Perform(Compound_forme_entree,true);
95  if(!brep_transform.IsDone())
96  {
97  std::cout << "*** ERREUR : OCC_CG_OP_TRANSF_ECHELLE::construire_forme -> ECHEC de BRepBuilderAPI_Transform ***" << std::endl;
98  return FAIL;
99  }
100  TopoDS_Shape shape_resultat = brep_transform.Shape();
103  shape_resultat,
104  occ_fonction,
106  fusionner_entite_similaire,
107  precision,
108  importer_triangulation,
109  epsilon_triangulation);
110  m_mgcg_modele->ajouter_mgcg_forme(forme_resultat);
111  change_mgcg_forme_sortie(forme_resultat);
114  change_etat(MG_CG_OPERATEUR::ETAT_OPERATEUR::CONSTRUIT);
115  return OK;
116 }
117 
118 
119 #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_ECHELLE(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