Added new option '-C' with possibility to set value of Angular and linear tolerances to 'mksweep' command to correct input spine by merging smooth connected neighboring edges
#include <Geom_Circle.hxx>
#include <gp_Ax2.hxx>
#include <Message.hxx>
+#include <ShapeUpgrade_UnifySameDomain.hxx>
//=======================================================================
// prism
//=======================================================================
// mksweep
//=======================================================================
-static Standard_Integer mksweep(Draw_Interpretor&,
+static Standard_Integer mksweep(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
- if (n != 2) return 1;
+ if (n != 2 && n != 5) return 1;
TopoDS_Shape Spine = DBRep::Get(a[1], TopAbs_WIRE);
if (Spine.IsNull()) return 1;
if (Sweep != 0) {
delete Sweep;
Sweep = 0;
}
+
+ if (n > 2 && n <= 5)
+ {
+ if (!strcmp(a[2], "-C"))
+ {
+ ShapeUpgrade_UnifySameDomain aUnif(Spine, Standard_True, Standard_False, Standard_True);
+
+ Standard_Real anAngTol = 5.;
+ Standard_Real aLinTol = 0.1;
+
+ if (n == 5)
+ {
+ anAngTol = Draw::Atof(a[3]);
+ aLinTol = Draw::Atof(a[4]);
+ }
+
+ aUnif.SetAngularTolerance(anAngTol * M_PI / 180.);
+ aUnif.SetLinearTolerance(aLinTol);
+ aUnif.Build();
+ Spine = aUnif.Shape();
+ if (BRepTest_Objects::IsHistoryNeeded())
+ {
+ BRepTest_Objects::SetHistory(aUnif.History());
+ }
+ }
+ else
+ {
+ di << "To correct input spine use 'mksweep wire -C [AngTol LinTol]'\n";
+ di << "By default, AngTol = 5, LinTol = 0.1";
+ return 1;
+ }
+ }
+
+
Sweep = new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(Spine));
return 0;
}
"\t\t-safe option allows to prevent the modifying of input shapes",
__FILE__, thrusections, g);
- theCommands.Add("mksweep", "mksweep wire",
+ theCommands.Add("mksweep", "mksweep wire [-C [AngTol LinTol]]\n"
+ "\t\tthe option -C correct input spine by merging smooth connected neighboring edges\n"
+ "\t\tthe AngTol is in degrees",
__FILE__, mksweep, g);
theCommands.Add("setsweep", "setsweep no args to get help",
--- /dev/null
+puts "============================================"
+puts "0032447: BRepOffsetAPI_MakePipeShell result in inaccurate shape when using -DT mode and DT_ShapeDivide on the spine"
+puts "============================================"
+puts ""
+
+restore [locate_data_file bug32447-spine.brep] s
+restore [locate_data_file bug32447-profile.brep] p
+
+mksweep s -C 5 0.001
+
+explode s e
+savehistory cor_hist
+modified sc_1 cor_hist s_1
+modified sc_2 cor_hist s_2
+modified sc_3 cor_hist s_4
+modified sc_4 cor_hist s_6
+
+checkprops sc_1 -l 0.1816
+checkprops sc_2 -l 0.265078
+checkprops sc_3 -l 0.261167
+checkprops sc_4 -l 0.253542
+
+setsweep -DT
+addsweep p
+buildsweep r -C -S
+
+savehistory sweep_hist
+generated r1 sweep_hist sc_1
+generated r2 sweep_hist sc_2
+generated r3 sweep_hist sc_3
+generated r4 sweep_hist sc_4
+
+checkprops r1 -s 0.0483501
+checkprops r2 -s 0.060163
+checkprops r3 -s 0.0577468
+checkprops r4 -s 0.0658619
+
+checkshape r
+checknbshapes r -face 18
+
+checkview -display r -2d -path ${imagedir}/${test_image}.png
--- /dev/null
+puts "============================================"
+puts "0032447: BRepOffsetAPI_MakePipeShell result in inaccurate shape when using -DT mode and DT_ShapeDivide on the spine"
+puts "============================================"
+puts ""
+
+restore [locate_data_file bug32447-spine.brep] s
+restore [locate_data_file bug32447-profile.brep] p
+
+mksweep s -C 1 0.1
+
+explode s e
+savehistory cor_hist
+modified sc_1 cor_hist s_1
+modified sc_2 cor_hist s_2
+
+checkprops sc_1 -l 0.1816
+checkprops sc_2 -l 0.779758
+
+setsweep -DT
+addsweep p
+buildsweep r -C -S
+
+savehistory sweep_hist
+generated r1 sweep_hist sc_1
+generated r2 sweep_hist sc_2
+
+checkprops r1 -s 0.0483501
+checkprops r2 -s 0.184231
+
+checkshape r
+checknbshapes r -face 10
+
+checkview -display r -2d -path ${imagedir}/${test_image}.png
--- /dev/null
+puts "============================================"
+puts "0032447: BRepOffsetAPI_MakePipeShell result in inaccurate shape when using -DT mode and DT_ShapeDivide on the spine"
+puts "============================================"
+puts ""
+
+circle c 0 0 0 1
+trim c c 0 1
+convert c c
+mkedge c c
+
+line l 1 0 0 0 1 0
+trim l l -1 0
+convert l l
+mkedge l l
+
+wire s l c
+
+circle c 0.9 0 0 0 1 0 0.1
+mkedge p c
+wire p p
+
+mksweep s -C 5 0.001
+
+explode s e
+savehistory cor_hist
+modified sc cor_hist s_1
+
+checkprops sc -l 2
+
+setsweep -DT
+addsweep p
+buildsweep r -C -S
+
+savehistory sweep_hist
+generated r1 sweep_hist sc
+
+checkprops r1 -s 1.19393
+
+checkshape r
+checknbshapes r -face 3
+
+checkview -display r -2d -path ${imagedir}/${test_image}.png
--- /dev/null
+puts "============================================"
+puts "0032447: BRepOffsetAPI_MakePipeShell result in inaccurate shape when using -DT mode and DT_ShapeDivide on the spine"
+puts "============================================"
+puts ""
+
+circle c1 0 0 0 10
+trim c1 c1 0 1
+convert c1 c1
+mkedge c1 c1
+
+circle c2 -1000 0 0 1010
+trim c2 c2 -0.1 0
+convert c2 c2
+mkedge c2 c2
+
+wire s c2 c1
+
+circle c 9 0 0 0 1 0 1
+mkedge p c
+wire p p
+
+mksweep s -C 5 0.1
+
+explode s e
+savehistory cor_hist
+modified sc cor_hist s_1
+
+checkprops sc -l 111
+
+setsweep -DT
+addsweep p
+buildsweep r -C -S
+
+savehistory sweep_hist
+generated r1 sweep_hist sc
+
+checkprops r1 -s 691.348
+
+checkshape r
+checknbshapes r -face 3
+
+checkview -display r -2d -path ${imagedir}/${test_image}.png