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