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 |
francois |
283 |
//--------------------------------------------------------------------------- |
32 |
|
|
#pragma package(smart_init) |
33 |
|
|
//using namespace std; |
34 |
couturad |
740 |
OCC_FONCTION::OCC_FONCTION() |
35 |
francois |
283 |
{ |
36 |
|
|
} |
37 |
couturad |
740 |
|
38 |
|
|
OCC_FONCTION::~OCC_FONCTION() |
39 |
francois |
283 |
{ |
40 |
|
|
} |
41 |
couturad |
740 |
|
42 |
|
|
void OCC_FONCTION::OuvrirFichier(char* file ) //ouvrir un fichier .brep |
43 |
francois |
283 |
{ |
44 |
|
|
Standard_Boolean result=BRepTools::Read(ashape,file,abuilder); |
45 |
|
|
} |
46 |
couturad |
740 |
void OCC_FONCTION::OuvrirFichierStep(char* file)//ouvrir un fichier.step |
47 |
francois |
283 |
{ |
48 |
|
|
|
49 |
|
|
reader.ReadFile(file); |
50 |
|
|
reader.NbRootsForTransfer(); |
51 |
|
|
reader.TransferRoots(); |
52 |
|
|
ashape = reader.OneShape(); |
53 |
|
|
} |
54 |
|
|
|
55 |
couturad |
740 |
void OCC_FONCTION::Sauvegarder(char* file) |
56 |
francois |
283 |
{ |
57 |
|
|
Standard_Boolean result1=BRepTools::Write(ashape, file); |
58 |
|
|
} |
59 |
|
|
|
60 |
couturad |
740 |
int OCC_FONCTION::GetID(const TopoDS_Shape &shape) |
61 |
francois |
283 |
{ |
62 |
|
|
if (shape.IsNull()) return 0; |
63 |
couturad |
740 |
Standard_Integer index = myShapes.FindIndex(shape); |
64 |
francois |
283 |
if (index == 0) |
65 |
|
|
{ |
66 |
couturad |
740 |
for (TopoDS_Iterator its(shape,Standard_False,Standard_False);its.More(); its.Next()) |
67 |
francois |
283 |
GetID(its.Value()); |
68 |
couturad |
740 |
index = myShapes.Add(shape); |
69 |
francois |
283 |
} |
70 |
|
|
return index; |
71 |
couturad |
740 |
} |
72 |
francois |
283 |
|
73 |
couturad |
740 |
TopoDS_Shape& OCC_FONCTION::GetShapePrincipale(void) |
74 |
|
|
{ |
75 |
|
|
return ashape; |
76 |
|
|
} |
77 |
francois |
283 |
|
78 |
couturad |
740 |
const TopoDS_Shape& OCC_FONCTION::GetShape(const int id_shape) |
79 |
francois |
283 |
{ |
80 |
|
|
GetID(ashape); |
81 |
|
|
return myShapes(id_shape); |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
#endif |