1 |
louhichi |
211 |
//---------------------------------------------------------------------------
|
2 |
|
5 |
#include "gestionversion.h"
|
3 |
louhichi |
211 |
#ifdef BREP_OCC
|
4 |
|
5 |
|
5 |
|
|
#pragma hdrstop
|
6 |
|
|
|
7 |
francois |
481 |
#include "occ_fonction.h"
|
8 |
|
5 |
#include "tpl_map_entite.h"
|
9 |
|
|
|
10 |
louhichi |
211 |
|
11 |
|
5 |
//---------------------------------------------------------------------------
|
12 |
|
|
|
13 |
|
|
#pragma package(smart_init)
|
14 |
|
|
|
15 |
louhichi |
211 |
|
16 |
|
|
|
17 |
|
5 |
OCC_FONCTION::OCC_FONCTION()
|
18 |
|
|
{
|
19 |
louhichi |
211 |
|
20 |
|
5 |
}
|
21 |
|
|
|
22 |
|
|
OCC_FONCTION::~OCC_FONCTION()
|
23 |
|
|
{
|
24 |
|
|
}
|
25 |
francois |
38 |
|
26 |
louhichi |
211 |
|
27 |
|
|
//********************************** Classe Reconstruction generale ************
|
28 |
|
5 |
int OCC_FONCTION::Creer_Coquille()
|
29 |
|
|
{
|
30 |
louhichi |
211 |
B.MakeShell(Sh);
|
31 |
souaissa |
116 |
return true;
|
32 |
louhichi |
211 |
|
33 |
|
5 |
}
|
34 |
|
|
int OCC_FONCTION::Ajouter_face_Coquille()
|
35 |
|
|
{
|
36 |
louhichi |
211 |
B.Add(Sh,F1);
|
37 |
souaissa |
116 |
return true;
|
38 |
|
5 |
}
|
39 |
louhichi |
211 |
int OCC_FONCTION::Enregistrer(char* fich)
|
40 |
|
5 |
{
|
41 |
louhichi |
211 |
TopoDS_Solid Sol;
|
42 |
|
|
B.MakeSolid(Sol);
|
43 |
|
|
B.Add(Sol,Sh);
|
44 |
|
|
STEPControl_Writer writer;
|
45 |
|
|
writer.Transfer(Sol, STEPControl_ManifoldSolidBrep);
|
46 |
|
|
writer.Write(fich);
|
47 |
souaissa |
116 |
return true;
|
48 |
louhichi |
211 |
}
|
49 |
souaissa |
116 |
|
50 |
louhichi |
211 |
//************************************ Classe Face Plane ***********************
|
51 |
|
|
|
52 |
|
|
|
53 |
souaissa |
116 |
int OCC_FONCTION::Ajouter_Contour_Face(int num_loop)
|
54 |
|
5 |
{
|
55 |
louhichi |
211 |
TopoDS_Wire W11 = W1;
|
56 |
souaissa |
116 |
if (num_loop==0)
|
57 |
|
|
{
|
58 |
|
|
//W11.Reverse();
|
59 |
francois |
547 |
const Handle_Geom_Surface Surf=Surf1;
|
60 |
|
|
F1 = BRepBuilderAPI_MakeFace(Surf,W11,Standard_True);
|
61 |
louhichi |
211 |
|
62 |
francois |
549 |
#if (OCC_VERSION_MAJOR >= 6) && (OCC_VERSION_MINOR >= 7)
|
63 |
francois |
547 |
BRepBuilderAPI_MakeFace F3(Surf,1e-6);
|
64 |
|
|
F3.Init(Surf,Standard_False,1e-6);
|
65 |
francois |
548 |
#else
|
66 |
|
|
BRepBuilderAPI_MakeFace F3(Surf);
|
67 |
|
|
F3.Init(Surf,Standard_False);
|
68 |
|
|
#endif
|
69 |
souaissa |
116 |
F3.Add(W11);
|
70 |
|
|
|
71 |
louhichi |
211 |
F1 = F3;
|
72 |
|
|
|
73 |
souaissa |
116 |
Face_Revol = F3.IsDone();
|
74 |
|
|
}
|
75 |
|
|
if(num_loop > 0)
|
76 |
|
|
{
|
77 |
francois |
549 |
#if (OCC_VERSION_MAJOR >= 6) && (OCC_VERSION_MINOR >= 7)
|
78 |
francois |
547 |
BRepBuilderAPI_MakeFace F2(Surf1,1e-6);
|
79 |
|
|
F2.Init(Surf1,Standard_False,1e-6);
|
80 |
francois |
548 |
#else
|
81 |
|
|
BRepBuilderAPI_MakeFace F2(Surf1);
|
82 |
|
|
F2.Init(Surf1,Standard_False);
|
83 |
|
|
#endif
|
84 |
souaissa |
116 |
F2.Add(W11);
|
85 |
louhichi |
211 |
|
86 |
souaissa |
116 |
if(F2.IsDone())
|
87 |
|
|
{
|
88 |
|
|
W11.Reverse();
|
89 |
|
|
}
|
90 |
louhichi |
211 |
F1 = BRepBuilderAPI_MakeFace(F1,W11);
|
91 |
|
|
}
|
92 |
souaissa |
116 |
return true;
|
93 |
|
5 |
}
|
94 |
|
|
|
95 |
|
|
|
96 |
louhichi |
211 |
|
97 |
|
|
//************************************* Classe Face Cylindrique ****************
|
98 |
|
|
|
99 |
|
|
int OCC_FONCTION::Creer_Surface_Cylindrique(double Pnt_Insersion[], double Vect_Directeur[], double Rayon)
|
100 |
|
5 |
{
|
101 |
souaissa |
116 |
gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
|
102 |
|
|
gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
|
103 |
|
|
|
104 |
louhichi |
211 |
gp_Ax3 Axe(Pnt,Vect);
|
105 |
souaissa |
116 |
|
106 |
louhichi |
211 |
Surf1 = new Geom_CylindricalSurface(gp_Cylinder(Axe, Rayon));
|
107 |
souaissa |
116 |
return true;
|
108 |
|
5 |
}
|
109 |
louhichi |
211 |
|
110 |
|
|
//************************************* Classe Face Conique ********************
|
111 |
|
|
|
112 |
|
5 |
int OCC_FONCTION::Creer_Surface_Conique(double Pnt_Insersion[3], double Vect_Directeur[3],double Rayon, double Angle)
|
113 |
|
|
{
|
114 |
souaissa |
116 |
gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
|
115 |
|
|
gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
|
116 |
|
|
|
117 |
|
|
gp_Ax3 Axe(Pnt,Vect);
|
118 |
|
|
|
119 |
louhichi |
211 |
Surf1 = new Geom_ConicalSurface(Axe,Angle,Rayon);
|
120 |
souaissa |
116 |
return true;
|
121 |
louhichi |
211 |
}
|
122 |
souaissa |
116 |
|
123 |
louhichi |
211 |
|
124 |
|
|
//************************************ Classe Tore *****************************
|
125 |
|
|
|
126 |
|
5 |
int OCC_FONCTION::Creer_Surface_Torique(double Pnt_Insersion[], double Vect_Directeur[], double GRayon, double PRayon)
|
127 |
|
|
{
|
128 |
souaissa |
116 |
gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
|
129 |
|
|
gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
|
130 |
|
|
|
131 |
|
|
gp_Ax3 Axe(Pnt,Vect);
|
132 |
|
|
|
133 |
louhichi |
211 |
Surf1 = new Geom_ToroidalSurface(Axe,GRayon,PRayon);
|
134 |
souaissa |
116 |
return true;
|
135 |
|
5 |
}
|
136 |
louhichi |
211 |
|
137 |
|
|
//*********************************** Classe Spherique *************************
|
138 |
|
|
|
139 |
|
5 |
int OCC_FONCTION::Creer_Surf_Spherique(double Pnt_Insersion[], double Vect_Directeur[], double Rayon)
|
140 |
|
|
{
|
141 |
souaissa |
116 |
gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
|
142 |
|
|
gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
|
143 |
|
|
|
144 |
|
|
gp_Ax3 Axe(Pnt,Vect);
|
145 |
|
|
|
146 |
louhichi |
211 |
Surf1 = new Geom_SphericalSurface(Axe,Rayon);
|
147 |
souaissa |
116 |
return true;
|
148 |
|
5 |
}
|
149 |
louhichi |
211 |
|
150 |
|
|
|
151 |
|
|
//*********************************** Classe Face NURBS ************************
|
152 |
|
|
|
153 |
|
5 |
int OCC_FONCTION::Initialiser_Surface()
|
154 |
|
|
{
|
155 |
louhichi |
211 |
BPSurf = GeomPlate_BuildPlateSurface(3,10,3);
|
156 |
souaissa |
116 |
return true;
|
157 |
|
5 |
}
|
158 |
louhichi |
211 |
int OCC_FONCTION::Rapprocher_Surface_Point(double x, double y, double z)
|
159 |
|
5 |
{
|
160 |
louhichi |
211 |
gp_Pnt P(x,y,z);
|
161 |
souaissa |
116 |
Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(P,0);
|
162 |
louhichi |
211 |
BPSurf.Add(PCont);
|
163 |
souaissa |
116 |
|
164 |
|
|
return true;
|
165 |
|
5 |
}
|
166 |
|
|
int OCC_FONCTION::Calculer_Surface()
|
167 |
|
|
{
|
168 |
louhichi |
211 |
BPSurf.Perform();
|
169 |
|
|
return true;
|
170 |
|
5 |
}
|
171 |
|
|
int OCC_FONCTION::Determiner_Surface()
|
172 |
|
|
{
|
173 |
louhichi |
211 |
Standard_Integer MaxSeg = 50;
|
174 |
souaissa |
116 |
Standard_Integer MaxDegree=8;
|
175 |
|
|
Standard_Integer CritOrder=4;
|
176 |
|
|
Standard_Real dmax,Tol;
|
177 |
|
|
Handle(GeomPlate_Surface) PSurf1 = BPSurf.Surface();
|
178 |
|
|
dmax = Max(0.0001,10*BPSurf.G0Error());
|
179 |
|
|
Tol=0.0;
|
180 |
|
|
GeomPlate_MakeApprox Mapp1(PSurf1,Tol,MaxSeg,MaxDegree,dmax,0);
|
181 |
louhichi |
211 |
Surf1 = Mapp1.Surface();
|
182 |
souaissa |
116 |
return true;
|
183 |
|
5 |
}
|
184 |
souaissa |
116 |
|
185 |
louhichi |
211 |
|
186 |
|
5 |
//******************************************************************************
|
187 |
louhichi |
211 |
|
188 |
|
|
|
189 |
souaissa |
116 |
TColgp_Array1OfPnt Array(1,1000);
|
190 |
louhichi |
211 |
|
191 |
|
|
int OCC_FONCTION::Ajouter_Point_Courbe(double x, double y, double z, int i)
|
192 |
|
5 |
{
|
193 |
louhichi |
211 |
Array.SetValue(i,gp_Pnt(x,y,z));
|
194 |
souaissa |
116 |
return true;
|
195 |
|
5 |
}
|
196 |
souaissa |
116 |
|
197 |
louhichi |
211 |
|
198 |
|
|
|
199 |
souaissa |
116 |
TColGeom_Array1OfBSplineCurve ArrayCurve(1,4);
|
200 |
louhichi |
211 |
|
201 |
|
|
int OCC_FONCTION::Ajouter_courbe_liste(int nbpts,int num)
|
202 |
|
5 |
{
|
203 |
louhichi |
211 |
TColgp_Array1OfPnt Array00(1,nbpts);
|
204 |
|
|
|
205 |
|
|
for(int ii = 1; ii<=nbpts;ii++)
|
206 |
souaissa |
116 |
{
|
207 |
|
|
Array00.SetValue(ii,Array(ii));
|
208 |
|
|
}
|
209 |
|
|
|
210 |
francois |
314 |
Handle(Geom_BSplineCurve) SPL0 = GeomAPI_PointsToBSpline(Array00,3,8,GeomAbs_C1,0.).Curve();
|
211 |
souaissa |
116 |
ArrayCurve.SetValue(num,SPL0);
|
212 |
|
|
|
213 |
|
|
return true;
|
214 |
|
5 |
}
|
215 |
louhichi |
211 |
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
int OCC_FONCTION::Construire_Surface_Contour(int nb_aretes_ext)
|
219 |
|
5 |
{
|
220 |
louhichi |
211 |
if(nb_aretes_ext ==3)
|
221 |
souaissa |
116 |
{
|
222 |
|
|
Handle(GeomAdaptor_HCurve) SPL1Adaptor = new GeomAdaptor_HCurve(ArrayCurve(1));
|
223 |
louhichi |
211 |
Handle(GeomFill_SimpleBound) B1 = new GeomFill_SimpleBound(SPL1Adaptor,Precision::Approximation(),Precision::Angular());
|
224 |
souaissa |
116 |
Handle(GeomAdaptor_HCurve) SPL2Adaptor = new GeomAdaptor_HCurve(ArrayCurve(2));
|
225 |
louhichi |
211 |
Handle(GeomFill_SimpleBound) B2 = new GeomFill_SimpleBound(SPL2Adaptor,Precision::Approximation(),Precision::Angular());
|
226 |
souaissa |
116 |
Handle(GeomAdaptor_HCurve) SPL3Adaptor = new GeomAdaptor_HCurve(ArrayCurve(3));
|
227 |
louhichi |
211 |
Handle(GeomFill_SimpleBound) B3 = new GeomFill_SimpleBound(SPL3Adaptor,Precision::Approximation(),Precision::Angular());
|
228 |
|
|
|
229 |
souaissa |
116 |
Standard_Boolean NoCheck= Standard_False;
|
230 |
|
|
Standard_Integer MaxDeg = 8;
|
231 |
|
|
|
232 |
|
|
Standard_Integer MaxSeg = 50;
|
233 |
louhichi |
211 |
|
234 |
|
|
GeomFill_ConstrainedFilling aConstrained(MaxDeg, MaxSeg);
|
235 |
|
|
aConstrained.Init(B1,B2,B3, NoCheck);
|
236 |
|
|
Surf1 = aConstrained.Surface();
|
237 |
souaissa |
116 |
}
|
238 |
|
|
|
239 |
louhichi |
211 |
if(nb_aretes_ext ==4)
|
240 |
souaissa |
116 |
{
|
241 |
|
|
|
242 |
|
|
Handle(GeomAdaptor_HCurve) SPL1Adaptor = new GeomAdaptor_HCurve(ArrayCurve(1));
|
243 |
louhichi |
211 |
Handle(GeomFill_SimpleBound) B1 = new GeomFill_SimpleBound(SPL1Adaptor,Precision::Approximation(),Precision::Angular());
|
244 |
souaissa |
116 |
Handle(GeomAdaptor_HCurve) SPL2Adaptor = new GeomAdaptor_HCurve(ArrayCurve(2));
|
245 |
louhichi |
211 |
Handle(GeomFill_SimpleBound) B2 = new GeomFill_SimpleBound(SPL2Adaptor,Precision::Approximation(),Precision::Angular());
|
246 |
souaissa |
116 |
Handle(GeomAdaptor_HCurve) SPL3Adaptor = new GeomAdaptor_HCurve(ArrayCurve(3));
|
247 |
louhichi |
211 |
Handle(GeomFill_SimpleBound) B3 = new GeomFill_SimpleBound(SPL3Adaptor,Precision::Approximation(),Precision::Angular());
|
248 |
souaissa |
116 |
Handle(GeomAdaptor_HCurve) SPL4Adaptor = new GeomAdaptor_HCurve(ArrayCurve(4));
|
249 |
louhichi |
211 |
Handle(GeomFill_SimpleBound) B4 = new GeomFill_SimpleBound(SPL4Adaptor,Precision::Approximation(),Precision::Angular());
|
250 |
|
|
|
251 |
souaissa |
116 |
Standard_Boolean NoCheck= Standard_False;
|
252 |
|
|
Standard_Integer MaxDeg = 8;
|
253 |
louhichi |
211 |
|
254 |
souaissa |
116 |
Standard_Integer MaxSeg = 50;
|
255 |
louhichi |
211 |
|
256 |
|
|
GeomFill_ConstrainedFilling aConstrained(MaxDeg, MaxSeg);
|
257 |
|
|
aConstrained.Init(B1,B2,B3,B4, NoCheck);
|
258 |
|
|
Surf1 = aConstrained.Surface();
|
259 |
souaissa |
116 |
}
|
260 |
|
|
return true;
|
261 |
|
5 |
}
|
262 |
souaissa |
116 |
|
263 |
louhichi |
211 |
|
264 |
|
|
|
265 |
|
|
|
266 |
|
5 |
int OCC_FONCTION::Creer_Face_Surface()
|
267 |
|
|
{
|
268 |
francois |
549 |
#if (OCC_VERSION_MAJOR >= 6) && (OCC_VERSION_MINOR >= 7)
|
269 |
francois |
547 |
F1 = BRepBuilderAPI_MakeFace(Surf1,1e-6);
|
270 |
francois |
548 |
#else
|
271 |
|
|
F1 = BRepBuilderAPI_MakeFace(Surf1);
|
272 |
|
|
#endif
|
273 |
souaissa |
116 |
return true;
|
274 |
|
5 |
}
|
275 |
souaissa |
116 |
|
276 |
louhichi |
211 |
//*************************** Classe Contour ***********************************
|
277 |
souaissa |
116 |
|
278 |
louhichi |
211 |
//BRepBuilderAPI_MakeWire W1;
|
279 |
|
5 |
int OCC_FONCTION::Creer_Contour()
|
280 |
|
|
{
|
281 |
souaissa |
116 |
TopoDS_Wire W;
|
282 |
louhichi |
211 |
W1 = W;
|
283 |
souaissa |
116 |
|
284 |
|
|
return true;
|
285 |
|
5 |
}
|
286 |
souaissa |
116 |
|
287 |
|
|
|
288 |
louhichi |
211 |
//*************************** Classe Arete Lineaire ****************************
|
289 |
souaissa |
116 |
|
290 |
|
5 |
int OCC_FONCTION::Creer_Arete_Lineaire(double P1[3], double P2[3])
|
291 |
|
|
{
|
292 |
louhichi |
211 |
|
293 |
|
|
GeomAPI_ProjectPointOnSurf Proj1(gp_Pnt(P1[0],P1[1],P1[2]),Surf1);
|
294 |
souaissa |
116 |
Proj1.LowerDistanceParameters(U, V);
|
295 |
|
|
gp_Pnt2d P1_2D(U,V);
|
296 |
|
|
|
297 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj2(gp_Pnt(P2[0],P2[1],P2[2]),Surf1);
|
298 |
souaissa |
116 |
Proj2.LowerDistanceParameters(U, V);
|
299 |
louhichi |
211 |
gp_Pnt2d P2_2D(U,V);
|
300 |
souaissa |
116 |
|
301 |
louhichi |
211 |
Curve = GCE2d_MakeSegment (P1_2D, P2_2D);
|
302 |
souaissa |
116 |
|
303 |
louhichi |
211 |
E = BRepBuilderAPI_MakeEdge(Curve,Surf1);
|
304 |
souaissa |
116 |
|
305 |
louhichi |
211 |
W1.Add(E);
|
306 |
souaissa |
116 |
|
307 |
|
|
return true;
|
308 |
louhichi |
211 |
|
309 |
|
5 |
}
|
310 |
souaissa |
116 |
|
311 |
louhichi |
211 |
|
312 |
|
|
//**************************** Classe Arete Circulaire *************************
|
313 |
|
5 |
int OCC_FONCTION::Creer_Arete_Circulaire(double Pnt_Insersion[3], double Normal[3],double P1[3], double P2[3], double Rayon)
|
314 |
louhichi |
211 |
{
|
315 |
|
|
GeomAPI_ProjectPointOnSurf Proj(gp_Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]),Surf1);
|
316 |
souaissa |
116 |
Proj.LowerDistanceParameters(U, V);
|
317 |
|
|
gp_Pnt2d Pnt_Ins2D(U,V);
|
318 |
|
|
|
319 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj1(gp_Pnt(P1[0],P1[1],P1[2]),Surf1);
|
320 |
souaissa |
116 |
Proj1.LowerDistanceParameters(U, V);
|
321 |
|
|
gp_Pnt2d P1_2D(U,V);
|
322 |
|
|
|
323 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj2(gp_Pnt(P2[0],P2[1],P2[2]),Surf1);
|
324 |
souaissa |
116 |
Proj2.LowerDistanceParameters(U, V);
|
325 |
|
|
gp_Pnt2d P2_2D(U,V);
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
gp_Dir2d Vect(P1_2D.X()-Pnt_Ins2D.X(),P1_2D.Y()-Pnt_Ins2D.Y());
|
329 |
|
|
|
330 |
louhichi |
211 |
gp_Ax2d Axe(Pnt_Ins2D,Vect);
|
331 |
souaissa |
116 |
|
332 |
louhichi |
211 |
gp_Circ2d Circ(Axe, Rayon, Standard_True);
|
333 |
souaissa |
116 |
|
334 |
|
|
|
335 |
louhichi |
211 |
Curve = GCE2d_MakeArcOfCircle (Circ, P1_2D, P2_2D, Standard_True);
|
336 |
|
|
E = BRepBuilderAPI_MakeEdge(Curve,Surf1);
|
337 |
|
|
W1.Add(E);
|
338 |
souaissa |
116 |
return true;
|
339 |
|
5 |
}
|
340 |
louhichi |
211 |
|
341 |
|
|
|
342 |
|
|
//*************************** Classe Arete Elliptique **************************
|
343 |
|
|
|
344 |
|
5 |
int OCC_FONCTION::Creer_Arete_Elliptique(double Pnt_Insersion[3], double P1[3], double P2[3], double GRayon, double PRayon)
|
345 |
|
|
{
|
346 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj(gp_Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]),Surf1);
|
347 |
souaissa |
116 |
Proj.LowerDistanceParameters(U, V);
|
348 |
|
|
gp_Pnt2d Pnt_Ins2D(U,V);
|
349 |
|
|
|
350 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj1(gp_Pnt(P1[0],P1[1],P1[2]),Surf1);
|
351 |
souaissa |
116 |
Proj1.LowerDistanceParameters(U, V);
|
352 |
|
|
gp_Pnt2d P1_2D(U,V);
|
353 |
|
|
|
354 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj2(gp_Pnt(P2[0],P2[1],P2[2]),Surf1);
|
355 |
souaissa |
116 |
Proj2.LowerDistanceParameters(U, V);
|
356 |
|
|
gp_Pnt2d P2_2D(U,V);
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
gp_Dir2d Vect(P1_2D.X()-Pnt_Ins2D.X(),P1_2D.Y()-Pnt_Ins2D.Y());
|
360 |
|
|
|
361 |
louhichi |
211 |
gp_Ax2d Axe(Pnt_Ins2D,Vect);
|
362 |
souaissa |
116 |
|
363 |
louhichi |
211 |
gp_Elips2d Ellipse(Axe, GRayon, PRayon, Standard_True);
|
364 |
souaissa |
116 |
|
365 |
louhichi |
211 |
Curve = GCE2d_MakeArcOfEllipse (Ellipse, P1_2D, P2_2D, Standard_True);
|
366 |
|
|
E = BRepBuilderAPI_MakeEdge(Curve,Surf1);
|
367 |
souaissa |
116 |
|
368 |
|
|
return true;
|
369 |
|
5 |
}
|
370 |
souaissa |
116 |
|
371 |
|
|
|
372 |
louhichi |
211 |
//*************************** Classe Arete Spline ******************************
|
373 |
|
|
|
374 |
souaissa |
116 |
TColgp_Array1OfPnt2d Array01(1,1000);
|
375 |
louhichi |
211 |
|
376 |
|
5 |
int OCC_FONCTION::Ajouter_Point_Arete(double x, double y, double z, int i)
|
377 |
|
|
{
|
378 |
souaissa |
116 |
gp_Pnt P(x,y,z);
|
379 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj(P,Surf1);
|
380 |
souaissa |
116 |
Proj.LowerDistanceParameters(U, V);
|
381 |
louhichi |
211 |
Array01.SetValue(i,gp_Pnt2d(U,V));
|
382 |
|
|
|
383 |
souaissa |
116 |
return true;
|
384 |
|
5 |
}
|
385 |
|
|
|
386 |
louhichi |
211 |
|
387 |
|
|
|
388 |
|
|
|
389 |
francois |
38 |
int OCC_FONCTION::Rapprocher_Surface_Courbe_Spline(int nb_pts)
|
390 |
|
5 |
{
|
391 |
souaissa |
116 |
TColgp_Array1OfPnt Arr(1,nb_pts);
|
392 |
louhichi |
211 |
|
393 |
souaissa |
116 |
for(int ii = 1; ii<=nb_pts;ii++)
|
394 |
|
|
{
|
395 |
louhichi |
211 |
Arr.SetValue(ii,Array(ii));
|
396 |
souaissa |
116 |
}
|
397 |
|
|
|
398 |
francois |
314 |
Handle(Geom_BSplineCurve) SPL = GeomAPI_PointsToBSpline (Arr,3,8,GeomAbs_C1,0.).Curve();
|
399 |
souaissa |
116 |
Handle(GeomAdaptor_HCurve) SPL1Adaptor = new GeomAdaptor_HCurve(SPL);
|
400 |
|
|
Handle(BRepFill_CurveConstraint) Cont= new BRepFill_CurveConstraint(SPL1Adaptor,0);
|
401 |
|
|
BPSurf.Add(Cont);
|
402 |
|
|
|
403 |
|
|
return true;
|
404 |
|
5 |
}
|
405 |
louhichi |
211 |
|
406 |
|
|
|
407 |
|
|
|
408 |
souaissa |
116 |
int OCC_FONCTION::Ajouter_Arete_Contour(int nbpts)
|
409 |
|
|
{
|
410 |
louhichi |
211 |
TColgp_Array1OfPnt2d Array02(1,nbpts);
|
411 |
|
5 |
|
412 |
souaissa |
116 |
for(int ii = 1; ii<=nbpts;ii++)
|
413 |
|
|
{
|
414 |
|
|
gp_Pnt2d PP = Array01(ii);
|
415 |
|
|
Array02.SetValue(ii,PP);
|
416 |
|
|
}
|
417 |
|
|
|
418 |
francois |
314 |
Handle(Geom2d_BSplineCurve) SSPL1 = Geom2dAPI_PointsToBSpline(Array02,3,8,GeomAbs_C1,0.).Curve();
|
419 |
louhichi |
211 |
TopoDS_Edge E = BRepBuilderAPI_MakeEdge(SSPL1,Surf1);
|
420 |
|
|
W1.Add(E);
|
421 |
souaissa |
116 |
|
422 |
|
|
|
423 |
|
|
return true;
|
424 |
|
5 |
}
|
425 |
louhichi |
211 |
|
426 |
|
|
|
427 |
|
5 |
int OCC_FONCTION::Initialiser_Surface_Cylindrique(double Pnt_Insersion[3], double Vect_Directeur[3],double Rayon)
|
428 |
|
|
{
|
429 |
souaissa |
116 |
gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
|
430 |
|
|
gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
|
431 |
louhichi |
211 |
gp_Ax3 Axe(Pnt,Vect);
|
432 |
souaissa |
116 |
|
433 |
louhichi |
211 |
Handle (Geom_Surface) Surf = new Geom_CylindricalSurface(Axe, Rayon);
|
434 |
souaissa |
116 |
BPSurf = GeomPlate_BuildPlateSurface(Surf,3,10,3);
|
435 |
|
|
return true;
|
436 |
|
5 |
}
|
437 |
louhichi |
211 |
|
438 |
|
5 |
int OCC_FONCTION::Initialiser_Surface_Surface()
|
439 |
|
|
{
|
440 |
louhichi |
211 |
BPSurf = GeomPlate_BuildPlateSurface(Surf1,3,10,3);
|
441 |
souaissa |
116 |
return true;
|
442 |
|
5 |
}
|
443 |
|
|
|
444 |
souaissa |
116 |
TColgp_Array1OfPnt Array_Point_Ideal(1,1000);
|
445 |
|
|
|
446 |
|
5 |
int OCC_FONCTION::Ajouter_Point_Array_Ideal(double x, double y, double z, int i)
|
447 |
|
|
{
|
448 |
souaissa |
116 |
gp_Pnt Pnt(x,y,z);
|
449 |
|
|
Array_Point_Ideal.SetValue(i,Pnt);
|
450 |
|
|
|
451 |
|
|
return true;
|
452 |
|
5 |
}
|
453 |
|
|
|
454 |
souaissa |
116 |
int OCC_FONCTION::Determiner_Param_Boite(int nb)
|
455 |
|
5 |
{
|
456 |
louhichi |
211 |
TColgp_Array1OfPnt Array_Point_Ideal1(1,nb);
|
457 |
souaissa |
116 |
|
458 |
|
|
for(int i = 1; i<=nb;i++)
|
459 |
|
|
{
|
460 |
|
|
Array_Point_Ideal1.SetValue(i,Array_Point_Ideal(i));
|
461 |
|
|
}
|
462 |
|
|
|
463 |
|
|
GProp_PEquation Boite = GProp_PEquation(Array_Point_Ideal1,0);
|
464 |
|
|
|
465 |
|
|
Boite.Box(P_def, V11_def, V22_def, V33_def);
|
466 |
|
|
|
467 |
|
|
Array_Boite[1] = P_def.X();
|
468 |
|
|
Array_Boite[2] = P_def.Y();
|
469 |
|
|
Array_Boite[3] = P_def.Z();
|
470 |
|
|
|
471 |
|
|
Array_Boite[4] = V11_def.X();
|
472 |
|
|
Array_Boite[5] = V11_def.Y();
|
473 |
|
|
Array_Boite[6] = V11_def.Z();
|
474 |
|
|
|
475 |
|
|
Array_Boite[7] = V22_def.X();
|
476 |
|
|
Array_Boite[8] = V22_def.Y();
|
477 |
|
|
Array_Boite[9] = V22_def.Z();
|
478 |
|
|
|
479 |
|
|
Array_Boite[10] = V33_def.X();
|
480 |
|
|
Array_Boite[11] = V33_def.Y();
|
481 |
|
|
Array_Boite[12] = V33_def.Z();
|
482 |
|
|
|
483 |
|
|
return true;
|
484 |
|
5 |
}
|
485 |
|
|
|
486 |
souaissa |
116 |
double OCC_FONCTION::Get_Param_Boite(int ii)
|
487 |
|
5 |
{
|
488 |
souaissa |
116 |
return Array_Boite[ii];
|
489 |
louhichi |
211 |
|
490 |
|
5 |
}
|
491 |
|
|
|
492 |
souaissa |
116 |
|
493 |
|
5 |
int OCC_FONCTION::Determiner_Plan(int nb, double Epsilon)
|
494 |
|
|
{
|
495 |
souaissa |
116 |
TColgp_Array1OfPnt Array_Point_Ideal1(1,nb);
|
496 |
|
|
|
497 |
louhichi |
211 |
for(int i = 1; i<=nb;i++)
|
498 |
souaissa |
116 |
{
|
499 |
louhichi |
211 |
Array_Point_Ideal1.SetValue(i,Array_Point_Ideal(i));
|
500 |
souaissa |
116 |
}
|
501 |
|
|
|
502 |
|
|
GProp_PEquation Equa_plan(Array_Point_Ideal1,Epsilon);
|
503 |
|
|
gp_Pln Plan = Equa_plan.Plane();
|
504 |
louhichi |
211 |
Surf1 = new Geom_Plane(Plan);
|
505 |
souaissa |
116 |
|
506 |
|
|
return true;
|
507 |
|
5 |
}
|
508 |
|
|
|
509 |
louhichi |
211 |
|
510 |
|
|
int OCC_FONCTION::Ligne_Revolution(double Pnt_Insersion[], double Vect_Directeur[])
|
511 |
|
5 |
{
|
512 |
louhichi |
211 |
gp_Pnt P(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
|
513 |
|
|
gp_Dir V(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
|
514 |
souaissa |
116 |
|
515 |
louhichi |
211 |
Handle(Geom_Line) Line = new Geom_Line (P,V);
|
516 |
souaissa |
116 |
Curve_Projection = Line;
|
517 |
|
|
|
518 |
|
|
return true;
|
519 |
|
5 |
}
|
520 |
|
|
|
521 |
|
|
double OCC_FONCTION::Distance_Point_Curve(double x, double y, double z)
|
522 |
|
|
{
|
523 |
souaissa |
116 |
gp_Pnt P(x,y,z);
|
524 |
|
|
GeomAPI_ProjectPointOnCurve PPC (P,Curve_Projection);
|
525 |
|
|
N = PPC.NearestPoint();
|
526 |
|
|
|
527 |
|
|
double distance = PPC.LowerDistance();
|
528 |
louhichi |
211 |
|
529 |
|
|
return distance;
|
530 |
souaissa |
116 |
|
531 |
|
5 |
}
|
532 |
|
|
|
533 |
|
|
int OCC_FONCTION::Creer_Surface_Cylindrique_Revolution(double Pnt_Insersion[3], double Vect_Directeur[3],double Vecteur1[3],double Rayon)
|
534 |
|
|
{
|
535 |
souaissa |
116 |
gp_Pnt Pnt(Pnt_Insersion[0]+Rayon*Vecteur1[0],Pnt_Insersion[1]+Rayon*Vecteur1[1],Pnt_Insersion[2]+Rayon*Vecteur1[2]);
|
536 |
|
|
gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
|
537 |
|
|
|
538 |
|
|
Handle (Geom_Curve) C1 = new Geom_Line(Pnt,Vect);
|
539 |
louhichi |
211 |
Surf1 = new Geom_SurfaceOfRevolution(C1,gp_Ax1(gp_Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]),Vect));
|
540 |
|
5 |
|
541 |
souaissa |
116 |
return true;
|
542 |
|
5 |
}
|
543 |
|
|
|
544 |
louhichi |
211 |
int OCC_FONCTION::Face_Revolution()
|
545 |
|
|
{
|
546 |
|
|
return Face_Revol;
|
547 |
|
|
}
|
548 |
|
|
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
|
|
|
553 |
|
|
|
554 |
|
|
|
555 |
|
5 |
int OCC_FONCTION::Pt_Proj_Ligne()
|
556 |
|
|
{
|
557 |
souaissa |
116 |
Pt_Proj_Line[1] = N.X();
|
558 |
|
|
Pt_Proj_Line[2] = N.Y();
|
559 |
|
|
Pt_Proj_Line[3] = N.Z();
|
560 |
|
|
|
561 |
|
|
return true;
|
562 |
|
5 |
}
|
563 |
louhichi |
211 |
|
564 |
|
5 |
double OCC_FONCTION::Pnt_Proj_Ligne(int ii)
|
565 |
|
|
{
|
566 |
souaissa |
116 |
return Pt_Proj_Line[ii];
|
567 |
|
5 |
}
|
568 |
|
|
|
569 |
louhichi |
211 |
|
570 |
|
5 |
int OCC_FONCTION::GCercle_Tore(double Pnt_Insersion[3], double Vect_Directeur[3],double Rayon)
|
571 |
|
|
{
|
572 |
souaissa |
116 |
gp_Pnt P(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
|
573 |
|
|
gp_Dir V(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
|
574 |
|
|
|
575 |
|
|
Handle(Geom_Circle) GCercle = new Geom_Circle (gp_Ax2(P,V),Rayon);
|
576 |
|
|
Curve_Projection = GCercle;
|
577 |
|
|
|
578 |
|
|
return true;
|
579 |
|
|
|
580 |
|
5 |
}
|
581 |
|
|
|
582 |
souaissa |
116 |
TColGeom_Array1OfSurface Array_Surface_Ideal(1,100);
|
583 |
|
5 |
|
584 |
|
|
int OCC_FONCTION::Ajouter_Surface_liste_Ideal(int num)
|
585 |
|
|
{
|
586 |
louhichi |
211 |
Array_Surface_Ideal.SetValue(num,Surf1);
|
587 |
souaissa |
116 |
return true;
|
588 |
|
5 |
}
|
589 |
|
|
|
590 |
louhichi |
211 |
|
591 |
|
5 |
int OCC_FONCTION::Projeter_Point_Surface_Idealisee(double x, double y,double z, int num)
|
592 |
|
|
{
|
593 |
souaissa |
116 |
gp_Pnt P(x,y,z);
|
594 |
|
|
Handle (Geom_Surface) Surf = Array_Surface_Ideal(num);
|
595 |
|
|
GeomAPI_ProjectPointOnSurf Proj(P,Surf);
|
596 |
|
|
|
597 |
|
|
Point_Projetee = Proj.NearestPoint();
|
598 |
|
|
|
599 |
|
|
return true;
|
600 |
|
5 |
}
|
601 |
louhichi |
211 |
|
602 |
|
5 |
int OCC_FONCTION::Pt_Proj_Surface_Ideal()
|
603 |
|
|
{
|
604 |
souaissa |
116 |
Pt_Proj_Surf_Ideal[1] = Point_Projetee.X();
|
605 |
|
|
Pt_Proj_Surf_Ideal[2] = Point_Projetee.Y();
|
606 |
|
|
Pt_Proj_Surf_Ideal[3] = Point_Projetee.Z();
|
607 |
|
|
|
608 |
|
|
return true;
|
609 |
|
5 |
}
|
610 |
|
|
|
611 |
louhichi |
211 |
|
612 |
|
5 |
double OCC_FONCTION::Pnt_Proj_Surface_Ideal(int ii)
|
613 |
|
|
{
|
614 |
souaissa |
116 |
return Pt_Proj_Surf_Ideal[ii];
|
615 |
|
5 |
}
|
616 |
|
|
|
617 |
louhichi |
211 |
|
618 |
francois |
38 |
int OCC_FONCTION::Projeter_Point_Plan_Idealisee(double x, double y,double z)
|
619 |
|
|
{
|
620 |
souaissa |
116 |
gp_Pnt P(x,y,z);
|
621 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj(P,Surf1);
|
622 |
souaissa |
116 |
Point_Projetee = Proj.NearestPoint();
|
623 |
francois |
38 |
|
624 |
souaissa |
116 |
return true;
|
625 |
|
|
}
|
626 |
louhichi |
211 |
|
627 |
|
|
|
628 |
francois |
38 |
int OCC_FONCTION::Ajouter_Point_AreteUV(int testU, int testV, double x, double y, double z, int i)
|
629 |
|
|
{
|
630 |
souaissa |
116 |
gp_Pnt P(x,y,z);
|
631 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj(P,Surf1);
|
632 |
souaissa |
116 |
Proj.LowerDistanceParameters(U, V);
|
633 |
francois |
547 |
if((testU==1) && (U<=M_PI/2))
|
634 |
souaissa |
116 |
{
|
635 |
francois |
547 |
U = U+ 2*M_PI;
|
636 |
souaissa |
116 |
}
|
637 |
|
|
|
638 |
francois |
547 |
if((testV==1) && (V<=M_PI/2))
|
639 |
souaissa |
116 |
{
|
640 |
francois |
547 |
V = V+ 2*M_PI;
|
641 |
souaissa |
116 |
}
|
642 |
louhichi |
211 |
Array01.SetValue(i,gp_Pnt2d(U,V));
|
643 |
|
|
|
644 |
souaissa |
116 |
return true;
|
645 |
francois |
38 |
}
|
646 |
louhichi |
211 |
|
647 |
francois |
38 |
double OCC_FONCTION::Analyser_interval_AreteU(double x, double y, double z)
|
648 |
|
|
{
|
649 |
souaissa |
116 |
gp_Pnt P(x,y,z);
|
650 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj(P,Surf1);
|
651 |
souaissa |
116 |
Proj.LowerDistanceParameters(U, V);
|
652 |
louhichi |
211 |
return U;
|
653 |
|
|
}
|
654 |
souaissa |
116 |
|
655 |
francois |
38 |
double OCC_FONCTION::Analyser_interval_AreteV(double x, double y, double z)
|
656 |
|
|
{
|
657 |
souaissa |
116 |
gp_Pnt P(x,y,z);
|
658 |
louhichi |
211 |
GeomAPI_ProjectPointOnSurf Proj(P,Surf1);
|
659 |
souaissa |
116 |
Proj.LowerDistanceParameters(U, V);
|
660 |
louhichi |
211 |
return V;
|
661 |
|
|
}
|
662 |
souaissa |
116 |
|
663 |
|
|
|
664 |
louhichi |
211 |
|
665 |
|
|
#endif
|
666 |
|
|
|
667 |
|
|
|