1 // File: BRepTest_FillingCommands.cxx
2 // Created: Wed Jul 10 13:23:02 1996
3 // Author: Xavier BENVENISTE
4 // <xab@mentox.paris1.matra-dtv.fr>
5 // Modified: Wed Mar 5 09:45:42 1997
7 // G1134 : new command "approxplate"
8 // Modified: Thu Jun 12 16:51:36 1997
10 // Mise a jour suite a la modification des methodes Curves2d
11 // et Sense GeomPlate_BuildPlateSurface.
12 // Modified: Mon Nov 3 10:24:07 1997
13 // Author: Joelle CHAUVET
14 // utilisation de BRepFill_CurveConstraint
18 #include <GeometryTest.hxx>
19 #include <Draw_Interpretor.hxx>
20 #include <Draw_Appli.hxx>
21 #include <DrawTrSurf.hxx>
22 #include <TopAbs_ShapeEnum.hxx>
24 #include <TopoDS_Edge.hxx>
25 #include <TopoDS_Face.hxx>
26 #include <TopExp_Explorer.hxx>
28 #include <BRepAdaptor_HSurface.hxx>
29 #include <BRepAdaptor_HCurve2d.hxx>
30 #include <BRepAdaptor_HCurve.hxx>
31 #include <BRepAdaptor_Surface.hxx>
32 #include <BRepAdaptor_Curve2d.hxx>
33 #include <BRepAdaptor_Curve.hxx>
34 #include <BRepTest.hxx>
36 #include <Adaptor3d_HCurveOnSurface.hxx>
37 #include <Adaptor3d_CurveOnSurface.hxx>
38 #include <TColStd_HArray1OfInteger.hxx>
39 #include <BRep_Tool.hxx>
41 #include <BRepLib.hxx>
42 #include <BRep_Builder.hxx>
43 #include <GeomPlate_BuildPlateSurface.hxx>
44 #include <GeomPlate_BuildAveragePlane.hxx>
45 #include <GeomPlate_Surface.hxx>
46 #include <GeomPlate_BuildAveragePlane.hxx>
47 #include <GeomPlate_HArray1OfHCurveOnSurface.hxx>
49 #include <GeomPlate_MakeApprox.hxx>
50 #include <GeomPlate_PlateG0Criterion.hxx>
51 #include <GeomPlate_PlateG1Criterion.hxx>
52 #include <BRepFill_CurveConstraint.hxx>
53 #include <GeomPlate_PointConstraint.hxx>
54 #include <GeomAdaptor_HSurface.hxx>
55 #include <Geom_Surface.hxx>
57 #include <TopoDS_Wire.hxx>
58 #include <BRepBuilderAPI_MakeEdge.hxx>
59 #include <BRepBuilderAPI_MakeWire.hxx>
60 #include <BRepBuilderAPI_WireError.hxx>
61 #include <BRepBuilderAPI_MakeFace.hxx>
62 #include <TColGeom2d_HArray1OfCurve.hxx>
64 #include <AdvApp2Var_ApproxAFunc2Var.hxx>
65 #include <AdvApp2Var_Context.hxx>
66 #include <AdvApprox_PrefCutting.hxx>
67 #include <AdvApprox_Cutting.hxx>
68 #include <AdvApprox_DichoCutting.hxx>
70 #include <Geom_BSplineSurface.hxx>
72 #include <TColStd_HArray1OfReal.hxx>
73 #include <TColStd_HArray2OfReal.hxx>
75 #include <TColgp_SequenceOfXY.hxx>
76 #include <TColgp_SequenceOfXYZ.hxx>
78 #include <BRepAdaptor_HCurve.hxx>
79 #include <Adaptor3d_HIsoCurve.hxx>
81 #include <Extrema_ExtPS.hxx>
82 #include <Extrema_POnSurf.hxx>
83 #include <Geom_Plane.hxx>
84 #include <BRepOffsetAPI_MakeFilling.hxx>
85 #include <TCollection_AsciiString.hxx>
86 #include <Geom2d_TrimmedCurve.hxx>
87 #include <GeomConvert_ApproxSurface.hxx>
95 #include <OSD_Chronometer.hxx>
96 #include <Geom_Line.hxx>
99 const Standard_Integer defDegree = 3;
100 const Standard_Integer defNbPtsOnCur = 10;
101 const Standard_Integer defNbIter = 3;
102 const Standard_Boolean defAnisotropie = Standard_False;
103 const Standard_Real defTol2d = 0.00001;
104 const Standard_Real defTol3d = 0.0001;
105 const Standard_Real defTolAng = 0.01;
106 const Standard_Real defTolCurv = 0.1;
107 const Standard_Integer defMaxDeg = 8;
108 const Standard_Integer defMaxSegments = 9;
110 Standard_Integer Degree = defDegree;
111 Standard_Integer NbPtsOnCur = defNbPtsOnCur ;
112 Standard_Integer NbIter = defNbIter;
113 Standard_Boolean Anisotropie = defAnisotropie ;
114 Standard_Real Tol2d = defTol2d;
115 Standard_Real Tol3d = defTol3d;
116 Standard_Real TolAng = defTolAng;
117 Standard_Real TolCurv = defTolCurv;
118 Standard_Integer MaxDeg = defMaxDeg;
119 Standard_Integer MaxSegments = defMaxSegments;
121 ////////////////////////////////////////////////////////////////////////////////
122 // commande plate : resultat face sur surface plate
123 ////////////////////////////////////////////////////////////////////////////////
125 static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const char** a)
127 if (n < 8 ) return 1;
128 Standard_Integer NbCurFront=atoi(a[3]);
129 Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront);
130 Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront);
131 Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront);
134 GeomPlate_BuildPlateSurface Henri(3,15,2);
137 for (i=1; i<=NbCurFront ; i++) {
138 TopoDS_Shape aLocalEdge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
139 TopoDS_Edge E = TopoDS::Edge(aLocalEdge);
140 // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
141 if(E.IsNull()) return 1;
142 TopoDS_Shape aLocalFace(DBRep::Get(a[3*i+2],TopAbs_FACE));
143 TopoDS_Face F = TopoDS::Face(aLocalFace);
144 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[3*i+2],TopAbs_FACE));
145 if(F.IsNull()) return 1;
146 Standard_Integer T = atoi(a[3*i+3]);
148 NbPtsCur->SetValue(i,atoi(a[2]));
149 Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
150 S->ChangeSurface().Initialize(F);
151 Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
152 C->ChangeCurve2d().Initialize(E,F);
153 Adaptor3d_CurveOnSurface ConS(C,S);
154 Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
155 Fronts->SetValue(i,HConS);
156 Handle(BRepFill_CurveConstraint) Cont
157 = new BRepFill_CurveConstraint(HConS,
165 Standard_Real ErrG0 = 1.1*Henri.G0Error();
166 //cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<endl;
167 di<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<"\n";
169 BRepBuilderAPI_MakeWire MW;
170 for (i=1 ; i<=NbCurFront ; i++) {
171 Standard_Integer iInOrder=Henri.Order()->Value(i);
173 if (Henri.Sense()->Value(iInOrder)==1) {
174 BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
176 Fronts->Value(iInOrder)->LastParameter(),
177 Fronts->Value(iInOrder)->FirstParameter());
182 BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
184 Fronts->Value(iInOrder)->FirstParameter(),
185 Fronts->Value(iInOrder)->LastParameter());
188 B.UpdateVertex(TopExp::FirstVertex(E), ErrG0);
189 B.UpdateVertex(TopExp::LastVertex(E), ErrG0);
190 BRepLib::BuildCurve3d(E);
192 sprintf(name,"Edge_%d", i);
195 if (MW.IsDone()==Standard_False) {
197 BRepBuilderAPI_WireError err =
200 Standard_Failure::Raise("mkWire is over ");
206 if (!(W.Closed())) Standard_Failure::Raise("Wire is not closed");
207 BRepBuilderAPI_MakeFace MF(Henri.Surface(),W,Standard_True);
208 DBRep::Set(a[1],MF.Face());
212 ////////////////////////////////////////////////////////////////////////////////
213 // commande gplate : resultat face egale a la surface approchee
214 ////////////////////////////////////////////////////////////////////////////////
216 static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const char** a)
218 if (n < 6 ) return 1;
219 Standard_Integer NbCurFront=atoi(a[2]),
220 NbPointConstraint=atoi(a[3]);
222 GeomPlate_BuildPlateSurface Henri(3,15,2);
225 Standard_Integer Conti;
226 Standard_Integer Indice=4;
228 TopoDS_Shape aLocalFace(DBRep::Get(a[Indice++],TopAbs_FACE));
229 TopoDS_Face SI = TopoDS::Face(aLocalFace);
230 // TopoDS_Face SI = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
234 { Handle(BRepAdaptor_HSurface) HSI = new BRepAdaptor_HSurface();
235 HSI->ChangeSurface().Initialize(SI);
236 Henri.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face()));
238 for (i=1; i<=NbCurFront ; i++) {
239 TopoDS_Shape aLocalShape(DBRep::Get(a[Indice++],TopAbs_EDGE));
240 TopoDS_Edge E = TopoDS::Edge(aLocalShape);
241 // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[Indice++],TopAbs_EDGE));
242 if(E.IsNull()) return 1;
243 Conti=atoi(a[Indice++]);
244 if ((Conti==0)||(Conti==-1))
245 { Handle(BRepAdaptor_HCurve) C = new BRepAdaptor_HCurve();
246 C->ChangeCurve().Initialize(E);
247 Handle(BRepFill_CurveConstraint) Cont= new BRepFill_CurveConstraint(C,Conti);
252 aLocalFace = DBRep::Get(a[Indice++],TopAbs_FACE);
253 TopoDS_Face F = TopoDS::Face(aLocalFace);
254 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
257 Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
258 S->ChangeSurface().Initialize(F);
259 Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
260 C->ChangeCurve2d().Initialize(E,F);
261 Adaptor3d_CurveOnSurface ConS(C,S);
262 Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
263 Handle(BRepFill_CurveConstraint) Cont= new BRepFill_CurveConstraint(HConS,Conti);
268 for (i=1; i<=NbPointConstraint ; i++)
272 // gp_Vec V1,V2,V3,V4,V5;
274 if (DrawTrSurf::GetPoint(a[Indice], P1) )
276 Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(P1,0);
281 { Standard_Real u=atof(a[Indice++]),
284 Conti=atoi(a[Indice++]);
285 aLocalFace = DBRep::Get(a[Indice++],TopAbs_FACE);
286 TopoDS_Face F = TopoDS::Face(aLocalFace);
287 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
290 Handle(BRepAdaptor_HSurface) HF = new BRepAdaptor_HSurface();
291 HF->ChangeSurface().Initialize(F);
292 Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(u,v,BRep_Tool::Surface(HF->ChangeSurface().Face()),Conti,0.001,0.001,0.001);
297 Standard_Integer nbcarreau=9;
298 Standard_Integer degmax=8;
301 Handle(GeomPlate_Surface) gpPlate = Henri.Surface();
302 TColgp_SequenceOfXY S2d;
303 TColgp_SequenceOfXYZ S3d;
306 Henri.Disc2dContour(4,S2d);
307 Henri.Disc3dContour(4,0,S3d);
308 seuil = Max(0.0001,10*Henri.G0Error());
309 GeomPlate_PlateG0Criterion critere (S2d,S3d,seuil);
310 GeomPlate_MakeApprox Mapp(gpPlate,critere,0.0001,nbcarreau,degmax);
311 Handle (Geom_Surface) Surf (Mapp.Surface());
313 Standard_Real Umin, Umax, Vmin, Vmax;
315 Henri.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
317 BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax);
319 DBRep::Set(a[1],MF.Face());
324 ////////////////////////////////////////////////////////////////////////////////
325 // commande approxplate : resultat face sur surface approchee
326 ////////////////////////////////////////////////////////////////////////////////
328 static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,const char** a)
330 if (n < 9 ) return 1;
331 Standard_Integer NbMedium=atoi(a[2]);
332 Standard_Integer NbCurFront=atoi(a[3]);
333 Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront);
334 Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront);
335 Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront);
337 GeomPlate_BuildPlateSurface Henri(3,15,2);
340 for (i=1; i<=NbCurFront ; i++) {
341 TopoDS_Shape aLocalShape(DBRep::Get(a[3*i+1],TopAbs_EDGE));
342 TopoDS_Edge E = TopoDS::Edge(aLocalShape);
343 // TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
344 if(E.IsNull()) return 1;
345 TopoDS_Shape aLocalFace(DBRep::Get(a[3*i+2],TopAbs_FACE));
346 TopoDS_Face F = TopoDS::Face(aLocalFace);
347 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[3*i+2],TopAbs_FACE));
348 if(F.IsNull()) return 1;
349 Standard_Integer T = atoi(a[3*i+3]);
351 NbPtsCur->SetValue(i,NbMedium);
352 Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
353 S->ChangeSurface().Initialize(F);
354 Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
355 C->ChangeCurve2d().Initialize(E,F);
356 Adaptor3d_CurveOnSurface ConS(C,S);
357 Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
358 Fronts->SetValue(i,HConS);
359 Handle(BRepFill_CurveConstraint) Cont
360 = new BRepFill_CurveConstraint(HConS,
368 Standard_Real dmax = Henri.G0Error(),
369 anmax = Henri.G1Error();
370 //cout<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<endl;
371 di<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<"\n";
373 Tol3d = atof(a[3*NbCurFront+4]);
374 Standard_Integer Nbmax = atoi(a[3*NbCurFront+5]);
375 Standard_Integer degmax = atoi(a[3*NbCurFront+6]);
376 Standard_Integer CritOrder = atoi(a[3*NbCurFront+7]);
377 Handle(GeomPlate_Surface) surf = Henri.Surface();
378 Handle(Geom_BSplineSurface) support;
381 GeomPlate_MakeApprox MApp(surf,Tol3d,Nbmax,degmax,dmax,-1);
382 support = MApp.Surface();
384 else if (CritOrder>=0) {
385 TColgp_SequenceOfXY S2d;
386 TColgp_SequenceOfXYZ S3d;
391 Henri.Disc2dContour(4,S2d);
392 Henri.Disc3dContour(4,0,S3d);
393 seuil = Max(Tol3d,dmax*10);
394 GeomPlate_PlateG0Criterion Crit0(S2d,S3d,seuil);
395 GeomPlate_MakeApprox MApp(surf,Crit0,Tol3d,Nbmax,degmax);
396 support = MApp.Surface();
398 else if (CritOrder==1) {
399 Henri.Disc2dContour(4,S2d);
400 Henri.Disc3dContour(4,1,S3d);
401 seuil = Max(Tol3d,anmax*10);
402 GeomPlate_PlateG1Criterion Crit1(S2d,S3d,seuil);
403 GeomPlate_MakeApprox MApp(surf,Crit1,Tol3d,Nbmax,degmax);
404 support = MApp.Surface();
408 BRepBuilderAPI_MakeWire MW;
410 for (i=1 ; i<=NbCurFront ; i++) {
411 Standard_Integer iInOrder=Henri.Order()->Value(i);
413 if (Henri.Sense()->Value(iInOrder)==1) {
414 BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
416 Fronts->Value(iInOrder)->LastParameter(),
417 Fronts->Value(iInOrder)->FirstParameter());
421 BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
423 Fronts->Value(iInOrder)->FirstParameter(),
424 Fronts->Value(iInOrder)->LastParameter());
427 B.UpdateVertex(TopExp::FirstVertex(E), dmax);
428 B.UpdateVertex(TopExp::LastVertex(E), dmax);
429 BRepLib::BuildCurve3d(E);
431 if (MW.IsDone()==Standard_False) {
433 BRepBuilderAPI_WireError err =
436 Standard_Failure::Raise("mkWire is over ");
441 if (!(W.Closed())) Standard_Failure::Raise("Wire is not closed");
442 BRepBuilderAPI_MakeFace MF(support,W,Standard_True);
443 DBRep::Set(a[1],MF.Face());
448 static Standard_Integer filling( Draw_Interpretor & di, Standard_Integer n, const char** a )
452 OSD_Chronometer Chrono;
458 Standard_Integer NbBounds = atoi( a[2] );
459 Standard_Integer NbConstraints = atoi( a[3] );
460 Standard_Integer NbPoints = atoi( a[4] );
462 BRepOffsetAPI_MakeFilling MakeFilling( Degree,
472 TopoDS_Shape aLocalFace(DBRep::Get( a[5], TopAbs_FACE ) );
473 TopoDS_Face InitFace = TopoDS::Face( aLocalFace);
474 // TopoDS_Face InitFace = TopoDS::Face( DBRep::Get( a[5], TopAbs_FACE ) );
475 if (! InitFace.IsNull())
476 MakeFilling.LoadInitSurface( InitFace );
478 Standard_Integer i = (InitFace.IsNull())? 5 : 6, k;
482 Standard_Integer Order;
483 for (k = 1; k <= NbBounds; k++)
487 TopoDS_Shape aLocalEdge(DBRep::Get( a[i], TopAbs_EDGE ));
488 E = TopoDS::Edge(aLocalEdge);
489 // E = TopoDS::Edge( DBRep::Get( a[i], TopAbs_EDGE ) );
492 aLocalFace = DBRep::Get( a[i], TopAbs_FACE ) ;
493 F = TopoDS::Face(aLocalFace);
494 // F = TopoDS::Face( DBRep::Get( a[i], TopAbs_FACE ) );
498 Order = atoi( a[i++] );
500 if (! E.IsNull() && ! F.IsNull())
501 MakeFilling.Add( E, F, (GeomAbs_Shape)Order );
506 //cout<<endl<<"Wrong parameters"<<endl<<endl;
507 di<<"\n"<<"Wrong parameters"<<"\n"<<"\n";
511 MakeFilling.Add( F, (GeomAbs_Shape)Order );
514 MakeFilling.Add( E, (GeomAbs_Shape)Order );
516 for (k = 1; k <= NbConstraints; k++)
520 TopoDS_Shape aLocalEdge(DBRep::Get( a[i++], TopAbs_EDGE ));
521 E = TopoDS::Edge( aLocalEdge);
522 // E = TopoDS::Edge( DBRep::Get( a[i++], TopAbs_EDGE ) );
525 //cout<<"Wrong parameters"<<endl;
526 di<<"Wrong parameters"<<"\n";
529 TopoDS_Shape alocalFace(DBRep::Get( a[i], TopAbs_FACE ) );
530 F = TopoDS::Face( aLocalFace);
531 // F = TopoDS::Face( DBRep::Get( a[i], TopAbs_FACE ) );
535 Order = atoi( a[i++] );
538 MakeFilling.Add( E, (GeomAbs_Shape)Order, Standard_False );
540 MakeFilling.Add( E, F, (GeomAbs_Shape)Order, Standard_False );
542 for (k = 1; k <= NbPoints; k++)
544 if (DrawTrSurf::GetPoint( a[i], Point ))
546 MakeFilling.Add( Point );
551 Standard_Real U = atof( a[i++] ), V = atof( a[i++] );
552 aLocalFace = DBRep::Get( a[i++], TopAbs_FACE );
553 F = TopoDS::Face( aLocalFace);
554 // F = TopoDS::Face( DBRep::Get( a[i++], TopAbs_FACE ));
557 //cout<<"Wrong parameters"<<endl;
558 di<<"Wrong parameters"<<"\n";
561 Order = atoi( a[i++] );
563 MakeFilling.Add( U, V, F, (GeomAbs_Shape)Order );
568 if (! MakeFilling.IsDone())
570 //cout<<"filling failed"<<endl;
571 di<<"filling failed"<<"\n";
575 Standard_Real dmax = MakeFilling.G0Error(),
576 angmax = MakeFilling.G1Error(),
577 curvmax = MakeFilling.G2Error();
578 //cout<<" dist. max = "<<dmax<<" ; angle max = "<<angmax<<" ; diffcurv max = "<<curvmax<<endl;
579 di<<" dist. max = "<<dmax<<" ; angle max = "<<angmax<<" ; diffcurv max = "<<curvmax<<"\n";
581 TopoDS_Face ResFace= TopoDS::Face( MakeFilling.Shape() );
582 DBRep::Set( a[1], ResFace );
588 //cout<<"*** FIN DE FILLING ***"<<endl;
589 //cout<<"Temps de calcul : "<<Tps<<endl;
590 di<<"*** FIN DE FILLING ***"<<"\n";
591 di<<"Temps de calcul : "<<Tps<<"\n";
597 static Standard_Integer fillingparam( Draw_Interpretor & di, Standard_Integer n, const char** a )
601 //cout << "fillingparam : options are" <<endl;
602 //cout << "-l : to list current values" << endl;
603 //cout << "-i : to set default values" << endl;
604 //cout << "-r deg nbPonC nbIt anis : to set filling options" <<endl;
605 //cout << "-c t2d t3d tang tcur : to set tolerances" << endl;
606 //cout << "-a maxdeg maxseg : Approximation option" << endl;
607 di << "fillingparam : options are" <<"\n";
608 di << "-l : to list current values" << "\n";
609 di << "-i : to set default values" << "\n";
610 di << "-r deg nbPonC nbIt anis : to set filling options" <<"\n";
611 di << "-c t2d t3d tang tcur : to set tolerances" << "\n";
612 di << "-a maxdeg maxseg : Approximation option" << "\n";
616 TCollection_AsciiString AS( a[1] );
618 const char* flag = AS.ToCString();
619 if (strcmp( flag, "-l" ) == 0 && n == 2)
622 //cout<<"Degree = "<<Degree<<endl;
623 //cout<<"NbPtsOnCur = "<<NbPtsOnCur<<endl;
624 //cout<<"NbIter = "<<NbIter<<endl;
625 //cout<<"Anisotropie = "<<Anisotropie<<endl<<endl;
627 //cout<<"Tol2d = "<<Tol2d<<endl;
628 //cout<<"Tol3d = "<<Tol3d<<endl;
629 //cout<<"TolAng = "<<TolAng<<endl;
630 //cout<<"TolCurv = "<<TolCurv<<endl<<endl;
632 //cout<<"MaxDeg = "<<MaxDeg<<endl;
633 //cout<<"MaxSegments = "<<MaxSegments<<endl<<endl;
635 di<<"Degree = "<<Degree<<"\n";
636 di<<"NbPtsOnCur = "<<NbPtsOnCur<<"\n";
637 di<<"NbIter = "<<NbIter<<"\n";
638 di<<"Anisotropie = "<< (Standard_Integer) Anisotropie<<"\n"<<"\n";
640 di<<"Tol2d = "<<Tol2d<<"\n";
641 di<<"Tol3d = "<<Tol3d<<"\n";
642 di<<"TolAng = "<<TolAng<<"\n";
643 di<<"TolCurv = "<<TolCurv<<"\n"<<"\n";
645 di<<"MaxDeg = "<<MaxDeg<<"\n";
646 di<<"MaxSegments = "<<MaxSegments<<"\n"<<"\n";
648 else if (strcmp( flag, "-i" ) == 0 && n == 2)
651 NbPtsOnCur = defNbPtsOnCur;
653 Anisotropie = defAnisotropie;
658 TolCurv = defTolCurv;
661 MaxSegments = defMaxSegments;
663 else if (strcmp( flag, "-r" ) == 0 && n == 6)
665 Degree = atoi( a[2] );
666 NbPtsOnCur = atoi( a[3] );
667 NbIter = atoi( a[4] );
668 Anisotropie = atoi( a[5] );
670 else if (strcmp( flag, "-c" ) == 0 && n == 6)
672 Tol2d = atof( a[2] );
673 Tol3d = atof( a[3] );
674 TolAng = atof( a[4] );
675 TolCurv = atof( a[5] );
677 else if (strcmp( flag, "-a" ) == 0 && n == 4)
679 MaxDeg = atoi( a[2] );
680 MaxSegments = atoi( a[3] );
684 //cout<<"Wrong parameters"<<endl;
685 di<<"Wrong parameters"<<"\n";
695 void BRepTest::FillingCommands(Draw_Interpretor& theCommands)
697 static Standard_Boolean done = Standard_False;
699 done = Standard_True;
701 DBRep::BasicCommands(theCommands);
702 GeometryTest::SurfaceCommands(theCommands);
704 const char* g = "Surface filling topology commands";
705 theCommands.Add("plate",
706 "plate result nbrpntoncurve nbrcurfront edge face tang (0:vif;1:tang) ...",
711 theCommands.Add("gplate",
712 "gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]... [point] [u v tang (1:G1;2:G2) surf] ...",
717 theCommands.Add("approxplate",
718 "approxplate result nbrpntoncurve nbrcurfront edge face tang (0:vif;1:tang) ... tol nmax degmax crit",
725 theCommands.Add("filling",
726 "filling result nbB nbC nbP [SurfInit] [edge][face]order... edge[face]order... point/u v face order...",
731 theCommands.Add("fillingparam",
732 "fillingparam : no arg give help",