29 #include "Geom_BSplineSurface.hxx"
30 #include "Geom2d_Curve.hxx"
33 #pragma package(smart_init)
63 STEPControl_Writer writer;
64 writer.Transfer(Sol, STEPControl_ManifoldSolidBrep);
77 const Handle_Geom_Surface Surf=Surf1;
78 F1 = BRepBuilderAPI_MakeFace(Surf,W11,Standard_True);
80 #if (((OCC_VERSION_MAJOR == 6) && (OCC_VERSION_MINOR >= 7)) || (OCC_VERSION_MAJOR > 6))
81 BRepBuilderAPI_MakeFace F3(Surf,1e-6);
82 F3.Init(Surf,Standard_False,1e-6);
84 BRepBuilderAPI_MakeFace F3(Surf);
85 F3.Init(Surf,Standard_False);
95 #if (((OCC_VERSION_MAJOR == 6) && (OCC_VERSION_MINOR >= 7))|| (OCC_VERSION_MAJOR > 6))
96 BRepBuilderAPI_MakeFace F2(Surf1,1e-6);
97 F2.Init(Surf1,Standard_False,1e-6);
99 BRepBuilderAPI_MakeFace F2(Surf1);
100 F2.Init(Surf1,Standard_False);
108 F1 = BRepBuilderAPI_MakeFace(
F1,W11);
118 gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
119 gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
121 gp_Ax3 Axe(Pnt,Vect);
123 Surf1 =
new Geom_CylindricalSurface(gp_Cylinder(Axe, Rayon));
130 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]);
133 gp_Ax3 Axe(Pnt,Vect);
135 Surf1 =
new Geom_ConicalSurface(Axe,Angle,Rayon);
143 gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
144 gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
146 gp_Ax3 Axe(Pnt,Vect);
148 Surf1 =
new Geom_ToroidalSurface(Axe,GRayon,PRayon);
155 gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
156 gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
158 gp_Ax3 Axe(Pnt,Vect);
160 Surf1 =
new Geom_SphericalSurface(Axe,Rayon);
168 BPSurf = GeomPlate_BuildPlateSurface(3,10,3);
174 Handle(GeomPlate_PointConstraint) PCont=
new GeomPlate_PointConstraint(
P,0);
186 Standard_Integer MaxSeg = 50;
187 Standard_Integer MaxDegree=8;
188 Standard_Integer CritOrder=4;
189 Standard_Real dmax,Tol;
193 GeomPlate_MakeApprox Mapp1(PSurf1,Tol,MaxSeg,MaxDegree,dmax,0);
194 Surf1 = Mapp1.Surface();
201 TColgp_Array1OfPnt
Array(1,1000);
205 Array.SetValue(i,gp_Pnt(x,y,z));
211 TColGeom_Array1OfBSplineCurve
ArrayCurve(1,4);
215 TColgp_Array1OfPnt Array00(1,nbpts);
217 for(
int ii = 1; ii<=nbpts;ii++)
219 Array00.SetValue(ii,
Array(ii));
222 Handle(Geom_BSplineCurve) SPL0 = GeomAPI_PointsToBSpline(Array00,3,8,GeomAbs_C1,0.).Curve();
232 if(nb_aretes_ext ==3)
234 Handle(GeomAdaptor_HCurve) SPL1Adaptor =
new GeomAdaptor_HCurve(
ArrayCurve(1));
235 Handle(GeomFill_SimpleBound) B1 =
new GeomFill_SimpleBound(SPL1Adaptor,Precision::Approximation(),Precision::Angular());
236 Handle(GeomAdaptor_HCurve) SPL2Adaptor =
new GeomAdaptor_HCurve(
ArrayCurve(2));
237 Handle(GeomFill_SimpleBound) B2 =
new GeomFill_SimpleBound(SPL2Adaptor,Precision::Approximation(),Precision::Angular());
238 Handle(GeomAdaptor_HCurve) SPL3Adaptor =
new GeomAdaptor_HCurve(
ArrayCurve(3));
239 Handle(GeomFill_SimpleBound) B3 =
new GeomFill_SimpleBound(SPL3Adaptor,Precision::Approximation(),Precision::Angular());
241 Standard_Boolean NoCheck= Standard_False;
242 Standard_Integer MaxDeg = 8;
244 Standard_Integer MaxSeg = 50;
246 GeomFill_ConstrainedFilling aConstrained(MaxDeg, MaxSeg);
247 aConstrained.Init(B1,B2,B3, NoCheck);
248 Surf1 = aConstrained.Surface();
251 if(nb_aretes_ext ==4)
254 Handle(GeomAdaptor_HCurve) SPL1Adaptor =
new GeomAdaptor_HCurve(
ArrayCurve(1));
255 Handle(GeomFill_SimpleBound) B1 =
new GeomFill_SimpleBound(SPL1Adaptor,Precision::Approximation(),Precision::Angular());
256 Handle(GeomAdaptor_HCurve) SPL2Adaptor =
new GeomAdaptor_HCurve(
ArrayCurve(2));
257 Handle(GeomFill_SimpleBound) B2 =
new GeomFill_SimpleBound(SPL2Adaptor,Precision::Approximation(),Precision::Angular());
258 Handle(GeomAdaptor_HCurve) SPL3Adaptor =
new GeomAdaptor_HCurve(
ArrayCurve(3));
259 Handle(GeomFill_SimpleBound) B3 =
new GeomFill_SimpleBound(SPL3Adaptor,Precision::Approximation(),Precision::Angular());
260 Handle(GeomAdaptor_HCurve) SPL4Adaptor =
new GeomAdaptor_HCurve(
ArrayCurve(4));
261 Handle(GeomFill_SimpleBound) B4 =
new GeomFill_SimpleBound(SPL4Adaptor,Precision::Approximation(),Precision::Angular());
263 Standard_Boolean NoCheck= Standard_False;
264 Standard_Integer MaxDeg = 8;
266 Standard_Integer MaxSeg = 50;
268 GeomFill_ConstrainedFilling aConstrained(MaxDeg, MaxSeg);
269 aConstrained.Init(B1,B2,B3,B4, NoCheck);
270 Surf1 = aConstrained.Surface();
280 #if (((OCC_VERSION_MAJOR == 6) && (OCC_VERSION_MINOR >= 7)) || (OCC_VERSION_MAJOR > 6))
281 F1 = BRepBuilderAPI_MakeFace(Surf1,1e-6);
283 F1 = BRepBuilderAPI_MakeFace(Surf1);
302 GeomAPI_ProjectPointOnSurf Proj1(gp_Pnt(P1[0],P1[1],P1[2]),Surf1);
303 Proj1.LowerDistanceParameters(
U,
V);
306 GeomAPI_ProjectPointOnSurf Proj2(gp_Pnt(P2[0],P2[1],P2[2]),Surf1);
307 Proj2.LowerDistanceParameters(
U,
V);
310 Curve = GCE2d_MakeSegment(P1_2D, P2_2D).Value();
312 E = BRepBuilderAPI_MakeEdge(Curve,Surf1);
323 GeomAPI_ProjectPointOnSurf Proj(gp_Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]),Surf1);
324 Proj.LowerDistanceParameters(
U,
V);
325 gp_Pnt2d Pnt_Ins2D(
U,
V);
327 GeomAPI_ProjectPointOnSurf Proj1(gp_Pnt(P1[0],P1[1],P1[2]),Surf1);
328 Proj1.LowerDistanceParameters(
U,
V);
331 GeomAPI_ProjectPointOnSurf Proj2(gp_Pnt(P2[0],P2[1],P2[2]),Surf1);
332 Proj2.LowerDistanceParameters(
U,
V);
336 gp_Dir2d Vect(P1_2D.X()-Pnt_Ins2D.X(),P1_2D.Y()-Pnt_Ins2D.Y());
338 gp_Ax2d Axe(Pnt_Ins2D,Vect);
340 gp_Circ2d Circ(Axe, Rayon, Standard_True);
343 Curve = GCE2d_MakeArcOfCircle (Circ, P1_2D, P2_2D, Standard_True).Value();
344 E = BRepBuilderAPI_MakeEdge(Curve,Surf1);
353 GeomAPI_ProjectPointOnSurf Proj(gp_Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]),Surf1);
354 Proj.LowerDistanceParameters(
U,
V);
355 gp_Pnt2d Pnt_Ins2D(
U,
V);
357 GeomAPI_ProjectPointOnSurf Proj1(gp_Pnt(P1[0],P1[1],P1[2]),Surf1);
358 Proj1.LowerDistanceParameters(
U,
V);
361 GeomAPI_ProjectPointOnSurf Proj2(gp_Pnt(P2[0],P2[1],P2[2]),Surf1);
362 Proj2.LowerDistanceParameters(
U,
V);
366 gp_Dir2d Vect(P1_2D.X()-Pnt_Ins2D.X(),P1_2D.Y()-Pnt_Ins2D.Y());
368 gp_Ax2d Axe(Pnt_Ins2D,Vect);
370 gp_Elips2d Ellipse(Axe, GRayon, PRayon, Standard_True);
372 Curve = GCE2d_MakeArcOfEllipse (Ellipse, P1_2D, P2_2D, Standard_True).Value();
373 E = BRepBuilderAPI_MakeEdge(Curve,Surf1);
380 TColgp_Array1OfPnt2d
Array01(1,1000);
385 GeomAPI_ProjectPointOnSurf Proj(
P,Surf1);
386 Proj.LowerDistanceParameters(
U,
V);
397 TColgp_Array1OfPnt Arr(1,nb_pts);
399 for(
int ii = 1; ii<=nb_pts;ii++)
401 Arr.SetValue(ii,
Array(ii));
404 Handle(Geom_BSplineCurve) SPL = GeomAPI_PointsToBSpline (Arr,3,8,GeomAbs_C1,0.).Curve();
405 Handle(GeomAdaptor_HCurve) SPL1Adaptor =
new GeomAdaptor_HCurve(SPL);
406 Handle(BRepFill_CurveConstraint) Cont=
new BRepFill_CurveConstraint(SPL1Adaptor,0);
416 TColgp_Array1OfPnt2d Array02(1,nbpts);
418 for(
int ii = 1; ii<=nbpts;ii++)
421 Array02.SetValue(ii,PP);
424 Handle(Geom2d_BSplineCurve) SSPL1 = Geom2dAPI_PointsToBSpline(Array02,3,8,GeomAbs_C1,0.).Curve();
425 TopoDS_Edge
E = BRepBuilderAPI_MakeEdge(SSPL1,Surf1);
435 gp_Pnt Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
436 gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
437 gp_Ax3 Axe(Pnt,Vect);
439 Handle (Geom_Surface) Surf =
new Geom_CylindricalSurface(Axe, Rayon);
440 BPSurf = GeomPlate_BuildPlateSurface(Surf,3,10,3);
446 BPSurf = GeomPlate_BuildPlateSurface(Surf1,3,10,3);
462 TColgp_Array1OfPnt Array_Point_Ideal1(1,nb);
464 for(
int i = 1; i<=nb;i++)
469 GProp_PEquation Boite = GProp_PEquation(Array_Point_Ideal1,0);
501 TColgp_Array1OfPnt Array_Point_Ideal1(1,nb);
503 for(
int i = 1; i<=nb;i++)
508 GProp_PEquation Equa_plan(Array_Point_Ideal1,Epsilon);
509 gp_Pln Plan = Equa_plan.Plane();
510 Surf1 =
new Geom_Plane(Plan);
518 gp_Pnt
P(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
519 gp_Dir
V(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
521 Handle(Geom_Line) Line =
new Geom_Line (
P,
V);
522 Curve_Projection = Line;
530 GeomAPI_ProjectPointOnCurve PPC (
P,Curve_Projection);
531 N = PPC.NearestPoint();
533 double distance = PPC.LowerDistance();
541 gp_Pnt Pnt(Pnt_Insersion[0]+Rayon*Vecteur1[0],Pnt_Insersion[1]+Rayon*Vecteur1[1],Pnt_Insersion[2]+Rayon*Vecteur1[2]);
542 gp_Dir Vect(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
544 Handle (Geom_Curve) C1 =
new Geom_Line(Pnt,Vect);
545 Surf1 =
new Geom_SurfaceOfRevolution(C1,gp_Ax1(gp_Pnt(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]),Vect));
578 gp_Pnt
P(Pnt_Insersion[0],Pnt_Insersion[1],Pnt_Insersion[2]);
579 gp_Dir
V(Vect_Directeur[0],Vect_Directeur[1],Vect_Directeur[2]);
581 Handle(Geom_Circle) GCercle =
new Geom_Circle (gp_Ax2(
P,
V),Rayon);
582 Curve_Projection = GCercle;
601 GeomAPI_ProjectPointOnSurf Proj(
P,Surf);
627 GeomAPI_ProjectPointOnSurf Proj(
P,Surf1);
637 GeomAPI_ProjectPointOnSurf Proj(
P,Surf1);
638 Proj.LowerDistanceParameters(
U,
V);
639 if((testU==1) && (
U<=M_PI/2))
644 if((testV==1) && (
V<=M_PI/2))
656 GeomAPI_ProjectPointOnSurf Proj(
P,Surf1);
657 Proj.LowerDistanceParameters(
U,
V);
664 GeomAPI_ProjectPointOnSurf Proj(
P,Surf1);
665 Proj.LowerDistanceParameters(
U,
V);