mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-06 18:26:22 +03:00
0022822: Skipping of the first and the last edges of a wire for opened wires
This commit is contained in:
parent
86be42959e
commit
ef57920a5d
@ -42,6 +42,7 @@
|
|||||||
#include <BRepGProp.hxx>
|
#include <BRepGProp.hxx>
|
||||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||||
#include <ShapeAnalysis_ShapeContents.hxx>
|
#include <ShapeAnalysis_ShapeContents.hxx>
|
||||||
|
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||||
|
|
||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
@ -54,6 +55,7 @@
|
|||||||
#include <ShapeFix_FreeBounds.hxx>
|
#include <ShapeFix_FreeBounds.hxx>
|
||||||
|
|
||||||
#include <ShapeExtend_WireData.hxx>
|
#include <ShapeExtend_WireData.hxx>
|
||||||
|
#include <ShapeAnalysis_Wire.hxx>
|
||||||
|
|
||||||
static Standard_Integer tolerance
|
static Standard_Integer tolerance
|
||||||
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
@ -830,6 +832,61 @@ static Standard_Integer getareacontour (Draw_Interpretor& di,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Standard_Integer checkselfintersection
|
||||||
|
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
|
{
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
di<<"Call please \"checkselfintersection wire [face]\""<<"\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get wire.
|
||||||
|
const char* arg1 = argv[1];
|
||||||
|
TopoDS_Shape wire = DBRep::Get(arg1);
|
||||||
|
if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
|
||||||
|
{
|
||||||
|
di<<"A null shape or not a wire is used."<<"\n";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get face if the user provided us with a face.
|
||||||
|
TopoDS_Shape face;
|
||||||
|
if (argc > 2)
|
||||||
|
{
|
||||||
|
const char* arg2 = argv[2];
|
||||||
|
face = DBRep::Get(arg2);
|
||||||
|
if (face.IsNull() || face.ShapeType() != TopAbs_FACE)
|
||||||
|
{
|
||||||
|
di<<"A null shape or not a face is used."<<"\n";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the face is null, make a plane inside the wire.
|
||||||
|
if (face.IsNull())
|
||||||
|
{
|
||||||
|
BRepBuilderAPI_MakeFace mkFace(TopoDS::Wire(wire), true);
|
||||||
|
if (mkFace.IsDone())
|
||||||
|
face = mkFace.Face();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
di<<"Can't make a face for the wire. Provide please a face for analysis."<<"\n";
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ShapeAnalysis_Wire analyser(TopoDS::Wire(wire), TopoDS::Face(face), Precision::Confusion());
|
||||||
|
Standard_Boolean result = analyser.CheckSelfIntersection();
|
||||||
|
|
||||||
|
if (result == Standard_True)
|
||||||
|
di<<"A self-intersecting wire."<<"\n";
|
||||||
|
else
|
||||||
|
di<<"Not self-intersecting wire."<<"\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : InitCommands
|
//function : InitCommands
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -866,4 +923,5 @@ static Standard_Integer getareacontour (Draw_Interpretor& di,
|
|||||||
__FILE__, MyVISEDG, groupold);
|
__FILE__, MyVISEDG, groupold);
|
||||||
|
|
||||||
theCommands.Add("getareacontour","wire ",__FILE__, getareacontour, groupold);
|
theCommands.Add("getareacontour","wire ",__FILE__, getareacontour, groupold);
|
||||||
|
theCommands.Add ("checkselfintersection","wire [face]", __FILE__,checkselfintersection,g);
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,9 @@ void ShapeAnalysis_Wire::SetSurface (const Handle(Geom_Surface)& surface,
|
|||||||
|
|
||||||
Standard_Boolean isFail = Standard_False, isDone = Standard_False;
|
Standard_Boolean isFail = Standard_False, isDone = Standard_False;
|
||||||
for(Standard_Integer num1 = 1; num1 < nb-1; num1++) {
|
for(Standard_Integer num1 = 1; num1 < nb-1; num1++) {
|
||||||
Standard_Integer fin = (num1 == 1 ? nb-1 : nb);
|
Standard_Integer fin = nb;
|
||||||
|
if (CheckClosed(Precision::Confusion()) && 1 == num1)
|
||||||
|
fin = nb-1;
|
||||||
for(Standard_Integer num2 = num1+2; num2 <= fin; num2++)
|
for(Standard_Integer num2 = num1+2; num2 <= fin; num2++)
|
||||||
if(!boxes(num1).IsOut(boxes(num2))){
|
if(!boxes(num1).IsOut(boxes(num2))){
|
||||||
CheckIntersectingEdges(num1, num2);
|
CheckIntersectingEdges(num1, num2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user