1 |
francois |
1158 |
//####//------------------------------------------------------------ |
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_fonction.cpp |
15 |
|
|
//####// |
16 |
|
|
//####//------------------------------------------------------------ |
17 |
|
|
//####//------------------------------------------------------------ |
18 |
|
|
//####// COPYRIGHT 2000-2024 |
19 |
|
|
//####// jeu 13 jun 2024 11:58:55 EDT |
20 |
|
|
//####//------------------------------------------------------------ |
21 |
|
|
//####//------------------------------------------------------------ |
22 |
francois |
283 |
|
23 |
|
|
|
24 |
|
|
#include "gestionversion.h" |
25 |
|
|
#ifdef BREP_OCC |
26 |
|
|
#pragma hdrstop |
27 |
|
|
|
28 |
|
|
|
29 |
couturad |
740 |
#include "occ_fonction.h" |
30 |
couturad |
814 |
|
31 |
francois |
283 |
#pragma package(smart_init) |
32 |
couturad |
740 |
OCC_FONCTION::OCC_FONCTION() |
33 |
francois |
283 |
{ |
34 |
|
|
} |
35 |
couturad |
740 |
|
36 |
|
|
OCC_FONCTION::~OCC_FONCTION() |
37 |
francois |
283 |
{ |
38 |
|
|
} |
39 |
couturad |
740 |
|
40 |
|
|
void OCC_FONCTION::OuvrirFichier(char* file ) //ouvrir un fichier .brep |
41 |
francois |
283 |
{ |
42 |
|
|
Standard_Boolean result=BRepTools::Read(ashape,file,abuilder); |
43 |
|
|
} |
44 |
couturad |
740 |
void OCC_FONCTION::OuvrirFichierStep(char* file)//ouvrir un fichier.step |
45 |
francois |
283 |
{ |
46 |
|
|
|
47 |
|
|
reader.ReadFile(file); |
48 |
|
|
reader.NbRootsForTransfer(); |
49 |
|
|
reader.TransferRoots(); |
50 |
|
|
ashape = reader.OneShape(); |
51 |
couturad |
919 |
|
52 |
francois |
283 |
} |
53 |
|
|
|
54 |
couturad |
740 |
void OCC_FONCTION::Sauvegarder(char* file) |
55 |
francois |
283 |
{ |
56 |
|
|
Standard_Boolean result1=BRepTools::Write(ashape, file); |
57 |
|
|
} |
58 |
|
|
|
59 |
couturad |
740 |
int OCC_FONCTION::GetID(const TopoDS_Shape &shape) |
60 |
francois |
283 |
{ |
61 |
|
|
if (shape.IsNull()) return 0; |
62 |
couturad |
740 |
Standard_Integer index = myShapes.FindIndex(shape); |
63 |
francois |
283 |
if (index == 0) |
64 |
|
|
{ |
65 |
couturad |
740 |
for (TopoDS_Iterator its(shape,Standard_False,Standard_False);its.More(); its.Next()) |
66 |
francois |
283 |
GetID(its.Value()); |
67 |
couturad |
740 |
index = myShapes.Add(shape); |
68 |
francois |
283 |
} |
69 |
|
|
return index; |
70 |
couturad |
740 |
} |
71 |
francois |
283 |
|
72 |
couturad |
740 |
TopoDS_Shape& OCC_FONCTION::GetShapePrincipale(void) |
73 |
|
|
{ |
74 |
|
|
return ashape; |
75 |
|
|
} |
76 |
francois |
283 |
|
77 |
couturad |
740 |
const TopoDS_Shape& OCC_FONCTION::GetShape(const int id_shape) |
78 |
francois |
283 |
{ |
79 |
|
|
GetID(ashape); |
80 |
|
|
return myShapes(id_shape); |
81 |
|
|
} |
82 |
|
|
|
83 |
couturad |
814 |
void OCC_FONCTION::marquer_sommet_pole(MG_FACE* face, double precision) |
84 |
|
|
{ |
85 |
|
|
//printf("void OCC_FONCTION::marquer_sommet_pole(MG_FACE* face, double precision) : Non supportee dans cette version de OCC_FONCTION\n"); |
86 |
|
|
} |
87 |
|
|
|
88 |
couturad |
906 |
std::string OCC_FONCTION::get_version(void) |
89 |
|
|
{ |
90 |
|
|
return "OCCV0"; |
91 |
|
|
} |
92 |
couturad |
814 |
|
93 |
francois |
1025 |
void OCC_FONCTION::change_precision(double val) |
94 |
|
|
{ |
95 |
|
|
precision=val; |
96 |
|
|
} |
97 |
couturad |
906 |
|
98 |
francois |
1025 |
|
99 |
|
|
double OCC_FONCTION::get_precision(void) |
100 |
|
|
{ |
101 |
|
|
return precision; |
102 |
|
|
} |
103 |
|
|
|
104 |
|
|
|
105 |
francois |
283 |
#endif |