Standard_Real aSUMin, aSUMax, aSVMin, aSVMax;
aSurf->Bounds(aSUMin, aSUMax, aSVMin, aSVMax);
- if (aBAS.IsUPeriodic())
+ Standard_Boolean isUPeriodic = aBAS.IsUPeriodic();
+ Standard_Real anUPeriod = isUPeriodic ? aBAS.UPeriod() : 0.0;
+ if (isUPeriodic)
{
// Adjust face bounds to first period
Standard_Real aDelta = aFUMax - aFUMin;
- aFUMin = Max(aSUMin, aFUMin + aBAS.UPeriod()*Ceiling((aSUMin - aFUMin)/aBAS.UPeriod()));
+ aFUMin = Max(aSUMin, aFUMin + anUPeriod*Ceiling((aSUMin - aFUMin) / anUPeriod));
aFUMax = aFUMin + aDelta;
}
- if (aBAS.IsVPeriodic())
+
+ Standard_Boolean isVPeriodic = aBAS.IsVPeriodic();
+ Standard_Real aVPeriod = isVPeriodic ? aBAS.VPeriod() : 0.0;
+ if (isVPeriodic)
{
// Adjust face bounds to first period
Standard_Real aDelta = aFVMax - aFVMin;
- aFVMin = Max(aSVMin, aFVMin + aBAS.VPeriod()*Ceiling((aSVMin - aFVMin)/aBAS.VPeriod()));
+ aFVMin = Max(aSVMin, aFVMin + aVPeriod*Ceiling((aSVMin - aFVMin) / aVPeriod));
aFVMax = aFVMin + aDelta;
}
aVRes = aBAS.VResolution(theExtVal);
if (theExtUMin) aFUMin = Max(aSUMin, aFUMin - anURes);
- if (theExtUMax) aFUMax = Min(aSUMax, aFUMax + anURes);
+ if (theExtUMax) aFUMax = Min(isUPeriodic ? aFUMin + anUPeriod : aSUMax, aFUMax + anURes);
if (theExtVMin) aFVMin = Max(aSVMin, aFVMin - aVRes);
- if (theExtVMax) aFVMax = Min(aSVMax, aFVMax + aVRes);
+ if (theExtVMax) aFVMax = Min(isVPeriodic ? aFVMin + aVPeriod : aSVMax, aFVMax + aVRes);
+
+ // Check if the periodic surface should become closed.
+ // In this case, use the basis surface with basis bounds.
+ const Standard_Real anEps = Precision::PConfusion();
+ if (isUPeriodic && Abs(aFUMax - aFUMin - anUPeriod) < anEps)
+ {
+ aFUMin = aSUMin;
+ aFUMax = aSUMax;
+ }
+ if (isVPeriodic && Abs(aFVMax - aFVMin - aVPeriod) < anEps)
+ {
+ aFVMin = aSVMin;
+ aFVMax = aSVMax;
+ }
aS = aSurf;
}
--- /dev/null
+puts "========"
+puts "0030094: Modeling Algorithms - Defeaturing does not work on the attached shape due to incorrect extension of the torus"
+puts "========"
+puts ""
+
+
+restore [locate_data_file bug30094.brep] a
+explode a f
+
+removefeatures r1 a a_1
+CheckIsFeatureRemoved a_1 {f}
+
+removefeatures r2 a a_6
+CheckIsFeatureRemoved a_6 {f}
+
+foreach r {r1 r2} {
+ checkshape $r
+ checknbshapes $r -wire 19 -face 17 -shell 1 -solid 1
+ checkprops $r -s 421523 -v 2.04083e+006 -deps 1.e-7
+}
+
+
+removefeatures result a a_1 a_8
+CheckIsFeatureRemoved a_1 {f}
+CheckIsFeatureRemoved a_8 {f}
+checkshape result
+checknbshapes result -wire 22 -face 20 -shell 1 -solid 1
+checkprops result -s 421862 -v 2.04152e+006 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
--- /dev/null
+puts "TODO OCC30099 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC30099 ALL: Error : The area of result shape is"
+puts "TODO OCC30099 ALL: Error : The volume of result shape is"
+
+
+puts "========"
+puts "0030094: Modeling Algorithms - Defeaturing does not work on the attached shape due to incorrect extension of the torus"
+puts "========"
+puts ""
+
+
+restore [locate_data_file bug30094.brep] a
+explode a f
+
+removefeatures r1 a a_8
+CheckIsFeatureRemoved a_8 {f}
+checkshape r1
+checknbshapes r1 -wire 19 -face 17 -shell 1 -solid 1
+checkprops r1 -s 421523 -v 2.04083e+006 -deps 1.e-7
+
+removefeatures result a a_1 a_6 a_8
+CheckIsFeatureRemoved a_1 {f}
+CheckIsFeatureRemoved a_6 {f}
+CheckIsFeatureRemoved a_8 {f}
+
+checkshape result
+checknbshapes result -wire 25 -face 23 -shell 1 -solid 1
+checkprops result -s 422201 -v 2.042204e+006 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png