mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0023870: Integration of new options of sweeping into BRepOffsetAPI_MakePipe algorithm.
Adding test cases for this fix Test cases correction Correction of instability.
This commit is contained in:
parent
0691a5bb8f
commit
471ce7366b
@ -42,6 +42,7 @@ uses
|
||||
Vertex from TopoDS,
|
||||
Pnt from gp,
|
||||
Trsf from gp,
|
||||
Shape from GeomAbs,
|
||||
Trihedron from GeomFill
|
||||
|
||||
raises
|
||||
@ -54,24 +55,11 @@ is
|
||||
|
||||
Create ( Spine : Wire from TopoDS;
|
||||
Profile : Shape from TopoDS;
|
||||
aMode : Trihedron from GeomFill = GeomFill_IsCorrectedFrenet;
|
||||
ForceApproxC1 : Boolean from Standard = Standard_False;
|
||||
GeneratePartCase : Boolean from Standard = Standard_False)
|
||||
returns Pipe from BRepFill;
|
||||
|
||||
SetMode(me : in out;
|
||||
aMode : Trihedron from GeomFill);
|
||||
---Purpose: Set the mode of sweeping
|
||||
-- It can be:
|
||||
-- - Frenet
|
||||
-- - Corrected Frenet
|
||||
-- - Discrete Trihedron
|
||||
-- By default the mode is Corrected Frenet
|
||||
|
||||
SetForceApproxC1(me : in out;
|
||||
ForceApproxC1 : Boolean from Standard);
|
||||
---Purpose: Set the flag that indicates attempt to approximate
|
||||
-- a C1-continuous surface if a swept surface proved
|
||||
-- to be C0.
|
||||
|
||||
Perform (me : in out; Spine : Wire from TopoDS;
|
||||
Profile : Shape from TopoDS;
|
||||
GeneratePartCase : Boolean from Standard = Standard_False)
|
||||
@ -190,6 +178,7 @@ fields
|
||||
|
||||
myDegmax : Integer from Standard;
|
||||
mySegmax : Integer from Standard;
|
||||
myContinuity : Shape from GeomAbs;
|
||||
myMode : Trihedron from GeomFill;
|
||||
myForceApproxC1 : Boolean from Standard;
|
||||
|
||||
|
@ -70,8 +70,9 @@ static Standard_Boolean Affich = 0;
|
||||
|
||||
BRepFill_Pipe::BRepFill_Pipe()
|
||||
{
|
||||
myDegmax = 10;
|
||||
myDegmax = 11;
|
||||
mySegmax = 100;
|
||||
myContinuity = GeomAbs_C2;
|
||||
myMode = GeomFill_IsCorrectedFrenet;
|
||||
myForceApproxC1 = Standard_False;
|
||||
}
|
||||
@ -84,42 +85,26 @@ BRepFill_Pipe::BRepFill_Pipe()
|
||||
|
||||
BRepFill_Pipe::BRepFill_Pipe(const TopoDS_Wire& Spine,
|
||||
const TopoDS_Shape& Profile,
|
||||
const GeomFill_Trihedron aMode,
|
||||
const Standard_Boolean ForceApproxC1,
|
||||
const Standard_Boolean KPart)
|
||||
|
||||
{
|
||||
myDegmax = 10;
|
||||
myDegmax = 11;
|
||||
mySegmax = 100;
|
||||
|
||||
myMode = GeomFill_IsCorrectedFrenet;
|
||||
myForceApproxC1 = Standard_False;
|
||||
Perform(Spine, Profile, KPart);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMode
|
||||
//purpose : Set the mode of sweeping
|
||||
// It can be:
|
||||
// - Frenet
|
||||
// - Corrected Frenet
|
||||
// - Discrete Trihedron
|
||||
//=======================================================================
|
||||
|
||||
void BRepFill_Pipe::SetMode(const GeomFill_Trihedron aMode)
|
||||
{
|
||||
if (aMode == GeomFill_IsFrenet ||
|
||||
aMode == GeomFill_IsCorrectedFrenet ||
|
||||
aMode == GeomFill_IsDiscreteTrihedron)
|
||||
myMode = aMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetForceApproxC1
|
||||
//purpose : Set the flag that indicates attempt to approximate
|
||||
// a C1-continuous surface if a swept surface proved
|
||||
// to be C0.
|
||||
//=======================================================================
|
||||
myContinuity = GeomAbs_C2;
|
||||
if (myMode == GeomFill_IsDiscreteTrihedron)
|
||||
myContinuity = GeomAbs_C0;
|
||||
|
||||
void BRepFill_Pipe::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
|
||||
{
|
||||
myForceApproxC1 = ForceApproxC1;
|
||||
Perform(Spine, Profile, KPart);
|
||||
}
|
||||
|
||||
|
||||
@ -411,7 +396,7 @@ TopoDS_Wire BRepFill_Pipe::PipeLine(const gp_Pnt& Point) const
|
||||
// Sweeping
|
||||
BRepFill_Sweep MkSw(Section, myLoc, Standard_True);
|
||||
MkSw.SetForceApproxC1(myForceApproxC1);
|
||||
MkSw.Build( BRepFill_Modified, GeomAbs_C2, GeomFill_Location, myDegmax, mySegmax );
|
||||
MkSw.Build( BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
TopoDS_Shape aLocalShape = MkSw.Shape();
|
||||
return TopoDS::Wire(aLocalShape);
|
||||
// return TopoDS::Wire(MkSw.Shape());
|
||||
@ -537,7 +522,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
new (BRepFill_ShapeLaw) (TopoDS::Vertex(TheS));
|
||||
BRepFill_Sweep MkSw(Section, myLoc, Standard_True);
|
||||
MkSw.SetForceApproxC1(myForceApproxC1);
|
||||
MkSw.Build( BRepFill_Modified, GeomAbs_C2, GeomFill_Location, myDegmax, mySegmax );
|
||||
MkSw.Build( BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
result = MkSw.Shape();
|
||||
}
|
||||
|
||||
@ -548,7 +533,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
MkSw.SetBounds(TopoDS::Wire(TheFirst),
|
||||
TopoDS::Wire(TheLast));
|
||||
MkSw.SetForceApproxC1(myForceApproxC1);
|
||||
MkSw.Build( BRepFill_Modified, GeomAbs_C2, GeomFill_Location, myDegmax, mySegmax );
|
||||
MkSw.Build( BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
result = MkSw.Shape();
|
||||
|
||||
// Labeling of elements
|
||||
|
@ -282,7 +282,7 @@ static Handle(Geom2d_Curve) Couture(const TopoDS_Edge& E,
|
||||
|
||||
static Standard_Boolean CheckSameParameter
|
||||
(const Handle(Adaptor3d_HCurve)& C3d,
|
||||
Handle(Geom2d_Curve)& Pcurv,
|
||||
const Handle(Geom2d_Curve)& Pcurv,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real tol3d,
|
||||
Standard_Real& tolreached)
|
||||
@ -1458,6 +1458,15 @@ static TopoDS_Edge BuildEdge(const Handle(Geom_Surface)& S,
|
||||
Iso->FirstParameter(),
|
||||
Iso->LastParameter());
|
||||
|
||||
Standard_Real MaxTol = 1.e-4;
|
||||
Standard_Real theTol;
|
||||
GeomAdaptor_Curve GAiso(Iso);
|
||||
Handle(GeomAdaptor_HCurve) GAHiso = new GeomAdaptor_HCurve(GAiso);
|
||||
GeomAdaptor_Surface GAsurf(S);
|
||||
Handle(GeomAdaptor_HSurface) GAHsurf = new GeomAdaptor_HSurface(GAsurf);
|
||||
CheckSameParameter( GAHiso, L, GAHsurf, MaxTol, theTol);
|
||||
B.UpdateEdge(E, theTol);
|
||||
|
||||
return E;
|
||||
}
|
||||
|
||||
|
@ -59,21 +59,15 @@ is
|
||||
-- composite solid.
|
||||
returns MakePipe from BRepOffsetAPI;
|
||||
|
||||
SetMode(me : in out;
|
||||
aMode : Trihedron from GeomFill);
|
||||
---Purpose: Set the mode of sweeping
|
||||
-- It can be:
|
||||
-- - Frenet
|
||||
-- - Corrected Frenet
|
||||
-- - Discrete Trihedron
|
||||
-- By default the mode is Corrected Frenet
|
||||
|
||||
SetForceApproxC1(me : in out;
|
||||
ForceApproxC1 : Boolean from Standard);
|
||||
---Purpose: Set the flag that indicates attempt to approximate
|
||||
-- a C1-continuous surface if a swept surface proved
|
||||
-- to be C0.
|
||||
|
||||
Create( Spine : Wire from TopoDS;
|
||||
Profile : Shape from TopoDS;
|
||||
aMode : Trihedron from GeomFill;
|
||||
ForceApproxC1 : Boolean from Standard = Standard_False)
|
||||
---Purpose: the same as previous but with setting of
|
||||
-- mode of sweep and the flag that indicates attempt
|
||||
-- to approximate a C1-continuous surface if a swept
|
||||
-- surface proved to be C0.
|
||||
returns MakePipe from BRepOffsetAPI;
|
||||
|
||||
Pipe(me) returns Pipe from BRepFill
|
||||
---C++: return const &
|
||||
|
@ -30,40 +30,36 @@
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffsetAPI_MakePipe
|
||||
//purpose :
|
||||
//purpose : constructor
|
||||
//=======================================================================
|
||||
|
||||
BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine ,
|
||||
const TopoDS_Shape& Profile)
|
||||
const TopoDS_Shape& Profile)
|
||||
: myPipe(Spine, Profile)
|
||||
{
|
||||
Build();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMode
|
||||
//purpose : Set the mode of sweeping
|
||||
//function : BRepOffsetAPI_MakePipe
|
||||
//purpose : constructor
|
||||
// Set the mode of sweeping
|
||||
// It can be:
|
||||
// - Frenet
|
||||
// - Corrected Frenet
|
||||
// - Discrete Trihedron
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffsetAPI_MakePipe::SetMode(const GeomFill_Trihedron aMode)
|
||||
{
|
||||
myPipe.SetMode(aMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetForceApproxC1
|
||||
//purpose : Set the flag that indicates attempt to approximate
|
||||
// Also set the flag that indicates attempt to approximate
|
||||
// a C1-continuous surface if a swept surface proved
|
||||
// to be C0.
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffsetAPI_MakePipe::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
|
||||
BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine ,
|
||||
const TopoDS_Shape& Profile,
|
||||
const GeomFill_Trihedron aMode,
|
||||
const Standard_Boolean ForceApproxC1)
|
||||
: myPipe(Spine, Profile, aMode, ForceApproxC1)
|
||||
{
|
||||
myPipe.SetForceApproxC1(ForceApproxC1);
|
||||
Build();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -133,10 +133,20 @@ static Standard_Integer revol(Draw_Interpretor& ,
|
||||
// pipe
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer pipe(Draw_Interpretor& ,
|
||||
static Standard_Integer pipe(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n < 4) return 1;
|
||||
if (n == 1)
|
||||
{
|
||||
di << "pipe result Wire_spine Profile [Mode [Approx]]" << "\n";
|
||||
di << "Mode = 0 - CorrectedFrenet," << "\n";
|
||||
di << " = 1 - Frenet," << "\n";
|
||||
di << " = 2 - DiscreteTrihedron" << "\n";
|
||||
di << "Approx - force C1-approximation if result is C0" << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (n > 1 && n < 4) return 1;
|
||||
|
||||
TopoDS_Shape Spine = DBRep::Get(a[2],TopAbs_WIRE);
|
||||
if ( Spine.IsNull()) return 1;
|
||||
@ -144,12 +154,30 @@ static Standard_Integer pipe(Draw_Interpretor& ,
|
||||
TopoDS_Shape Profile = DBRep::Get(a[3]);
|
||||
if ( Profile.IsNull()) return 1;
|
||||
|
||||
TopoDS_Shape S = BRepOffsetAPI_MakePipe(TopoDS::Wire(Spine),Profile);
|
||||
GeomFill_Trihedron Mode = GeomFill_IsCorrectedFrenet;
|
||||
if (n >= 5)
|
||||
{
|
||||
Standard_Integer iMode = atoi(a[4]);
|
||||
if (iMode == 1)
|
||||
Mode = GeomFill_IsFrenet;
|
||||
else if (iMode == 2)
|
||||
Mode = GeomFill_IsDiscreteTrihedron;
|
||||
}
|
||||
|
||||
Standard_Boolean ForceApproxC1 = Standard_False;
|
||||
if (n >= 6)
|
||||
ForceApproxC1 = Standard_True;
|
||||
|
||||
TopoDS_Shape S = BRepOffsetAPI_MakePipe(TopoDS::Wire(Spine),
|
||||
Profile,
|
||||
Mode,
|
||||
ForceApproxC1);
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer geompipe(Draw_Interpretor& ,
|
||||
@ -827,7 +855,7 @@ void BRepTest::SweepCommands(Draw_Interpretor& theCommands)
|
||||
__FILE__,revol,g);
|
||||
|
||||
theCommands.Add("pipe",
|
||||
"pipe result Wire_spine Profile",
|
||||
"pipe result Wire_spine Profile [Mode [Approx]], no args to get help",
|
||||
__FILE__,pipe,g);
|
||||
|
||||
theCommands.Add("evolved",
|
||||
|
@ -69,7 +69,7 @@ static TopAbs_Orientation Orientation(const TopoDS_Shape&,
|
||||
|
||||
LocOpe_Pipe::LocOpe_Pipe(const TopoDS_Wire& Spine,
|
||||
const TopoDS_Shape& Profile) :
|
||||
myPipe(Spine,Profile,Standard_False)
|
||||
myPipe(Spine,Profile)
|
||||
{
|
||||
|
||||
TopoDS_Shape Result = myPipe.Shape();
|
||||
|
30
tests/bugs/modalg_5/bug23870_1
Executable file
30
tests/bugs/modalg_5/bug23870_1
Executable file
@ -0,0 +1,30 @@
|
||||
puts "============"
|
||||
puts "OCC23870"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Integration of new options of sweeping into BRepOffsetAPI_MakePipe algorithm.
|
||||
#######################################################################
|
||||
|
||||
set BugNumber OCC23870
|
||||
|
||||
restore [locate_data_file bug23824_AXE.brep] spine
|
||||
restore [locate_data_file bug23824_profil.brep] profile
|
||||
|
||||
wire spine spine
|
||||
|
||||
pipe result spine profile 2 approx
|
||||
|
||||
set square 516.633
|
||||
|
||||
set nb_v_good 4
|
||||
set nb_e_good 7
|
||||
set nb_w_good 3
|
||||
set nb_f_good 3
|
||||
set nb_sh_good 1
|
||||
set nb_sol_good 0
|
||||
set nb_compsol_good 0
|
||||
set nb_compound_good 0
|
||||
set nb_shape_good 18
|
||||
|
||||
set 2dviewer 1
|
31
tests/bugs/modalg_5/bug23870_2
Executable file
31
tests/bugs/modalg_5/bug23870_2
Executable file
@ -0,0 +1,31 @@
|
||||
puts "============"
|
||||
puts "OCC23870"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Integration of new options of sweeping into BRepOffsetAPI_MakePipe algorithm.
|
||||
#######################################################################
|
||||
|
||||
set BugNumber OCC23870
|
||||
|
||||
restore [locate_data_file bug23824_Case1_Path.brep] spine
|
||||
restore [locate_data_file bug23824_Case1_Profile.brep] profile
|
||||
|
||||
wire spine spine
|
||||
wire profile profile
|
||||
|
||||
pipe result spine profile 2 approx
|
||||
|
||||
set square 8997.97
|
||||
|
||||
set nb_v_good 1
|
||||
set nb_e_good 2
|
||||
set nb_w_good 1
|
||||
set nb_f_good 1
|
||||
set nb_sh_good 1
|
||||
set nb_sol_good 0
|
||||
set nb_compsol_good 0
|
||||
set nb_compound_good 0
|
||||
set nb_shape_good 6
|
||||
|
||||
set 2dviewer 1
|
31
tests/bugs/modalg_5/bug23870_3
Executable file
31
tests/bugs/modalg_5/bug23870_3
Executable file
@ -0,0 +1,31 @@
|
||||
puts "============"
|
||||
puts "OCC23870"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Integration of new options of sweeping into BRepOffsetAPI_MakePipe algorithm.
|
||||
#######################################################################
|
||||
|
||||
set BugNumber OCC23870
|
||||
|
||||
restore [locate_data_file bug23824_Case2_Path.brep] spine
|
||||
restore [locate_data_file bug23824_Case2_Profile.brep] profile
|
||||
|
||||
wire spine spine
|
||||
wire profile profile
|
||||
|
||||
pipe result spine profile 2 approx
|
||||
|
||||
set square 848.989
|
||||
|
||||
set nb_v_good 1
|
||||
set nb_e_good 2
|
||||
set nb_w_good 1
|
||||
set nb_f_good 1
|
||||
set nb_sh_good 1
|
||||
set nb_sol_good 0
|
||||
set nb_compsol_good 0
|
||||
set nb_compound_good 0
|
||||
set nb_shape_good 6
|
||||
|
||||
set 2dviewer 1
|
32
tests/bugs/modalg_5/bug23870_4
Executable file
32
tests/bugs/modalg_5/bug23870_4
Executable file
@ -0,0 +1,32 @@
|
||||
puts "============"
|
||||
puts "OCC23870"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Integration of new options of sweeping into BRepOffsetAPI_MakePipe algorithm.
|
||||
#######################################################################
|
||||
|
||||
set BugNumber OCC23870
|
||||
|
||||
restore [locate_data_file bug23824_Case3_Path.brep] spine
|
||||
restore [locate_data_file bug23824_Case3_Profile.brep] profile
|
||||
|
||||
wire profile profile
|
||||
explode spine
|
||||
wire spine spine_1
|
||||
|
||||
pipe result spine profile 2 approx
|
||||
|
||||
set square 38260.5
|
||||
|
||||
set nb_v_good 1
|
||||
set nb_e_good 2
|
||||
set nb_w_good 1
|
||||
set nb_f_good 1
|
||||
set nb_sh_good 1
|
||||
set nb_sol_good 0
|
||||
set nb_compsol_good 0
|
||||
set nb_compound_good 0
|
||||
set nb_shape_good 6
|
||||
|
||||
set 2dviewer 1
|
30
tests/bugs/modalg_5/bug23870_5
Executable file
30
tests/bugs/modalg_5/bug23870_5
Executable file
@ -0,0 +1,30 @@
|
||||
puts "============"
|
||||
puts "OCC23870"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Integration of new options of sweeping into BRepOffsetAPI_MakePipe algorithm.
|
||||
#######################################################################
|
||||
|
||||
set BugNumber OCC23870
|
||||
|
||||
restore [locate_data_file bug20807_helix_10.brep] spine
|
||||
restore [locate_data_file bug20807_profile.brep] profile
|
||||
|
||||
wire spine spine
|
||||
|
||||
pipe result spine profile 1
|
||||
|
||||
set square 254837
|
||||
|
||||
set nb_v_good 4
|
||||
set nb_e_good 8
|
||||
set nb_w_good 4
|
||||
set nb_f_good 4
|
||||
set nb_sh_good 1
|
||||
set nb_sol_good 0
|
||||
set nb_compsol_good 0
|
||||
set nb_compound_good 0
|
||||
set nb_shape_good 21
|
||||
|
||||
set 2dviewer 1
|
Loading…
x
Reference in New Issue
Block a user