//
// This file is part of Open CASCADE Technology software library.
//
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
#include <GeomPlate_BuildAveragePlane.hxx>
#include <GeomPlate_Surface.hxx>
#include <GeomPlate_BuildAveragePlane.hxx>
-#include <GeomPlate_HArray1OfHCurveOnSurface.hxx>
+#include <GeomPlate_HArray1OfHCurve.hxx>
#include <GeomPlate_MakeApprox.hxx>
#include <GeomPlate_PlateG0Criterion.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <GeomConvert_ApproxSurface.hxx>
+#include <BRepTest_Objects.hxx>
#include <stdio.h>
#include <gp_Pnt.hxx>
// pour mes tests
-#ifdef DEB
+#ifdef OCCT_DEBUG
#include <OSD_Chronometer.hxx>
#include <Geom_Line.hxx>
#endif
{
if (n < 8 ) return 1;
Standard_Integer NbCurFront=Draw::Atoi(a[3]);
- Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront);
+ Handle(GeomPlate_HArray1OfHCurve) Fronts = new GeomPlate_HArray1OfHCurve(1,NbCurFront);
Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront);
Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront);
BRep_Builder B;
Adaptor3d_CurveOnSurface ConS(C,S);
Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
Fronts->SetValue(i,HConS);
- Handle(BRepFill_CurveConstraint) Cont
+ Handle(GeomPlate_CurveConstraint) Cont
= new BRepFill_CurveConstraint(HConS,
Tang->Value(i),
NbPtsCur->Value(i));
Henri.Perform();
Standard_Real ErrG0 = 1.1*Henri.G0Error();
- //cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<endl;
+ //std::cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<std::endl;
di<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<"\n";
BRepBuilderAPI_MakeWire MW;
DBRep::Set(name, E);
MW.Add(E);
if (MW.IsDone()==Standard_False) {
- Standard_Failure::Raise("mkWire is over ");
+ throw Standard_Failure("mkWire is over ");
}
}
TopoDS_Wire W;
W=MW.Wire();
- if (!(W.Closed())) Standard_Failure::Raise("Wire is not closed");
+ if (!(W.Closed())) throw Standard_Failure("Wire is not closed");
BRepBuilderAPI_MakeFace MF(Henri.Surface(),W,Standard_True);
DBRep::Set(a[1],MF.Face());
return 0;
if ((Conti==0)||(Conti==-1))
{ Handle(BRepAdaptor_HCurve) C = new BRepAdaptor_HCurve();
C->ChangeCurve().Initialize(E);
- Handle(BRepFill_CurveConstraint) Cont= new BRepFill_CurveConstraint(C,Conti);
+ const Handle(Adaptor3d_HCurve)& aC = C; // to avoid ambiguity
+ Handle(GeomPlate_CurveConstraint) Cont= new BRepFill_CurveConstraint(aC,Conti);
Henri.Add(Cont);
}
else
C->ChangeCurve2d().Initialize(E,F);
Adaptor3d_CurveOnSurface ConS(C,S);
Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
- Handle(BRepFill_CurveConstraint) Cont= new BRepFill_CurveConstraint(HConS,Conti);
+ Handle(GeomPlate_CurveConstraint) Cont= new BRepFill_CurveConstraint(HConS,Conti);
Henri.Add(Cont);
}
}
if (n < 9 ) return 1;
Standard_Integer NbMedium=Draw::Atoi(a[2]);
Standard_Integer NbCurFront=Draw::Atoi(a[3]);
- Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront);
+ Handle(GeomPlate_HArray1OfHCurve) Fronts = new GeomPlate_HArray1OfHCurve(1,NbCurFront);
Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront);
Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront);
Adaptor3d_CurveOnSurface ConS(C,S);
Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
Fronts->SetValue(i,HConS);
- Handle(BRepFill_CurveConstraint) Cont
+ Handle(GeomPlate_CurveConstraint) Cont
= new BRepFill_CurveConstraint(HConS,
Tang->Value(i),
NbPtsCur->Value(i));
Standard_Real dmax = Henri.G0Error(),
anmax = Henri.G1Error();
- //cout<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<endl;
+ //std::cout<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<std::endl;
di<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<"\n";
Tol3d = Draw::Atof(a[3*NbCurFront+4]);
BRepLib::BuildCurve3d(E);
MW.Add(E);
if (MW.IsDone()==Standard_False) {
- Standard_Failure::Raise("mkWire is over ");
+ throw Standard_Failure("mkWire is over ");
}
}
TopoDS_Wire W;
W=MW.Wire();
- if (!(W.Closed())) Standard_Failure::Raise("Wire is not closed");
+ if (!(W.Closed())) throw Standard_Failure("Wire is not closed");
BRepBuilderAPI_MakeFace MF(support,W,Standard_True);
DBRep::Set(a[1],MF.Face());
static Standard_Integer filling( Draw_Interpretor & di, Standard_Integer n, const char** a )
{
-#ifdef DEB
- // Chronmetrage
+#ifdef OCCT_DEBUG
+ // Chronometrage
OSD_Chronometer Chrono;
Chrono.Reset();
Chrono.Start();
#endif
- if (n < 7) return 1;
+ if (n < 7)
+ {
+ di.PrintHelp(a[0]);
+ return 1;
+ }
+
Standard_Integer NbBounds = Draw::Atoi( a[2] );
Standard_Integer NbConstraints = Draw::Atoi( a[3] );
Standard_Integer NbPoints = Draw::Atoi( a[4] );
TolCurv,
MaxDeg,
MaxSegments );
- //TopoDS_Shape aLocalFace(DBRep::Get( a[5], TopAbs_FACE ) );
- //TopoDS_Face InitFace = TopoDS::Face( aLocalFace);
TopoDS_Face InitFace = TopoDS::Face( DBRep::Get(a[5], TopAbs_FACE) );
if (! InitFace.IsNull())
MakeFilling.LoadInitSurface( InitFace );
TopoDS_Face F;
gp_Pnt Point;
Standard_Integer Order;
+ TopTools_ListOfShape ListForHistory;
for (k = 1; k <= NbBounds; k++)
- {
- E.Nullify();
- F.Nullify();
- //TopoDS_Shape aLocalEdge(DBRep::Get( a[i], TopAbs_EDGE ));
- //E = TopoDS::Edge(aLocalEdge);
- E = TopoDS::Edge( DBRep::Get(a[i], TopAbs_EDGE) );
- if (! E.IsNull())
- i++;
- //aLocalFace = DBRep::Get( a[i], TopAbs_FACE ) ;
- //F = TopoDS::Face(aLocalFace);
- F = TopoDS::Face( DBRep::Get(a[i], TopAbs_FACE) );
- if (! F.IsNull())
- i++;
-
- Order = Draw::Atoi( a[i++] );
-
- if (! E.IsNull() && ! F.IsNull())
- MakeFilling.Add( E, F, (GeomAbs_Shape)Order );
- else if (E.IsNull())
- {
- if (F.IsNull())
- {
- //cout<<endl<<"Wrong parameters"<<endl<<endl;
- di<<"\n"<<"Wrong parameters"<<"\n"<<"\n";
- return 1;
- }
- else
- MakeFilling.Add( F, (GeomAbs_Shape)Order );
- }
+ {
+ E.Nullify();
+ F.Nullify();
+ E = TopoDS::Edge( DBRep::Get(a[i], TopAbs_EDGE) );
+ if (! E.IsNull())
+ i++;
+ F = TopoDS::Face( DBRep::Get(a[i], TopAbs_FACE) );
+ if (! F.IsNull())
+ i++;
+
+ Order = Draw::Atoi( a[i++] );
+
+ if (! E.IsNull() && ! F.IsNull())
+ MakeFilling.Add( E, F, (GeomAbs_Shape)Order );
+ else if (E.IsNull())
+ {
+ if (F.IsNull())
+ {
+ di<<"\nWrong parameters\n\n";
+ return 1;
+ }
else
- MakeFilling.Add( E, (GeomAbs_Shape)Order );
+ MakeFilling.Add( F, (GeomAbs_Shape)Order );
}
+ else
+ MakeFilling.Add( E, (GeomAbs_Shape)Order );
+
+ //History
+ if (!E.IsNull())
+ ListForHistory.Append(E);
+ }
for (k = 1; k <= NbConstraints; k++)
- {
- E.Nullify();
- F.Nullify();
- //TopoDS_Shape aLocalEdge(DBRep::Get( a[i++], TopAbs_EDGE ));
- //E = TopoDS::Edge( aLocalEdge);
- E = TopoDS::Edge( DBRep::Get(a[i++], TopAbs_EDGE) );
- if (E.IsNull())
- {
- //cout<<"Wrong parameters"<<endl;
- di<<"Wrong parameters"<<"\n";
- return 1;
- }
- //TopoDS_Shape alocalFace(DBRep::Get( a[i], TopAbs_FACE ) );
- //F = TopoDS::Face( alocalFace);
- F = TopoDS::Face( DBRep::Get(a[i], TopAbs_FACE) );
- if (! F.IsNull())
- i++;
-
- Order = Draw::Atoi( a[i++] );
-
- if (F.IsNull())
- MakeFilling.Add( E, (GeomAbs_Shape)Order, Standard_False );
- else
- MakeFilling.Add( E, F, (GeomAbs_Shape)Order, Standard_False );
+ {
+ E.Nullify();
+ F.Nullify();
+ E = TopoDS::Edge( DBRep::Get(a[i++], TopAbs_EDGE) );
+ if (E.IsNull())
+ {
+ di<<"Wrong parameters\n";
+ return 1;
}
+ F = TopoDS::Face( DBRep::Get(a[i], TopAbs_FACE) );
+ if (! F.IsNull())
+ i++;
+
+ Order = Draw::Atoi( a[i++] );
+
+ if (F.IsNull())
+ MakeFilling.Add( E, (GeomAbs_Shape)Order, Standard_False );
+ else
+ MakeFilling.Add( E, F, (GeomAbs_Shape)Order, Standard_False );
+ }
for (k = 1; k <= NbPoints; k++)
+ {
+ if (DrawTrSurf::GetPoint( a[i], Point ))
{
- if (DrawTrSurf::GetPoint( a[i], Point ))
- {
- MakeFilling.Add( Point );
- i++;
- }
- else
- {
- Standard_Real U = Draw::Atof( a[i++] ), V = Draw::Atof( a[i++] );
- //aLocalFace = DBRep::Get( a[i++], TopAbs_FACE );
- //F = TopoDS::Face( aLocalFace);
- F = TopoDS::Face( DBRep::Get(a[i++], TopAbs_FACE));
- if (F.IsNull())
- {
- //cout<<"Wrong parameters"<<endl;
- di<<"Wrong parameters"<<"\n";
- return 1;
- }
- Order = Draw::Atoi( a[i++] );
-
- MakeFilling.Add( U, V, F, (GeomAbs_Shape)Order );
- }
+ MakeFilling.Add( Point );
+ i++;
}
-
- MakeFilling.Build();
- if (! MakeFilling.IsDone())
+ else
{
- //cout<<"filling failed"<<endl;
- di<<"filling failed"<<"\n";
- return 0;
+ Standard_Real U = Draw::Atof( a[i++] ), V = Draw::Atof( a[i++] );
+ F = TopoDS::Face( DBRep::Get(a[i++], TopAbs_FACE));
+ if (F.IsNull())
+ {
+ di<<"Wrong parameters\n";
+ return 1;
+ }
+ Order = Draw::Atoi( a[i++] );
+
+ MakeFilling.Add( U, V, F, (GeomAbs_Shape)Order );
}
-
+ }
+
+ MakeFilling.Build();
+ if (! MakeFilling.IsDone())
+ {
+ di<<"filling failed\n";
+ return 0;
+ }
+
Standard_Real dmax = MakeFilling.G0Error(),
- angmax = MakeFilling.G1Error(),
- curvmax = MakeFilling.G2Error();
- //cout<<" dist. max = "<<dmax<<" ; angle max = "<<angmax<<" ; diffcurv max = "<<curvmax<<endl;
+ angmax = MakeFilling.G1Error(),
+ curvmax = MakeFilling.G2Error();
di<<" dist. max = "<<dmax<<" ; angle max = "<<angmax<<" ; diffcurv max = "<<curvmax<<"\n";
-
+
TopoDS_Face ResFace= TopoDS::Face( MakeFilling.Shape() );
DBRep::Set( a[1], ResFace );
-#ifdef DEB
+#ifdef OCCT_DEBUG
Chrono.Stop();
Standard_Real Tps;
Chrono.Show(Tps);
- //cout<<"*** FIN DE FILLING ***"<<endl;
- //cout<<"Temps de calcul : "<<Tps<<endl;
- di<<"*** FIN DE FILLING ***"<<"\n";
+ di<<"*** FIN DE FILLING ***\n";
di<<"Temps de calcul : "<<Tps<<"\n";
#endif
+ //History
+ if (BRepTest_Objects::IsHistoryNeeded())
+ BRepTest_Objects::SetHistory(ListForHistory, MakeFilling);
+
return 0;
}
{
if ( n == 1) {
- //cout << "fillingparam : options are" <<endl;
- //cout << "-l : to list current values" << endl;
- //cout << "-i : to set default values" << endl;
- //cout << "-r deg nbPonC nbIt anis : to set filling options" <<endl;
- //cout << "-c t2d t3d tang tcur : to set tolerances" << endl;
- //cout << "-a maxdeg maxseg : Approximation option" << endl;
+ //std::cout << "fillingparam : options are" <<std::endl;
+ //std::cout << "-l : to list current values" << std::endl;
+ //std::cout << "-i : to set default values" << std::endl;
+ //std::cout << "-r deg nbPonC nbIt anis : to set filling options" <<std::endl;
+ //std::cout << "-c t2d t3d tang tcur : to set tolerances" << std::endl;
+ //std::cout << "-a maxdeg maxseg : Approximation option" << std::endl;
di << "fillingparam : options are" <<"\n";
- di << "-l : to list current values" << "\n";
+ di << "-l : to list current values\n";
di << "-i : to set default values" << "\n";
- di << "-r deg nbPonC nbIt anis : to set filling options" <<"\n";
- di << "-c t2d t3d tang tcur : to set tolerances" << "\n";
- di << "-a maxdeg maxseg : Approximation option" << "\n";
+ di << "-r deg nbPonC nbIt anis : to set filling options\n";
+ di << "-c t2d t3d tang tcur : to set tolerances\n";
+ di << "-a maxdeg maxseg : Approximation option\n";
}
else if (n > 1)
{
const char* flag = AS.ToCString();
if (strcmp( flag, "-l" ) == 0 && n == 2)
{
- //cout<<endl;
- //cout<<"Degree = "<<Degree<<endl;
- //cout<<"NbPtsOnCur = "<<NbPtsOnCur<<endl;
- //cout<<"NbIter = "<<NbIter<<endl;
- //cout<<"Anisotropie = "<<Anisotropie<<endl<<endl;
+ //std::cout<<std::endl;
+ //std::cout<<"Degree = "<<Degree<<std::endl;
+ //std::cout<<"NbPtsOnCur = "<<NbPtsOnCur<<std::endl;
+ //std::cout<<"NbIter = "<<NbIter<<std::endl;
+ //std::cout<<"Anisotropie = "<<Anisotropie<<std::endl<<std::endl;
//
- //cout<<"Tol2d = "<<Tol2d<<endl;
- //cout<<"Tol3d = "<<Tol3d<<endl;
- //cout<<"TolAng = "<<TolAng<<endl;
- //cout<<"TolCurv = "<<TolCurv<<endl<<endl;
+ //std::cout<<"Tol2d = "<<Tol2d<<std::endl;
+ //std::cout<<"Tol3d = "<<Tol3d<<std::endl;
+ //std::cout<<"TolAng = "<<TolAng<<std::endl;
+ //std::cout<<"TolCurv = "<<TolCurv<<std::endl<<std::endl;
//
- //cout<<"MaxDeg = "<<MaxDeg<<endl;
- //cout<<"MaxSegments = "<<MaxSegments<<endl<<endl;
+ //std::cout<<"MaxDeg = "<<MaxDeg<<std::endl;
+ //std::cout<<"MaxSegments = "<<MaxSegments<<std::endl<<std::endl;
di<<"\n";
di<<"Degree = "<<Degree<<"\n";
di<<"NbPtsOnCur = "<<NbPtsOnCur<<"\n";
di<<"NbIter = "<<NbIter<<"\n";
- di<<"Anisotropie = "<< (Standard_Integer) Anisotropie<<"\n"<<"\n";
+ di<<"Anisotropie = "<< (Standard_Integer) Anisotropie<<"\n\n";
di<<"Tol2d = "<<Tol2d<<"\n";
di<<"Tol3d = "<<Tol3d<<"\n";
di<<"TolAng = "<<TolAng<<"\n";
- di<<"TolCurv = "<<TolCurv<<"\n"<<"\n";
+ di<<"TolCurv = "<<TolCurv<<"\n\n";
di<<"MaxDeg = "<<MaxDeg<<"\n";
- di<<"MaxSegments = "<<MaxSegments<<"\n"<<"\n";
+ di<<"MaxSegments = "<<MaxSegments<<"\n\n";
}
else if (strcmp( flag, "-i" ) == 0 && n == 2)
{
Degree = Draw::Atoi( a[2] );
NbPtsOnCur = Draw::Atoi( a[3] );
NbIter = Draw::Atoi( a[4] );
- Anisotropie = Draw::Atoi( a[5] );
+ Anisotropie = Draw::Atoi( a[5] ) != 0;
}
else if (strcmp( flag, "-c" ) == 0 && n == 6)
{
}
else
{
- //cout<<"Wrong parameters"<<endl;
- di<<"Wrong parameters"<<"\n";
+ //std::cout<<"Wrong parameters"<<std::endl;
+ di<<"Wrong parameters\n";
return 1;
}
}