In method Approx_SameParameter::Build() for case when 2D and 3D curves is not same parameter calculation of maximal deviation is modified by following way :
Projection is considered as done only if parameter projected point falls within the current interval of parameters.
In the Approx_SameParameter considering tolerance after static method ProjectPointOnCurve was added.
In BRepAlgoAPI_Sewing catch of exception was added and computation of tolerance of edge if same parameter was changed in according to check in BRepCheck_Analyzer
In method Approx_SameParameter::Build() for case when 2D and 3D curves is not same parameter calculation of maximal deviation is modified by following way :
Modification in order to avoid warning
Test case for issue CR24357
Standard_Real Tol = Tolerance;
Standard_Real Tol2 = Tol * Tol;
- Standard_Real Tolp = myC3d->Resolution(Tol), deltamin = 50*Tolp;
+ Standard_Real deltamin = Precision::PConfusion();//50*Tolp;
Standard_Real besttol2 = Tol2;
Standard_Boolean extrok = 0;
else extrok = 0;
- if(dmax2 > besttol2) besttol2 = dmax2;
+ //if(dmax2 > besttol2) besttol2 = dmax2;
//Take a multiple of the sample pof CheckShape,
//at least the control points will be correct. No comment!!!
myC3d->D0(pc3d[ii],Pc3d);
dist2 = Pcons.SquareDistance(Pc3d);
use_parameter = (dist2 <= Tol2 && (pc3d[ii] > pc3d[count-1] + deltamin)) ;
+ Standard_Real aDistMin = RealLast();;
if(use_parameter) {
if(dist2 > dmax2) dmax2 = dist2;
initp = previousp = pc3d[count] = pc3d[ii];
pcons[count] = pcons[ii];
count++;
+
}
else {
if(!projok) initp = pc3d[ii];
if (Projector.IsDone()) {
curp = Projector.Point().Parameter();
Standard_Real dist_2 = Projector.SquareDistance();
- if(dist_2 > besttol2) besttol2 = dist_2;
- projok = 1;
+ projok = Standard_True;
+ aDistMin = dist_2;
}
else
{
ProjectPointOnCurve(initp,Pcons,Tol,30,myC3d->Curve(),projok,curp);
+ if(projok)
+ {
+ const gp_Pnt& ap1 =myC3d->Value(curp);
+ aDistMin = Pcons.SquareDistance(ap1);
+ }
}
-
+ projok = (projok && (curp > previousp + deltamin && curp < bornesup));
if(projok)
{
- if(curp > previousp + deltamin && curp < bornesup){
- initp = previousp = pc3d[count] = curp;
- pcons[count] = pcons[ii];
- count++;
- }
+ initp = previousp = pc3d[count] = curp;
+ pcons[count] = pcons[ii];
+ count++;
+
}
else
{
if(aNbExt > 0)
{
Standard_Integer anIndMin = 0;
- Standard_Real aDistMin = RealLast();
+ Standard_Real aCurDistMin = RealLast();
for(Standard_Integer i = 1; i <= aNbExt; i++)
{
const gp_Pnt &aP = PR.Point(i).Value();
Standard_Real aDist2 = aP.SquareDistance(Pcons);
- if(aDist2 < aDistMin)
+ if(aDist2 < aCurDistMin)
{
- aDistMin = aDist2;
+ aCurDistMin = aDist2;
anIndMin = i;
}
}
- curp = PR.Point(anIndMin).Parameter();
- if(curp > previousp + deltamin && curp < bornesup)
+ if(anIndMin)
{
- initp = previousp = pc3d[count] = curp;
- pcons[count] = pcons[ii];
- count++;
- projok = Standard_True;
+ curp = PR.Point(anIndMin).Parameter();
+ if( curp > previousp + deltamin && curp < bornesup)
+ {
+ aDistMin = aCurDistMin;
+ initp = previousp = pc3d[count] = curp;
+ pcons[count] = pcons[ii];
+ count++;
+ projok = Standard_True;
+
+ }
}
+
}
}
}
-
- if(!projok)
+ if(projok && besttol2 < aDistMin)
+ besttol2 = aDistMin;
+
+ else if(!projok)
{
//Projector
#ifdef OCCT_DEBUG
{
return (dist * 0.5 + Tol1 + Tol2);
}
+
TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirst,
const TopoDS_Edge& edgeLast,
const TopTools_ListOfShape& listFacesFirst,
}
Standard_Real tolReached = Precision::Infinite();
Standard_Boolean isSamePar = Standard_False;
- if( isResEdge)
+ try
{
- SameParameter(edge);
+ if( isResEdge)
+ SameParameter(edge);
+
+
if( BRep_Tool::SameParameter(edge))
{
isSamePar = Standard_True;
tolReached = BRep_Tool::Tolerance(edge);
}
}
+
+ catch(Standard_Failure)
+ {
+ isSamePar = Standard_False;
+ }
if (firstCall && ( !isResEdge || !isSamePar || tolReached > myTolerance)) {
// Discretize edge curve
Standard_Integer i, j, nbp = 23;
- Standard_Real deltaT = (last3d - first3d) / (nbp + 1);
+ Standard_Real deltaT = (last3d - first3d) / (nbp -1);
TColgp_Array1OfPnt c3dpnt(1,nbp);
for (i = 1; i <= nbp; i++)
- c3dpnt(i) = c3dAdapt.Value(first3d + i*deltaT);
+ c3dpnt(i) = c3dAdapt.Value(first3d + (i-1)*deltaT);
Standard_Real dist = 0., maxTol = -1.0;
Standard_Boolean more = Standard_True;
aS = Handle(Geom_Surface)::DownCast(surf2->Transformed ( loc2 ));
Standard_Real dist2 = 0.;
- deltaT = (last - first) / (nbp + 1);
+ deltaT = (last - first) / (nbp - 1);
for (i = 1; i <= nbp; i++) {
- gp_Pnt2d aP2d = c2d2->Value(first + i*deltaT);
+ gp_Pnt2d aP2d = c2d2->Value(first + (i -1)*deltaT);
gp_Pnt aP2(0.,0.,0.);
aS->D0(aP2d.X(),aP2d.Y(), aP2);
gp_Pnt aP1 = c3dpnt(i);
if { [regexp {Debug mode} [dversion]] } {
set max_t_01 180
} else {
- if { [regexp {Windows} [dversion]] } {
- set max_t_01 90
- } else {
- set max_t_01 90
- }
+ set max_t_01 50
}
if {${max_t_01} > ${t_01}} {
-puts "TODO OCC24036 ALL: Faulty shapes in variables faulty_1 to faulty_2"
-puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 642 vertices instead of 966"
-puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 955 edges instead of 1224"
-puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 3 shells instead of 18"
-puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 2133 shapes instead of 2741"
+puts "TODO OCC24036 ALL: Faulty shapes in variables faulty_1 to faulty_"
+#puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 642 vertices instead of 966"
+#puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 955 edges instead of 1224"
+#puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 3 shells instead of 18"
+#puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 2133 shapes instead of 2741"
puts "================"
puts "OCC22770"
set square 1.8847e+07
-set nb_v_good 642
-set nb_e_good 955
+set nb_v_good 964
+set nb_e_good 1222
set nb_w_good 273
set nb_f_good 259
-set nb_sh_good 3
+set nb_sh_good 18
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 2133
+set nb_shape_good 2737
checkmaxtol result 0.000126867229511314
checknbshapes result -shell 18
-checkfreebounds result 927
+checkfreebounds result 926
set 3dviewer 0
-puts "TODO OCC24036 ALL: Faulty shapes in variables faulty_1 to faulty_2"
-puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 642 vertices instead of 966"
-puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 955 edges instead of 1224"
-puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 3 shells instead of 18"
-puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 2133 shapes instead of 2741"
+puts "TODO OCC24036 ALL: Faulty shapes in variables faulty_1 to faulty_"
+#puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 642 vertices instead of 966"
+#puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 955 edges instead of 1224"
+#puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 3 shells instead of 18"
+#puts "TODO OCC24036 ALL: Error : Result shape is WRONG because it must contains 2133 shapes instead of 2741"
puts "================"
puts "OCC22770"
set square 1.8847e+07
-set nb_v_good 642
-set nb_e_good 955
+set nb_v_good 964
+set nb_e_good 1222
set nb_w_good 273
set nb_f_good 259
-set nb_sh_good 3
+set nb_sh_good 18
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 2133
+set nb_shape_good 2737
checkmaxtol result 0.000126867229511314
checknbshapes result -shell 18
-checkfreebounds result 927
+checkfreebounds result 926
set 3dviewer 0
--- /dev/null
+puts "========"
+puts "OCC24357"
+puts "========"
+puts ""
+###########################################################
+# BRepBuilderAPI_Sewing returns result with too high tolerance
+###########################################################
+
+restore [locate_data_file bug24357_faces.brep] f
+whatis f
+tolerance f
+sewing r 0.2 f
+whatis r
+
+regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance r] full MaxTolerance
+puts "MaxTolerance=$MaxTolerance"
+
+set expected_MaxTolerance 0.00082956492865075794
+set tol_abs_MaxTolerance 0.00001
+set tol_rel_MaxTolerance 0.00001
+checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
+
+smallview
+donly r
+fit
+xwd ${imagedir}/${casename}_1.png
+
+vinit
+vsetdispmode 1
+vdisplay r
+vfit
+vdump ${imagedir}/${casename}_2.png
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: LABELS : Faulty"
+puts "TODO CR23096 Windows: Error : 1 differences with reference data found :"
set LinuxDiff 1
set filename UKI60106.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 71 ( 612 ) Summary = 71 ( 612 )
+TPSTAT : Faulties = 0 ( 0 ) Warnings = 72 ( 612 ) Summary = 72 ( 612 )
CHECKSHAPE : Wires = 1 ( 3 ) Faces = 1 ( 2 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
-NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 457 ( 457 ) Summary = 10471 ( 10468 )
-STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 457 ( 457 ) FreeWire = 26 ( 26 ) FreeEdge = 1283 ( 1283 ) SharedEdge = 4131 ( 4128 )
-TOLERANCE : MaxTol = 0.9875148267 ( 0.98741607 ) AvgTol = 0.01669728797 ( 0.01689923949 )
+NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 457 ( 457 ) Summary = 10469 ( 10468 )
+STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 457 ( 457 ) FreeWire = 26 ( 26 ) FreeEdge = 1283 ( 1283 ) SharedEdge = 4129 ( 4128 )
+TOLERANCE : MaxTol = 0.9874160851 ( 0.98741607 ) AvgTol = 0.01671715735 ( 0.01690643311 )
LABELS : N0Labels = 1706 ( 1706 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1706 ( 1706 ) NameLabels = 1706 ( 1706 ) ColorLabels = 1680 ( 1706 ) LayerLabels = 1680 ( 1706 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 4 ( 4 )
# !!!! This file is generated automatically, do not edit manually! See end script
-puts "TODO CR23096 ALL: TPSTAT : Faulty"
-puts "TODO CR23096 ALL: CHECKSHAPE : Faulty"
-puts "TODO CR23096 ALL: STATSHAPE : Faulty"
+puts "TODO CR23096 ALL: TPSTAT : Faulty"
+puts "TODO CR23096 ALL: CHECKSHAPE : Faulty"
+puts "TODO CR23096 ALL: STATSHAPE : Faulty"
set filename trj12_ttmouse-pe-214.stp
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 39 ( 6 ) Summary = 39 ( 6 )
+TPSTAT : Faulties = 0 ( 0 ) Warnings = 40 ( 18 ) Summary = 40 ( 18 )
CHECKSHAPE : Wires = 64 ( 48 ) Faces = 64 ( 48 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 15 ( 16 ) Shell = 17 ( 17 ) Face = 367 ( 366 ) Summary = 2506 ( 2495 )
STATSHAPE : Solid = 71 ( 79 ) Shell = 87 ( 87 ) Face = 2740 ( 2732 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 1064 ( 1057 )
-TOLERANCE : MaxTol = 4.389003466 ( 5.153790881 ) AvgTol = 0.05707355423 ( 0.06633632879 )
+TOLERANCE : MaxTol = 4.483126782 ( 5.153790881 ) AvgTol = 0.05936982281 ( 0.06645133562 )
LABELS : N0Labels = 10 ( 10 ) N1Labels = 32 ( 32 ) N2Labels = 0 ( 0 ) TotalLabels = 42 ( 42 ) NameLabels = 22 ( 22 ) ColorLabels = 22 ( 22 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 6 ( 6 )
# !!!! This file is generated automatically, do not edit manually! See end script
-set filename trj7_b1-ec-214.stp
puts "TODO CR23096 ALL: STATSHAPE : Faulty"
puts "TODO CR23096 ALL: TOLERANCE : Faulty"
+
+set filename trj7_b1-ec-214.stp
+
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 2 ) Warnings = 2 ( 28 ) Summary = 2 ( 30 )
-CHECKSHAPE : Wires = 2 ( 2 ) Faces = 2 ( 2 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 2 ) Warnings = 4 ( 29 ) Summary = 4 ( 31 )
+CHECKSHAPE : Wires = 1 ( 2 ) Faces = 1 ( 2 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 1 ( 1 ) Shell = 1 ( 1 ) Face = 416 ( 415 ) Summary = 2778 ( 2760 )
STATSHAPE : Solid = 1 ( 1 ) Shell = 1 ( 1 ) Face = 416 ( 415 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 1194 ( 1178 )
-TOLERANCE : MaxTol = 9036.639612 ( 0.9492387908 ) AvgTol = 21.72114525 ( 0.03925492632 )
+TOLERANCE : MaxTol = 133200.3972 ( 0.9492387908 ) AvgTol = 320.1207295 ( 0.0392895506 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 28 ( 28 ) N2Labels = 0 ( 0 ) TotalLabels = 29 ( 29 ) NameLabels = 1 ( 1 ) ColorLabels = 29 ( 29 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 1 ( 1 ) Volume = 1 ( 1 ) Area = 1 ( 1 )
NCOLORS : NColors = 2 ( 2 )
puts "TODO OCC22803 Linux: Error in depouille"
puts "TODO OCC22803 Linux: Error : The skin cannot be built."
puts "TODO OCC22803 Windows: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC22803 Windows: Error : The area of the resulting shape is"
polyline p 0 0 3 0 0 0 10 0 0 10 0 3
beziercurve bc 4 10 0 3 7 0 2 3 0 3 0 0 3
mkedge bc bc
if {[string compare $command "SplitAngle"] == 0 } {
- puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_4 "
+ puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_"
}
restore [locate_data_file FLANSCH-02.brep] a
if {[string compare $command "SplitAngle"] == 0 } {
- puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_18 "
+ puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_"
}
restore [locate_data_file FPASNKG_M.brep] a
-if {[string compare $command "SplitAngle"] == 0 } {
- puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_"
-}
restore [locate_data_file METABO12.brep] a
if {[string compare $command "SplitAngle"] == 0 } {
- puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_6 "
+ puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_"
}
restore [locate_data_file METABO7.brep] a
sewing result $tol a
-checkmaxtol result 11.642084202872448
+checkmaxtol result 6.2643182979358158
checknbshapes result -shell 1
checkfreebounds result 0
checkfaults result a 0