1 |
francois |
283 |
//------------------------------------------------------------ |
2 |
|
|
//------------------------------------------------------------ |
3 |
|
|
// MAGiC |
4 |
|
|
// Jean Christophe Cuilli�re et Vincent FRANCOIS |
5 |
|
|
// D�partement de G�nie M�canique - UQTR |
6 |
|
|
//------------------------------------------------------------ |
7 |
|
|
// Le projet MAGIC est un projet de recherche du d�partement |
8 |
|
|
// de g�nie m�canique de l'Universit� du Qu�bec � |
9 |
|
|
// Trois Rivi�res |
10 |
|
|
// Les librairies ne peuvent �tre utilis�es sans l'accord |
11 |
|
|
// des auteurs (contact : francois@uqtr.ca) |
12 |
|
|
//------------------------------------------------------------ |
13 |
|
|
//------------------------------------------------------------ |
14 |
|
|
// |
15 |
|
|
// OCC_fonction1.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H22 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h" |
26 |
|
|
#ifdef BREP_OCC |
27 |
|
|
#pragma hdrstop |
28 |
|
|
|
29 |
|
|
|
30 |
couturad |
740 |
#include "occ_fonction.h" |
31 |
couturad |
814 |
|
32 |
francois |
283 |
//--------------------------------------------------------------------------- |
33 |
|
|
#pragma package(smart_init) |
34 |
|
|
//using namespace std; |
35 |
couturad |
740 |
OCC_FONCTION::OCC_FONCTION() |
36 |
francois |
283 |
{ |
37 |
|
|
} |
38 |
couturad |
740 |
|
39 |
|
|
OCC_FONCTION::~OCC_FONCTION() |
40 |
francois |
283 |
{ |
41 |
|
|
} |
42 |
couturad |
740 |
|
43 |
|
|
void OCC_FONCTION::OuvrirFichier(char* file ) //ouvrir un fichier .brep |
44 |
francois |
283 |
{ |
45 |
|
|
Standard_Boolean result=BRepTools::Read(ashape,file,abuilder); |
46 |
|
|
} |
47 |
couturad |
740 |
void OCC_FONCTION::OuvrirFichierStep(char* file)//ouvrir un fichier.step |
48 |
francois |
283 |
{ |
49 |
|
|
|
50 |
|
|
reader.ReadFile(file); |
51 |
|
|
reader.NbRootsForTransfer(); |
52 |
|
|
reader.TransferRoots(); |
53 |
|
|
ashape = reader.OneShape(); |
54 |
|
|
} |
55 |
|
|
|
56 |
couturad |
740 |
void OCC_FONCTION::Sauvegarder(char* file) |
57 |
francois |
283 |
{ |
58 |
|
|
Standard_Boolean result1=BRepTools::Write(ashape, file); |
59 |
|
|
} |
60 |
|
|
|
61 |
couturad |
740 |
int OCC_FONCTION::GetID(const TopoDS_Shape &shape) |
62 |
francois |
283 |
{ |
63 |
|
|
if (shape.IsNull()) return 0; |
64 |
couturad |
740 |
Standard_Integer index = myShapes.FindIndex(shape); |
65 |
francois |
283 |
if (index == 0) |
66 |
|
|
{ |
67 |
couturad |
740 |
for (TopoDS_Iterator its(shape,Standard_False,Standard_False);its.More(); its.Next()) |
68 |
francois |
283 |
GetID(its.Value()); |
69 |
couturad |
740 |
index = myShapes.Add(shape); |
70 |
francois |
283 |
} |
71 |
|
|
return index; |
72 |
couturad |
740 |
} |
73 |
francois |
283 |
|
74 |
couturad |
740 |
TopoDS_Shape& OCC_FONCTION::GetShapePrincipale(void) |
75 |
|
|
{ |
76 |
|
|
return ashape; |
77 |
|
|
} |
78 |
francois |
283 |
|
79 |
couturad |
740 |
const TopoDS_Shape& OCC_FONCTION::GetShape(const int id_shape) |
80 |
francois |
283 |
{ |
81 |
|
|
GetID(ashape); |
82 |
|
|
return myShapes(id_shape); |
83 |
|
|
} |
84 |
|
|
|
85 |
couturad |
814 |
void OCC_FONCTION::marquer_sommet_pole(MG_FACE* face, double precision) |
86 |
|
|
{ |
87 |
|
|
//printf("void OCC_FONCTION::marquer_sommet_pole(MG_FACE* face, double precision) : Non supportee dans cette version de OCC_FONCTION\n"); |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
|
91 |
francois |
283 |
#endif |