---C++: inline
is static;
+ SetCheckInterior(me: in out; ToCheckInterior: Boolean from Standard)
+ ---Purpose: Set the flag of check internal intersections
+ -- default value is True (to check)
+ ---C++: inline
+ is static;
Add(me: in out; W: Wire from TopoDS;
F: Face from TopoDS)
}
}
+//=======================================================================
+//function : SetCheckInterior
+//purpose :
+//=======================================================================
+
+inline void BRepFeat_SplitShape::SetCheckInterior(const Standard_Boolean ToCheckInterior)
+{
+ myWOnShape->SetCheckInterior(ToCheckInterior);
+}
//=======================================================================
//function : Add
}
aLocalFace = FaceRef.Oriented(wfirst.Orientation());
C2d = BRep_Tool::CurveOnSurface(LastEdge, TopoDS::Face(aLocalFace), f, l);
+ Standard_Real dpar = (l - f)*0.01;
if (LastEdge.Orientation() == TopAbs_FORWARD) {
C2d->D1(l,plast,dlast);
+ if (dlast.Magnitude() < gp::Resolution())
+ {
+ gp_Pnt2d PrevPnt = C2d->Value(l - dpar);
+ dlast.SetXY(plast.XY() - PrevPnt.XY());
+ }
}
else {
C2d->D1(f,plast,dlast);
+ if (dlast.Magnitude() < gp::Resolution())
+ {
+ gp_Pnt2d NextPnt = C2d->Value(f + dpar);
+ dlast.SetXY(NextPnt.XY() - plast.XY());
+ }
dlast.Reverse();
}
TopoDS_Shape aLocalFace = FaceRef.Oriented(wfirst.Orientation());
C2d = BRep_Tool::CurveOnSurface(TopoDS::Edge(itm.Key()),
TopoDS::Face(aLocalFace), f, l);
+ Standard_Real dpar = (l - f)*0.01;
if (itm.Key().Orientation() == TopAbs_FORWARD) {
C2d->D1(l,plast,dlast);
+ if (dlast.Magnitude() < gp::Resolution())
+ {
+ gp_Pnt2d PrevPnt = C2d->Value(l - dpar);
+ dlast.SetXY(plast.XY() - PrevPnt.XY());
+ }
}
else {
C2d->D1(f,plast,dlast);
+ if (dlast.Magnitude() < gp::Resolution())
+ {
+ gp_Pnt2d NextPnt = C2d->Value(f + dpar);
+ dlast.SetXY(NextPnt.XY() - plast.XY());
+ }
dlast.Reverse();
}
}
}
newW1.Oriented(orfila);
- BRepTopAdaptor_FClass2d classif(newF1,Precision::PConfusion());
- if (classif.PerformInfinitePoint() == TopAbs_OUT) {
- BRepTopAdaptor_FClass2d classi(newF2,Precision::PConfusion());
- if (classi.PerformInfinitePoint() == TopAbs_IN) {
- TopoDS_Face tempF = newF2;
- newF2 = newF1;
- newF1 = tempF;
- newW2.Oriented(orfila);
- newW1.Oriented(TopAbs_FORWARD);
- }
- }
+ newW2.Oriented(orfila);
+
B.Add(newF1,newW1);
+ BRepTools::Write(newF1, "k:/queries/WrongBOP/NewF1.brep");
B.Add(newF2,newW2);
+ BRepTools::Write(newF2, "k:/queries/WrongBOP/NewF2.brep");
for (exp.ReInit(); exp.More(); exp.Next()) {
const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
gp_Dir2d ref2d(dlst);
Handle(Geom2d_Curve) C2d;
+ Standard_Real dpar;
Standard_Integer index = 0, imin=0;
Standard_Real angmax = -M_PI, dist, ang;
for (It.Initialize(Poss); It.More(); It.Next()) {
index++;
C2d = BRep_Tool::CurveOnSurface(TopoDS::Edge(It.Key()),F,f,l);
+ dpar = (l - f)*0.01;
if (It.Key().Orientation() == TopAbs_FORWARD) {
// p2d = C2d->Value(f);
C2d->D1(f,p2d,v2d);
+ if (v2d.Magnitude() < gp::Resolution())
+ {
+ gp_Pnt2d NextPnt = C2d->Value(f + dpar);
+ v2d.SetXY(NextPnt.XY() - p2d.XY());
+ }
vtx = TopExp::FirstVertex(TopoDS::Edge(It.Key()));
}
else {
// p2d = C2d->Value(l);
C2d->D1(l,p2d,v2d);
+ if (v2d.Magnitude() < gp::Resolution())
+ {
+ gp_Pnt2d PrevPnt = C2d->Value(l - dpar);
+ v2d.SetXY(p2d.XY() - PrevPnt.XY());
+ }
v2d.Reverse();
vtx = TopExp::LastVertex(TopoDS::Edge(It.Key()));
}
for (index = 1, It.Initialize(Poss); It.More(); It.Next()) {
if (index == imin) {
C2d = BRep_Tool::CurveOnSurface(TopoDS::Edge(It.Key()),F,f,l);
+ dpar = (l - f)*0.01;
if (It.Key().Orientation() == TopAbs_FORWARD) {
// plst = C2d->Value(l);
C2d->D1(l,plst,dlst);
+ if (dlst.Magnitude() < gp::Resolution())
+ {
+ gp_Pnt2d PrevPnt = C2d->Value(l - dpar);
+ dlst.SetXY(plst.XY() - PrevPnt.XY());
+ }
}
else {
// plst = C2d->Value(f);
C2d->D1(f,plst,dlst);
+ if (dlst.Magnitude() < gp::Resolution())
+ {
+ gp_Pnt2d NextPnt = C2d->Value(f + dpar);
+ dlst.SetXY(NextPnt.XY() - plst.XY());
+ }
dlst.Reverse();
}
break;
is static;
+ SetCheckInterior(me: mutable; ToCheckInterior: Boolean from Standard)
+ ---Purpose: Set the flag of check internal intersections
+ -- default value is True (to check)
+ ---C++: inline
+ is static;
Bind(me: mutable; W: Wire from TopoDS;
F: Face from TopoDS)
myShape : Shape from TopoDS;
myMapEF : IndexedDataMapOfShapeShape from TopTools;
myFacesWithSection : MapOfShape from TopTools;
+ myCheckInterior : Boolean from Standard;
myMap : DataMapOfShapeShape from TopTools;
myDone : Boolean from Standard;
myIndex : Integer from Standard;
//=======================================================================
LocOpe_WiresOnShape::LocOpe_WiresOnShape(const TopoDS_Shape& S):
- myShape(S),myDone(Standard_False)
+ myShape(S),myCheckInterior(Standard_True),myDone(Standard_False)
{}
void LocOpe_WiresOnShape::Init(const TopoDS_Shape& S)
{
myShape = S;
+ myCheckInterior = Standard_True;
myDone = Standard_False;
myMap.Clear();
myMapEF.Clear();
if (aPCurve.IsNull())
continue;
- FindInternalIntersections(edg, fac, Splits, myMap, theMap);
+ if (myCheckInterior)
+ FindInternalIntersections(edg, fac, Splits, myMap, theMap);
}
for (Ind = 1; Ind <= Splits.Extent(); Ind++)
//=======================================================================
+//function : SetCheckInterior
+//purpose :
+//=======================================================================
+
+inline void LocOpe_WiresOnShape::SetCheckInterior(const Standard_Boolean ToCheckInterior)
+{
+ myCheckInterior = Standard_True;
+}
+
+//=======================================================================
//function : IsDone
//purpose :
//=======================================================================
#include <IGESData_IGESModel.hxx>
#include <IGESData_IGESEntity.hxx>
#include <V3d_View.hxx>
+#include <BRepFeat_SplitShape.hxx>
+#include <BRepAlgoAPI_Section.hxx>
#include <tcl.h>
return 0;
}
+Standard_Integer OCC23429(Draw_Interpretor& di,
+ Standard_Integer narg, const char** a)
+{
+ if (narg < 4) return 1;
+
+ TopoDS_Shape aShape = DBRep::Get(a[2]);
+ if (aShape.IsNull()) return 1;
+
+ BRepFeat_SplitShape Spls(aShape);
+ Spls.SetCheckInterior(Standard_False);
+
+ TopoDS_Shape aTool = DBRep::Get(a[3]);
+
+ BRepAlgoAPI_Section Builder(aShape, aTool, Standard_False);
+ Builder.ComputePCurveOn1(Standard_True);
+ if (narg == 5)
+ Builder.Approximation(Standard_True);
+ Builder.Build();
+ TopoDS_Shape aSection = Builder.Shape();
+
+ TopExp_Explorer ExpSec(aSection, TopAbs_EDGE);
+ for (; ExpSec.More(); ExpSec.Next())
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(ExpSec.Current());
+ Handle(Geom2d_Curve) thePCurve;
+ Handle(Geom_Surface) theSurface;
+ TopLoc_Location theLoc;
+ Standard_Real fpar, lpar;
+ BRep_Tool::CurveOnSurface(anEdge, thePCurve, theSurface, theLoc, fpar, lpar);
+ TopoDS_Face aFace;
+ TopExp_Explorer ExpShape(aShape, TopAbs_FACE);
+ for (; ExpShape.More(); ExpShape.Next())
+ {
+ aFace = TopoDS::Face(ExpShape.Current());
+ TopLoc_Location aLoc;
+ Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
+ if (aSurface == theSurface && aLoc == theLoc)
+ break;
+ }
+ Spls.Add(anEdge, aFace);
+ }
+
+ TopoDS_Shape Result = Spls.Shape();
+ DBRep::Set(a[1], Result);
+
+ return 0;
+}
+
#include <BOPTColStd_CArray1OfInteger.hxx>
//=======================================================================
//function : DumpArray
theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
theCommands.Add("OCC22558", "OCC22558 x_vec y_vec z_vec x_dir y_dir z_dit x_pnt y_pnt z_pnt", __FILE__, OCC22558, group);
theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
+ theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
return;
}
003 iges
004 vis
005 xde
-
-
-
-
-
-
-
-
+006 modalg
--- /dev/null
+puts "============"
+puts "CR23429"
+puts "============"
+puts ""
+##########################################################################################################
+# BRepFeat_SplitShape algorithm misses some section edges while building result from customer's shape
+##########################################################################################################
+pload QAcommands
+
+restore [locate_data_file CR23429-Shape1.brep] a
+restore [locate_data_file CR23429-Shape3.brep] b
+
+OCC23429 result a b
+
+set square 1120.52
+
+set 2dviewer 1
+
+
+
+
+
+
+
--- /dev/null
+if { [isdraw result] } {
+ #check if result is valid
+
+ puts "checkshape"
+ set ch [checkshape result]
+ puts $ch
+
+ if { [info exists square] } {
+ set prop "square"
+ set mass $square
+ regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m
+ }
+ if { [info exists length] } {
+ set prop "length"
+ set mass $length
+ regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full m
+
+ puts "checksection"
+ puts [checksection result]
+ }
+
+ #if mass (length or square) is empty in test case then result should be an empty shape.
+ if { [string compare "$mass" "empty"] != 0 } {
+ if { $m == 0 } {
+ puts "Error : The $command is not valid. The $prop is 0."
+ }
+ if { $mass > 0 } {
+ puts "The expected $prop is $mass"
+ }
+ #check of change of square is < 1%
+ if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
+ puts "Error : The $prop of result shape is $m"
+ }
+
+ if { [info exists nbsh_v ] } {
+ set arr_v [explode result v]
+ set nb_v [ llength $arr_v ]
+ if { $nb_v != $nbsh_v } {
+ puts "Error : Result shape is WRONG because it must contain $nbsh_v vertexes instead of $nb_v"
+ } else {
+ puts "Result shape contains $nb_v vertexes"
+ }
+
+ }
+
+ if { [info exists nbsh_e ] } {
+ set arr_e [explode result e]
+ set nb_e [ llength $arr_e ]
+ if { $nb_e != $nbsh_e } {
+ puts "Error : Result shape is WRONG because it must contain $nbsh_e edges instead of $nb_e"
+ } else {
+ puts "Result shape contains $nb_e edges"
+ }
+ }
+ } else {
+ if { $m != 0 } {
+ puts "Error : The $command is not valid. The $prop is $m"
+ }
+ }
+} else {
+ puts "Error : The $command can not be build."
+}