1 // Created on: 1996-07-10
2 // Created by: Joelle CHAUVET
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 // Modified: Wed Mar 5 09:45:42 1997
19 // G1134 : new command "approxplate"
20 // Modified: Thu Jun 12 16:51:36 1997
21 // by: Jerome LEMONIER
22 // Mise a jour suite a la modification des methodes Curves2d
23 // et Sense GeomPlate_BuildPlateSurface.
24 // Modified: Mon Nov 3 10:24:07 1997
25 // utilisation de BRepFill_CurveConstraint
29 #include <GeometryTest.hxx>
30 #include <Draw_Interpretor.hxx>
31 #include <Draw_Appli.hxx>
32 #include <DrawTrSurf.hxx>
33 #include <TopAbs_ShapeEnum.hxx>
35 #include <TopoDS_Edge.hxx>
36 #include <TopoDS_Face.hxx>
37 #include <TopExp_Explorer.hxx>
39 #include <BRepAdaptor_HSurface.hxx>
40 #include <BRepAdaptor_HCurve2d.hxx>
41 #include <BRepAdaptor_HCurve.hxx>
42 #include <BRepAdaptor_Surface.hxx>
43 #include <BRepAdaptor_Curve2d.hxx>
44 #include <BRepAdaptor_Curve.hxx>
45 #include <BRepTest.hxx>
47 #include <Adaptor3d_HCurveOnSurface.hxx>
48 #include <Adaptor3d_CurveOnSurface.hxx>
49 #include <TColStd_HArray1OfInteger.hxx>
50 #include <BRep_Tool.hxx>
52 #include <BRepLib.hxx>
53 #include <BRep_Builder.hxx>
54 #include <GeomPlate_BuildPlateSurface.hxx>
55 #include <GeomPlate_BuildAveragePlane.hxx>
56 #include <GeomPlate_Surface.hxx>
57 #include <GeomPlate_BuildAveragePlane.hxx>
58 #include <GeomPlate_HArray1OfHCurveOnSurface.hxx>
60 #include <GeomPlate_MakeApprox.hxx>
61 #include <GeomPlate_PlateG0Criterion.hxx>
62 #include <GeomPlate_PlateG1Criterion.hxx>
63 #include <BRepFill_CurveConstraint.hxx>
64 #include <GeomPlate_PointConstraint.hxx>
65 #include <GeomAdaptor_HSurface.hxx>
66 #include <Geom_Surface.hxx>
68 #include <TopoDS_Wire.hxx>
69 #include <BRepBuilderAPI_MakeEdge.hxx>
70 #include <BRepBuilderAPI_MakeWire.hxx>
71 #include <BRepBuilderAPI_WireError.hxx>
72 #include <BRepBuilderAPI_MakeFace.hxx>
73 #include <TColGeom2d_HArray1OfCurve.hxx>
75 #include <AdvApp2Var_ApproxAFunc2Var.hxx>
76 #include <AdvApp2Var_Context.hxx>
77 #include <AdvApprox_PrefCutting.hxx>
78 #include <AdvApprox_Cutting.hxx>
79 #include <AdvApprox_DichoCutting.hxx>
81 #include <Geom_BSplineSurface.hxx>
83 #include <TColStd_HArray1OfReal.hxx>
84 #include <TColStd_HArray2OfReal.hxx>
86 #include <TColgp_SequenceOfXY.hxx>
87 #include <TColgp_SequenceOfXYZ.hxx>
89 #include <BRepAdaptor_HCurve.hxx>
90 #include <Adaptor3d_HIsoCurve.hxx>
92 #include <Extrema_ExtPS.hxx>
93 #include <Extrema_POnSurf.hxx>
94 #include <Geom_Plane.hxx>
95 #include <BRepOffsetAPI_MakeFilling.hxx>
96 #include <TCollection_AsciiString.hxx>
97 #include <Geom2d_TrimmedCurve.hxx>
98 #include <GeomConvert_ApproxSurface.hxx>
102 #include <gp_Pnt.hxx>
106 #include <OSD_Chronometer.hxx>
107 #include <Geom_Line.hxx>
110 const Standard_Integer defDegree = 3;
111 const Standard_Integer defNbPtsOnCur = 10;
112 const Standard_Integer defNbIter = 3;
113 const Standard_Boolean defAnisotropie = Standard_False;
114 const Standard_Real defTol2d = 0.00001;
115 const Standard_Real defTol3d = 0.0001;
116 const Standard_Real defTolAng = 0.01;
117 const Standard_Real defTolCurv = 0.1;
118 const Standard_Integer defMaxDeg = 8;
119 const Standard_Integer defMaxSegments = 9;
121 Standard_Integer Degree = defDegree;
122 Standard_Integer NbPtsOnCur = defNbPtsOnCur ;
123 Standard_Integer NbIter = defNbIter;
124 Standard_Boolean Anisotropie = defAnisotropie ;
125 Standard_Real Tol2d = defTol2d;
126 Standard_Real Tol3d = defTol3d;
127 Standard_Real TolAng = defTolAng;
128 Standard_Real TolCurv = defTolCurv;
129 Standard_Integer MaxDeg = defMaxDeg;
130 Standard_Integer MaxSegments = defMaxSegments;
132 ////////////////////////////////////////////////////////////////////////////////
133 // commande plate : resultat face sur surface plate
134 ////////////////////////////////////////////////////////////////////////////////
136 static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const char** a)
138 if (n < 8 ) return 1;
139 Standard_Integer NbCurFront=Draw::Atoi(a[3]);
140 Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront);
141 Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront);
142 Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront);
145 GeomPlate_BuildPlateSurface Henri(3,15,2);
148 for (i=1; i<=NbCurFront ; i++) {
149 TopoDS_Shape aLocalEdge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
150 TopoDS_Edge E = TopoDS::Edge(aLocalEdge);
151 // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
152 if(E.IsNull()) return 1;
153 TopoDS_Shape aLocalFace(DBRep::Get(a[3*i+2],TopAbs_FACE));
154 TopoDS_Face F = TopoDS::Face(aLocalFace);
155 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[3*i+2],TopAbs_FACE));
156 if(F.IsNull()) return 1;
157 Standard_Integer T = Draw::Atoi(a[3*i+3]);
159 NbPtsCur->SetValue(i,Draw::Atoi(a[2]));
160 Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
161 S->ChangeSurface().Initialize(F);
162 Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
163 C->ChangeCurve2d().Initialize(E,F);
164 Adaptor3d_CurveOnSurface ConS(C,S);
165 Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
166 Fronts->SetValue(i,HConS);
167 Handle(GeomPlate_CurveConstraint) Cont
168 = new BRepFill_CurveConstraint(HConS,
176 Standard_Real ErrG0 = 1.1*Henri.G0Error();
177 //cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<endl;
178 di<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<"\n";
180 BRepBuilderAPI_MakeWire MW;
181 for (i=1 ; i<=NbCurFront ; i++) {
182 Standard_Integer iInOrder=Henri.Order()->Value(i);
184 if (Henri.Sense()->Value(iInOrder)==1) {
185 BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
187 Fronts->Value(iInOrder)->LastParameter(),
188 Fronts->Value(iInOrder)->FirstParameter());
193 BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
195 Fronts->Value(iInOrder)->FirstParameter(),
196 Fronts->Value(iInOrder)->LastParameter());
199 B.UpdateVertex(TopExp::FirstVertex(E), ErrG0);
200 B.UpdateVertex(TopExp::LastVertex(E), ErrG0);
201 BRepLib::BuildCurve3d(E);
203 Sprintf(name,"Edge_%d", i);
206 if (MW.IsDone()==Standard_False) {
207 Standard_Failure::Raise("mkWire is over ");
213 if (!(W.Closed())) Standard_Failure::Raise("Wire is not closed");
214 BRepBuilderAPI_MakeFace MF(Henri.Surface(),W,Standard_True);
215 DBRep::Set(a[1],MF.Face());
219 ////////////////////////////////////////////////////////////////////////////////
220 // commande gplate : resultat face egale a la surface approchee
221 ////////////////////////////////////////////////////////////////////////////////
223 static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const char** a)
225 if (n < 6 ) return 1;
226 Standard_Integer NbCurFront=Draw::Atoi(a[2]),
227 NbPointConstraint=Draw::Atoi(a[3]);
229 GeomPlate_BuildPlateSurface Henri(3,15,2);
232 Standard_Integer Conti;
233 Standard_Integer Indice=4;
235 TopoDS_Shape aLocalFace(DBRep::Get(a[Indice++],TopAbs_FACE));
236 TopoDS_Face SI = TopoDS::Face(aLocalFace);
237 // TopoDS_Face SI = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
241 { Handle(BRepAdaptor_HSurface) HSI = new BRepAdaptor_HSurface();
242 HSI->ChangeSurface().Initialize(SI);
243 Henri.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face()));
245 for (i=1; i<=NbCurFront ; i++) {
246 TopoDS_Shape aLocalShape(DBRep::Get(a[Indice++],TopAbs_EDGE));
247 TopoDS_Edge E = TopoDS::Edge(aLocalShape);
248 // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[Indice++],TopAbs_EDGE));
249 if(E.IsNull()) return 1;
250 Conti=Draw::Atoi(a[Indice++]);
251 if ((Conti==0)||(Conti==-1))
252 { Handle(BRepAdaptor_HCurve) C = new BRepAdaptor_HCurve();
253 C->ChangeCurve().Initialize(E);
254 const Handle(Adaptor3d_HCurve)& aC = C; // to avoid ambiguity
255 Handle(GeomPlate_CurveConstraint) Cont= new BRepFill_CurveConstraint(aC,Conti);
260 aLocalFace = DBRep::Get(a[Indice++],TopAbs_FACE);
261 TopoDS_Face F = TopoDS::Face(aLocalFace);
262 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
265 Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
266 S->ChangeSurface().Initialize(F);
267 Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
268 C->ChangeCurve2d().Initialize(E,F);
269 Adaptor3d_CurveOnSurface ConS(C,S);
270 Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
271 Handle(GeomPlate_CurveConstraint) Cont= new BRepFill_CurveConstraint(HConS,Conti);
276 for (i=1; i<=NbPointConstraint ; i++)
280 // gp_Vec V1,V2,V3,V4,V5;
282 if (DrawTrSurf::GetPoint(a[Indice], P1) )
284 Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(P1,0);
289 { Standard_Real u=Draw::Atof(a[Indice++]),
290 v=Draw::Atof(a[Indice++]);
292 Conti=Draw::Atoi(a[Indice++]);
293 aLocalFace = DBRep::Get(a[Indice++],TopAbs_FACE);
294 TopoDS_Face F = TopoDS::Face(aLocalFace);
295 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
298 Handle(BRepAdaptor_HSurface) HF = new BRepAdaptor_HSurface();
299 HF->ChangeSurface().Initialize(F);
300 Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(u,v,BRep_Tool::Surface(HF->ChangeSurface().Face()),Conti,0.001,0.001,0.001);
305 Standard_Integer nbcarreau=9;
306 Standard_Integer degmax=8;
309 Handle(GeomPlate_Surface) gpPlate = Henri.Surface();
310 TColgp_SequenceOfXY S2d;
311 TColgp_SequenceOfXYZ S3d;
314 Henri.Disc2dContour(4,S2d);
315 Henri.Disc3dContour(4,0,S3d);
316 seuil = Max(0.0001,10*Henri.G0Error());
317 GeomPlate_PlateG0Criterion critere (S2d,S3d,seuil);
318 GeomPlate_MakeApprox Mapp(gpPlate,critere,0.0001,nbcarreau,degmax);
319 Handle (Geom_Surface) Surf (Mapp.Surface());
321 Standard_Real Umin, Umax, Vmin, Vmax;
323 Henri.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
325 BRepBuilderAPI_MakeFace MF(Surf, Umin, Umax, Vmin, Vmax, Precision::Confusion());
327 DBRep::Set(a[1],MF.Face());
332 ////////////////////////////////////////////////////////////////////////////////
333 // commande approxplate : resultat face sur surface approchee
334 ////////////////////////////////////////////////////////////////////////////////
336 static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,const char** a)
338 if (n < 9 ) return 1;
339 Standard_Integer NbMedium=Draw::Atoi(a[2]);
340 Standard_Integer NbCurFront=Draw::Atoi(a[3]);
341 Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront);
342 Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront);
343 Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront);
345 GeomPlate_BuildPlateSurface Henri(3,15,2);
348 for (i=1; i<=NbCurFront ; i++) {
349 TopoDS_Shape aLocalShape(DBRep::Get(a[3*i+1],TopAbs_EDGE));
350 TopoDS_Edge E = TopoDS::Edge(aLocalShape);
351 // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
352 if(E.IsNull()) return 1;
353 TopoDS_Shape aLocalFace(DBRep::Get(a[3*i+2],TopAbs_FACE));
354 TopoDS_Face F = TopoDS::Face(aLocalFace);
355 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[3*i+2],TopAbs_FACE));
356 if(F.IsNull()) return 1;
357 Standard_Integer T = Draw::Atoi(a[3*i+3]);
359 NbPtsCur->SetValue(i,NbMedium);
360 Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
361 S->ChangeSurface().Initialize(F);
362 Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
363 C->ChangeCurve2d().Initialize(E,F);
364 Adaptor3d_CurveOnSurface ConS(C,S);
365 Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
366 Fronts->SetValue(i,HConS);
367 Handle(GeomPlate_CurveConstraint) Cont
368 = new BRepFill_CurveConstraint(HConS,
376 Standard_Real dmax = Henri.G0Error(),
377 anmax = Henri.G1Error();
378 //cout<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<endl;
379 di<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<"\n";
381 Tol3d = Draw::Atof(a[3*NbCurFront+4]);
382 Standard_Integer Nbmax = Draw::Atoi(a[3*NbCurFront+5]);
383 Standard_Integer degmax = Draw::Atoi(a[3*NbCurFront+6]);
384 Standard_Integer CritOrder = Draw::Atoi(a[3*NbCurFront+7]);
385 Handle(GeomPlate_Surface) surf = Henri.Surface();
386 Handle(Geom_BSplineSurface) support;
389 GeomPlate_MakeApprox MApp(surf,Tol3d,Nbmax,degmax,dmax,-1);
390 support = MApp.Surface();
392 else if (CritOrder>=0) {
393 TColgp_SequenceOfXY S2d;
394 TColgp_SequenceOfXYZ S3d;
399 Henri.Disc2dContour(4,S2d);
400 Henri.Disc3dContour(4,0,S3d);
401 seuil = Max(Tol3d,dmax*10);
402 GeomPlate_PlateG0Criterion Crit0(S2d,S3d,seuil);
403 GeomPlate_MakeApprox MApp(surf,Crit0,Tol3d,Nbmax,degmax);
404 support = MApp.Surface();
406 else if (CritOrder==1) {
407 Henri.Disc2dContour(4,S2d);
408 Henri.Disc3dContour(4,1,S3d);
409 seuil = Max(Tol3d,anmax*10);
410 GeomPlate_PlateG1Criterion Crit1(S2d,S3d,seuil);
411 GeomPlate_MakeApprox MApp(surf,Crit1,Tol3d,Nbmax,degmax);
412 support = MApp.Surface();
416 BRepBuilderAPI_MakeWire MW;
418 for (i=1 ; i<=NbCurFront ; i++) {
419 Standard_Integer iInOrder=Henri.Order()->Value(i);
421 if (Henri.Sense()->Value(iInOrder)==1) {
422 BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
424 Fronts->Value(iInOrder)->LastParameter(),
425 Fronts->Value(iInOrder)->FirstParameter());
429 BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
431 Fronts->Value(iInOrder)->FirstParameter(),
432 Fronts->Value(iInOrder)->LastParameter());
435 B.UpdateVertex(TopExp::FirstVertex(E), dmax);
436 B.UpdateVertex(TopExp::LastVertex(E), dmax);
437 BRepLib::BuildCurve3d(E);
439 if (MW.IsDone()==Standard_False) {
440 Standard_Failure::Raise("mkWire is over ");
445 if (!(W.Closed())) Standard_Failure::Raise("Wire is not closed");
446 BRepBuilderAPI_MakeFace MF(support,W,Standard_True);
447 DBRep::Set(a[1],MF.Face());
452 static Standard_Integer filling( Draw_Interpretor & di, Standard_Integer n, const char** a )
456 OSD_Chronometer Chrono;
462 Standard_Integer NbBounds = Draw::Atoi( a[2] );
463 Standard_Integer NbConstraints = Draw::Atoi( a[3] );
464 Standard_Integer NbPoints = Draw::Atoi( a[4] );
466 BRepOffsetAPI_MakeFilling MakeFilling( Degree,
476 //TopoDS_Shape aLocalFace(DBRep::Get( a[5], TopAbs_FACE ) );
477 //TopoDS_Face InitFace = TopoDS::Face( aLocalFace);
478 TopoDS_Face InitFace = TopoDS::Face( DBRep::Get(a[5], TopAbs_FACE) );
479 if (! InitFace.IsNull())
480 MakeFilling.LoadInitSurface( InitFace );
482 Standard_Integer i = (InitFace.IsNull())? 5 : 6, k;
486 Standard_Integer Order;
487 for (k = 1; k <= NbBounds; k++)
491 //TopoDS_Shape aLocalEdge(DBRep::Get( a[i], TopAbs_EDGE ));
492 //E = TopoDS::Edge(aLocalEdge);
493 E = TopoDS::Edge( DBRep::Get(a[i], TopAbs_EDGE) );
496 //aLocalFace = DBRep::Get( a[i], TopAbs_FACE ) ;
497 //F = TopoDS::Face(aLocalFace);
498 F = TopoDS::Face( DBRep::Get(a[i], TopAbs_FACE) );
502 Order = Draw::Atoi( a[i++] );
504 if (! E.IsNull() && ! F.IsNull())
505 MakeFilling.Add( E, F, (GeomAbs_Shape)Order );
510 //cout<<endl<<"Wrong parameters"<<endl<<endl;
511 di<<"\nWrong parameters\n\n";
515 MakeFilling.Add( F, (GeomAbs_Shape)Order );
518 MakeFilling.Add( E, (GeomAbs_Shape)Order );
520 for (k = 1; k <= NbConstraints; k++)
524 //TopoDS_Shape aLocalEdge(DBRep::Get( a[i++], TopAbs_EDGE ));
525 //E = TopoDS::Edge( aLocalEdge);
526 E = TopoDS::Edge( DBRep::Get(a[i++], TopAbs_EDGE) );
529 //cout<<"Wrong parameters"<<endl;
530 di<<"Wrong parameters\n";
533 //TopoDS_Shape alocalFace(DBRep::Get( a[i], TopAbs_FACE ) );
534 //F = TopoDS::Face( alocalFace);
535 F = TopoDS::Face( DBRep::Get(a[i], TopAbs_FACE) );
539 Order = Draw::Atoi( a[i++] );
542 MakeFilling.Add( E, (GeomAbs_Shape)Order, Standard_False );
544 MakeFilling.Add( E, F, (GeomAbs_Shape)Order, Standard_False );
546 for (k = 1; k <= NbPoints; k++)
548 if (DrawTrSurf::GetPoint( a[i], Point ))
550 MakeFilling.Add( Point );
555 Standard_Real U = Draw::Atof( a[i++] ), V = Draw::Atof( a[i++] );
556 //aLocalFace = DBRep::Get( a[i++], TopAbs_FACE );
557 //F = TopoDS::Face( aLocalFace);
558 F = TopoDS::Face( DBRep::Get(a[i++], TopAbs_FACE));
561 //cout<<"Wrong parameters"<<endl;
562 di<<"Wrong parameters\n";
565 Order = Draw::Atoi( a[i++] );
567 MakeFilling.Add( U, V, F, (GeomAbs_Shape)Order );
572 if (! MakeFilling.IsDone())
574 //cout<<"filling failed"<<endl;
575 di<<"filling failed\n";
579 Standard_Real dmax = MakeFilling.G0Error(),
580 angmax = MakeFilling.G1Error(),
581 curvmax = MakeFilling.G2Error();
582 //cout<<" dist. max = "<<dmax<<" ; angle max = "<<angmax<<" ; diffcurv max = "<<curvmax<<endl;
583 di<<" dist. max = "<<dmax<<" ; angle max = "<<angmax<<" ; diffcurv max = "<<curvmax<<"\n";
585 TopoDS_Face ResFace= TopoDS::Face( MakeFilling.Shape() );
586 DBRep::Set( a[1], ResFace );
592 //cout<<"*** FIN DE FILLING ***"<<endl;
593 //cout<<"Temps de calcul : "<<Tps<<endl;
594 di<<"*** FIN DE FILLING ***\n";
595 di<<"Temps de calcul : "<<Tps<<"\n";
601 static Standard_Integer fillingparam( Draw_Interpretor & di, Standard_Integer n, const char** a )
605 //cout << "fillingparam : options are" <<endl;
606 //cout << "-l : to list current values" << endl;
607 //cout << "-i : to set default values" << endl;
608 //cout << "-r deg nbPonC nbIt anis : to set filling options" <<endl;
609 //cout << "-c t2d t3d tang tcur : to set tolerances" << endl;
610 //cout << "-a maxdeg maxseg : Approximation option" << endl;
611 di << "fillingparam : options are" <<"\n";
612 di << "-l : to list current values\n";
613 di << "-i : to set default values" << "\n";
614 di << "-r deg nbPonC nbIt anis : to set filling options\n";
615 di << "-c t2d t3d tang tcur : to set tolerances\n";
616 di << "-a maxdeg maxseg : Approximation option\n";
620 TCollection_AsciiString AS( a[1] );
622 const char* flag = AS.ToCString();
623 if (strcmp( flag, "-l" ) == 0 && n == 2)
626 //cout<<"Degree = "<<Degree<<endl;
627 //cout<<"NbPtsOnCur = "<<NbPtsOnCur<<endl;
628 //cout<<"NbIter = "<<NbIter<<endl;
629 //cout<<"Anisotropie = "<<Anisotropie<<endl<<endl;
631 //cout<<"Tol2d = "<<Tol2d<<endl;
632 //cout<<"Tol3d = "<<Tol3d<<endl;
633 //cout<<"TolAng = "<<TolAng<<endl;
634 //cout<<"TolCurv = "<<TolCurv<<endl<<endl;
636 //cout<<"MaxDeg = "<<MaxDeg<<endl;
637 //cout<<"MaxSegments = "<<MaxSegments<<endl<<endl;
639 di<<"Degree = "<<Degree<<"\n";
640 di<<"NbPtsOnCur = "<<NbPtsOnCur<<"\n";
641 di<<"NbIter = "<<NbIter<<"\n";
642 di<<"Anisotropie = "<< (Standard_Integer) Anisotropie<<"\n\n";
644 di<<"Tol2d = "<<Tol2d<<"\n";
645 di<<"Tol3d = "<<Tol3d<<"\n";
646 di<<"TolAng = "<<TolAng<<"\n";
647 di<<"TolCurv = "<<TolCurv<<"\n\n";
649 di<<"MaxDeg = "<<MaxDeg<<"\n";
650 di<<"MaxSegments = "<<MaxSegments<<"\n\n";
652 else if (strcmp( flag, "-i" ) == 0 && n == 2)
655 NbPtsOnCur = defNbPtsOnCur;
657 Anisotropie = defAnisotropie;
662 TolCurv = defTolCurv;
665 MaxSegments = defMaxSegments;
667 else if (strcmp( flag, "-r" ) == 0 && n == 6)
669 Degree = Draw::Atoi( a[2] );
670 NbPtsOnCur = Draw::Atoi( a[3] );
671 NbIter = Draw::Atoi( a[4] );
672 Anisotropie = Draw::Atoi( a[5] ) != 0;
674 else if (strcmp( flag, "-c" ) == 0 && n == 6)
676 Tol2d = Draw::Atof( a[2] );
677 Tol3d = Draw::Atof( a[3] );
678 TolAng = Draw::Atof( a[4] );
679 TolCurv = Draw::Atof( a[5] );
681 else if (strcmp( flag, "-a" ) == 0 && n == 4)
683 MaxDeg = Draw::Atoi( a[2] );
684 MaxSegments = Draw::Atoi( a[3] );
688 //cout<<"Wrong parameters"<<endl;
689 di<<"Wrong parameters\n";
699 void BRepTest::FillingCommands(Draw_Interpretor& theCommands)
701 static Standard_Boolean done = Standard_False;
703 done = Standard_True;
705 DBRep::BasicCommands(theCommands);
706 GeometryTest::SurfaceCommands(theCommands);
708 const char* g = "Surface filling topology commands";
709 theCommands.Add("plate",
710 "plate result nbrpntoncurve nbrcurfront edge face tang (0:vif;1:tang) ...",
715 theCommands.Add("gplate",
716 "gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]... [point] [u v tang (1:G1;2:G2) surf] ...",
721 theCommands.Add("approxplate",
722 "approxplate result nbrpntoncurve nbrcurfront edge face tang (0:vif;1:tang) ... tol nmax degmax crit",
729 theCommands.Add("filling",
730 "filling result nbB nbC nbP [SurfInit] [edge][face]order... edge[face]order... point/u v face order...",
735 theCommands.Add("fillingparam",
736 "fillingparam : no arg give help",