1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024002: Overall code and build procedure refactoring -- automatic

Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl":
- WOK-generated header files from inc and sources from drv are moved to src
- CDL files removed
- All packages are converted to nocdlpack
This commit is contained in:
abv
2015-07-12 07:42:38 +03:00
parent 543a996496
commit 42cf5bc1ca
15354 changed files with 623957 additions and 509844 deletions

View File

@@ -1,4 +1,57 @@
ShapeFix_Wire_1.cxx
ShapeFix_SequenceOfWireSegment.hxx
ShapeFix_DataMapOfShapeBox2d.hxx
ShapeFix.cxx
ShapeFix.hxx
ShapeFix_ComposeShell.cxx
ShapeFix_ComposeShell.hxx
ShapeFix_DataMapIteratorOfDataMapOfShapeBox2d.hxx
ShapeFix_DataMapOfShapeBox2d.hxx
ShapeFix_Edge.cxx
ShapeFix_Edge.hxx
ShapeFix_EdgeConnect.cxx
ShapeFix_EdgeConnect.hxx
ShapeFix_EdgeProjAux.cxx
ShapeFix_EdgeProjAux.hxx
ShapeFix_Face.cxx
ShapeFix_Face.hxx
ShapeFix_Face.lxx
ShapeFix_FaceConnect.cxx
ShapeFix_FaceConnect.hxx
ShapeFix_FixSmallFace.cxx
ShapeFix_FixSmallFace.hxx
ShapeFix_FixSmallSolid.cxx
ShapeFix_FixSmallSolid.hxx
ShapeFix_FreeBounds.cxx
ShapeFix_FreeBounds.hxx
ShapeFix_FreeBounds.lxx
ShapeFix_IntersectionTool.cxx
ShapeFix_IntersectionTool.hxx
ShapeFix_IntersectionTool.lxx
ShapeFix_Root.cxx
ShapeFix_Root.hxx
ShapeFix_Root.lxx
ShapeFix_SequenceOfWireSegment.hxx
ShapeFix_Shape.cxx
ShapeFix_Shape.hxx
ShapeFix_Shape.lxx
ShapeFix_ShapeTolerance.cxx
ShapeFix_ShapeTolerance.hxx
ShapeFix_Shell.cxx
ShapeFix_Shell.hxx
ShapeFix_Shell.lxx
ShapeFix_Solid.cxx
ShapeFix_Solid.hxx
ShapeFix_Solid.lxx
ShapeFix_SplitCommonVertex.cxx
ShapeFix_SplitCommonVertex.hxx
ShapeFix_SplitTool.cxx
ShapeFix_SplitTool.hxx
ShapeFix_Wire.cxx
ShapeFix_Wire.hxx
ShapeFix_Wire.lxx
ShapeFix_Wire_1.cxx
ShapeFix_Wireframe.cxx
ShapeFix_Wireframe.hxx
ShapeFix_Wireframe.lxx
ShapeFix_WireSegment.cxx
ShapeFix_WireSegment.hxx
ShapeFix_WireVertex.cxx
ShapeFix_WireVertex.hxx

View File

@@ -1,136 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
package ShapeFix
---Purpose: This package provides algorithms for fixing
-- problematic (violating Open CASCADE requirements) shapes.
-- Tools from package ShapeAnalysis are used for detecting the problems. The
-- detecting and fixing is done taking in account various
-- criteria implemented in BRepCheck package.
-- Each class of package ShapeFix deals with one
-- certain type of shapes or with some family of problems.
uses
gp,
Geom,
Geom2d,
Geom2dAPI,
GeomAbs,
Adaptor3d,
TCollection,
TColStd,
TopAbs,
TopLoc,
TopoDS,
TopTools,
Message,
ShapeExtend,
ShapeAnalysis,
ShapeConstruct,
ShapeBuild,
Bnd
is
-- classes
class Root;
class EdgeProjAux;
class Edge;
class Wire;
class Face;
class FixSmallFace;
class FixSmallSolid;
class WireVertex;
class Wireframe;
class FreeBounds;
class FaceConnect;
class Shell;
class Solid;
class ShapeTolerance;
class Shape;
class EdgeConnect;
class ComposeShell;
class SplitCommonVertex;
class WireSegment;
class IntersectionTool;
class SplitTool;
imported SequenceOfWireSegment;
imported DataMapOfShapeBox2d;
imported DataMapIteratorOfDataMapOfShapeBox2d;
SameParameter (shape : Shape from TopoDS;
enforce : Boolean;
preci : Real = 0.0;
theProgress : ProgressIndicator from Message = 0;
theMsgReg : BasicMsgRegistrator from ShapeExtend = 0)
returns Boolean;
---Purpose : Runs SameParameter from BRepLib with these adaptations :
-- <enforce> forces computations, else they are made only on
-- Edges with flag SameParameter false
-- <preci>, if not precised, is taken for each EDge as its own
-- Tolerance
-- Returns True when done, False if an exception has been raised
-- In case of exception anyway, as many edges as possible have
-- been processed. The passed progress indicator allows user
-- to consult the current progress stage and abort algorithm
-- if needed.
EncodeRegularity (shape: Shape from TopoDS; tolang: Real = 1.0e-10);
---Purpose : Runs EncodeRegularity from BRepLib taking into account
-- shared components of assemblies, so that each component
-- is processed only once
RemoveSmallEdges (shape: in out Shape from TopoDS; Tolerance: Real; context: in out ReShape from ShapeBuild)
returns Shape from TopoDS;
---Purpose: Removes edges which are less than given tolerance from shape
-- with help of ShapeFix_Wire::FixSmall()
FixVertexPosition(theshape: in out Shape from TopoDS;
theTolerance: Real;
thecontext: ReShape from ShapeBuild) returns Boolean;
---Purpose: Fix position of the vertices having tolerance more tnan specified one.;
LeastEdgeSize(theshape: in out Shape from TopoDS) returns Real;
---Purpose: Calculate size of least edge;
end ShapeFix;

138
src/ShapeFix/ShapeFix.hxx Normal file
View File

@@ -0,0 +1,138 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_HeaderFile
#define _ShapeFix_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
class TopoDS_Shape;
class Message_ProgressIndicator;
class ShapeExtend_BasicMsgRegistrator;
class ShapeBuild_ReShape;
class ShapeFix_Root;
class ShapeFix_EdgeProjAux;
class ShapeFix_Edge;
class ShapeFix_Wire;
class ShapeFix_Face;
class ShapeFix_FixSmallFace;
class ShapeFix_FixSmallSolid;
class ShapeFix_WireVertex;
class ShapeFix_Wireframe;
class ShapeFix_FreeBounds;
class ShapeFix_FaceConnect;
class ShapeFix_Shell;
class ShapeFix_Solid;
class ShapeFix_ShapeTolerance;
class ShapeFix_Shape;
class ShapeFix_EdgeConnect;
class ShapeFix_ComposeShell;
class ShapeFix_SplitCommonVertex;
class ShapeFix_WireSegment;
class ShapeFix_IntersectionTool;
class ShapeFix_SplitTool;
//! This package provides algorithms for fixing
//! problematic (violating Open CASCADE requirements) shapes.
//! Tools from package ShapeAnalysis are used for detecting the problems. The
//! detecting and fixing is done taking in account various
//! criteria implemented in BRepCheck package.
//! Each class of package ShapeFix deals with one
//! certain type of shapes or with some family of problems.
class ShapeFix
{
public:
DEFINE_STANDARD_ALLOC
//! Runs SameParameter from BRepLib with these adaptations :
//! <enforce> forces computations, else they are made only on
//! Edges with flag SameParameter false
//! <preci>, if not precised, is taken for each EDge as its own
//! Tolerance
//! Returns True when done, False if an exception has been raised
//! In case of exception anyway, as many edges as possible have
//! been processed. The passed progress indicator allows user
//! to consult the current progress stage and abort algorithm
//! if needed.
Standard_EXPORT static Standard_Boolean SameParameter (const TopoDS_Shape& shape, const Standard_Boolean enforce, const Standard_Real preci = 0.0, const Handle(Message_ProgressIndicator)& theProgress = 0, const Handle(ShapeExtend_BasicMsgRegistrator)& theMsgReg = 0);
//! Runs EncodeRegularity from BRepLib taking into account
//! shared components of assemblies, so that each component
//! is processed only once
Standard_EXPORT static void EncodeRegularity (const TopoDS_Shape& shape, const Standard_Real tolang = 1.0e-10);
//! Removes edges which are less than given tolerance from shape
//! with help of ShapeFix_Wire::FixSmall()
Standard_EXPORT static TopoDS_Shape RemoveSmallEdges (TopoDS_Shape& shape, const Standard_Real Tolerance, Handle(ShapeBuild_ReShape)& context);
//! Fix position of the vertices having tolerance more tnan specified one.;
Standard_EXPORT static Standard_Boolean FixVertexPosition (TopoDS_Shape& theshape, const Standard_Real theTolerance, const Handle(ShapeBuild_ReShape)& thecontext);
//! Calculate size of least edge;
Standard_EXPORT static Standard_Real LeastEdgeSize (TopoDS_Shape& theshape);
protected:
private:
friend class ShapeFix_Root;
friend class ShapeFix_EdgeProjAux;
friend class ShapeFix_Edge;
friend class ShapeFix_Wire;
friend class ShapeFix_Face;
friend class ShapeFix_FixSmallFace;
friend class ShapeFix_FixSmallSolid;
friend class ShapeFix_WireVertex;
friend class ShapeFix_Wireframe;
friend class ShapeFix_FreeBounds;
friend class ShapeFix_FaceConnect;
friend class ShapeFix_Shell;
friend class ShapeFix_Solid;
friend class ShapeFix_ShapeTolerance;
friend class ShapeFix_Shape;
friend class ShapeFix_EdgeConnect;
friend class ShapeFix_ComposeShell;
friend class ShapeFix_SplitCommonVertex;
friend class ShapeFix_WireSegment;
friend class ShapeFix_IntersectionTool;
friend class ShapeFix_SplitTool;
};
#endif // _ShapeFix_HeaderFile

View File

@@ -1,275 +0,0 @@
-- Created on: 1999-04-26
-- Created by: Andrey BETENEV
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ComposeShell from ShapeFix inherits Root from ShapeFix
---Purpose: This class is intended to create a shell from the composite
-- surface (grid of surfaces) and set of wires.
-- It may be either division of the supporting surface of the
-- face, or creating a shape corresponding to face on composite
-- surface which is missing in CAS.CADE but exists in some other
-- systems.
--
-- It splits (if necessary) original face to several ones by
-- splitting lines which are joint lines on a supplied grid of
-- surfaces (U- and V- isolines of the composite surface).
-- There are two modes of work, which differ in the way of
-- handling faces on periodic surfaces:
--
-- - if ClosedMode is False (default), when splitting itself is
-- done as if surface were not periodic. The periodicity of the
-- underlying surface is taken into account by duplicating splitting
-- lines in the periodic direction, as necessary to split all
-- the wires (whole parametrical range of a face)
-- In this mode, some regularization procedures are performed
-- (indexation of splitted segments by patch numbers), and it is
-- expected to be more reliable and robust in case of bad shapes
--
-- - if ClosedMode is True, when everything on a periodic surfaces
-- is considered as modulo period. This allows to deal with wires
-- which are closed in 3d but not in 2d, with wires which may be
-- shifted on several periods in 2d etc. However, this mode is
-- less reliable since some regularizations do not work for it.
--
-- The work is made basing on pcurves of the edges. These pcurves
-- should already exist (for example, in the case of division of
-- existing face), then they are taken as is. The existing pcurves
-- should be assigned to one surface (face) for all edges,
-- this surface (face) will be used only for accessing pcurves,
-- and it may have any geometry.
--
-- All the modifications are recorded in the context tool
-- (ShapeBuild_ReShape).
uses
Lin2d from gp,
Curve from Geom2d,
Surface from Geom,
Location from TopLoc,
Edge from TopoDS,
Face from TopoDS,
Shape from TopoDS,
Status from ShapeExtend,
WireData from ShapeExtend,
CompositeSurface from ShapeExtend,
WireSegment from ShapeFix,
Orientation from TopAbs,
SequenceOfReal from TColStd,
SequenceOfInteger from TColStd,
SequenceOfShape from TopTools,
SequenceOfWireSegment from ShapeFix,
TransferParameters from ShapeAnalysis
is
Create returns ComposeShell from ShapeFix;
---Purpose: Creates empty tool.
Init (me: mutable; Grid: CompositeSurface from ShapeExtend;
L : Location from TopLoc;
Face: Face from TopoDS;
Prec: Real);
---Purpose: Initializes with composite surface, face and precision.
-- Here face defines both set of wires and way of getting
-- pcurves. Precision is used (together with tolerance of edges)
-- for handling subtle cases, such as tangential intersections.
ClosedMode (me: mutable) returns Boolean;
---Purpose: Returns (modifiable) flag for special 'closed'
-- mode which forces ComposeShell to consider
-- all pcurves on closed surface as modulo period.
-- This can reduce reliability, but allows to deal
-- with wires closed in 3d but open in 2d (missing seam)
-- Default is False
---C++: return &
Perform (me: mutable)
returns Boolean is virtual;
---Purpose: Performs the work on already loaded data.
SplitEdges (me: mutable);
---Purpose: Splits edges in the original shape by grid.
-- This is a part of Perform() which does not produce any
-- resulting shape; the only result is filled context
-- where splittings are recorded.
--
-- NOTE: If edge is splitted, it is replaced by wire, and
-- order of edges in the wire corresponds to FORWARD orientation
-- of the edge.
Result (me) returns Shape from TopoDS;
---Purpose: Returns resulting shell or face (or Null shape if not done)
---C++: return const &
Status (me; status: Status from ShapeExtend) returns Boolean;
---Purpose: Queries status of last call to Perform()
-- OK : nothing done (some kind of error)
-- DONE1: splitting is done, at least one new face created
-- DONE2: splitting is done, several new faces obtained
-- FAIL1: misoriented wire encountered (handled)
-- FAIL2: recoverable parity error
-- FAIL3: edge with no pcurve on supporting face
-- FAIL4: unrecoverable algorithm error (parity check)
---Protected methods:
LoadWires (me; seqw: out SequenceOfWireSegment from ShapeFix)
is protected;
---Purpose: Fill sequence of wire segments by wires from myFace
-- (pre-loaded). It performs reorder so that edges in segments
-- are well-ordered. The context is applied to all wires
-- before using them.
ComputeCode (me: mutable; wire : WireData from ShapeExtend;
line : Lin2d from gp;
begInd: Integer;
endInd: Integer;
begPar: Real;
endPar: Real;
IsInternal : Boolean = Standard_False)
returns Integer is protected;
---Purpose: Analyze tangencies and compute orientation code for wire segment
-- between two intersections: tells if segment is on left or right side
-- of cutting line, or tangent to it (by several points recomputed to 3d,
-- distance is compared with tolerance of corresponding edge).
SplitWire (me: mutable; wire : in out WireSegment from ShapeFix;
indexes : in out SequenceOfInteger from TColStd;
values : SequenceOfReal from TColStd;
vertices: out SequenceOfShape from TopTools;
segcodes: SequenceOfInteger from TColStd;
cutbyu : Boolean;
cutindex: Integer)
returns WireSegment from ShapeFix is protected;
---Purpose: Splits edges in the wire by given indices of edges and
-- parameters on them. Returns resulting wire and vertices
-- corresponding to splitting parameters. If two consequtive
-- splitting points are too near one to another (with tolerance
-- of edge), edge is divided in single point. In the same way,
-- splitting which is too near to end of edge, is not applied
-- (end vertex is returned instead).
--
-- NOTE: If edge is splitted, it is replaced by wire, and
-- order of edges in the wire corresponds to FORWARD orientation
-- of the edge.
SplitByLine (me: mutable; wire : in out WireSegment from ShapeFix;
line : Lin2d from gp;
cutbyu : Boolean;
cutindex: Integer;
SplitLinePar : out SequenceOfReal from TColStd;
SplitLineCode : out SequenceOfInteger from TColStd;
SplitLineVertex: out SequenceOfShape from TopTools)
returns Boolean is protected;
---Purpose: Split edges in the wire by cutting line.
-- Wires with FORWARD or REVERSED orientation are considered
-- as closed.
--
-- All modifications (splitting) are recorded in context,
-- except splitting of wires marked as EXTERNAL
-- (they are supposed to be former cutting lines).
--
-- Method fills sequences of parameters of intersection points
-- of cutting line with all edges, their types, and corresponding
-- vertices (including ones created during splitting edges).
SplitByLine (me: mutable; seqw: in out SequenceOfWireSegment from ShapeFix;
line: Lin2d from gp;
cutbyu : Boolean;
cutindex: Integer)
is protected;
---Purpose: Split edges in the sequence of wires by cutting line.
-- Wires with FORWARD or REVERSED orientation are considered
-- as closed.
--
-- Parts of cutting line which get inside the face (defined by
-- parity check of intersections with all wires) are added
-- into that sequence (with orientation EXTERNAL). Each part
-- is represented by one-edge wire segment with no 3d curve.
-- They share common vertices with all wires they intersect.
--
-- All modifications (splitting) are recorded in context,
-- except splitting of wires marked as EXTERNAL
-- (they are supposed to be former cutting lines).
SplitByGrid (me: mutable; seqw: in out SequenceOfWireSegment from ShapeFix)
is protected;
---Purpose: Split initial set of (closed) wires by grid of lines corresponding
-- to joints between patches on the composite surface.
-- Parts of joint lines which get inside the face are also added
-- into the sequence as wires with orientation EXTERNAL.
-- They share common vertices with all wires they intersect.
-- All modifications (splitting) are recorded in context,
-- except splitting of joint edge itself and wires marked as
-- EXTERNAL (they supposed to be another joint edges).
BreakWires (me: mutable; seqw: in out SequenceOfWireSegment from ShapeFix)
is protected;
---Purpose: Break wires into open wire segments by common vertices
-- (splitting points), so that each segment is either closed and
-- not touching others, or touches others at ends (have common
-- vertices).
-- After that, each wire segment lies on its own patch of grid.
CollectWires (me: mutable; wires: out SequenceOfWireSegment from ShapeFix;
seqw : in out SequenceOfWireSegment from ShapeFix )
is protected;
---Purpose: Collect set of wire segments (already splitted) into closed
-- wires. This is done by traversing all the segments in allowed
-- directions, starting only from the REVERSED and FORWARD and
-- taking EXTERNAL as necessary in fork points. Forks are detected
-- by common vertices. In fork point, most left way is seleccted
-- among all possible ways.
MakeFacesOnPatch (me; faces: out SequenceOfShape from TopTools;
surf : Surface from Geom;
loops: in out SequenceOfShape from TopTools)
is protected;
---Purpose: Creates new faces on one path of grid. It dispatches given loops
-- (wires) into one or several faces depending on their mutual
-- position.
DispatchWires (me; faces : out SequenceOfShape from TopTools;
wires : in out SequenceOfWireSegment from ShapeFix);
---Purpose: Creates new faces from the set of (closed) wires. Each wire
-- is put on corresponding patch in the composite surface,
-- and all pcurves on the initial (pseudo)face are reassigned to
-- that surface. If several wires are one inside another, single
-- face is created.
SetTransferParamTool(me: mutable; TransferParam : TransferParameters from ShapeAnalysis);
---Purpose: Sets tool for transfer parameters from 3d to 2d and vice versa.
GetTransferParamTool(me) returns TransferParameters from ShapeAnalysis;
---Purpose: Gets tool for transfer parameters from 3d to 2d and vice versa.
fields
myGrid : CompositeSurface from ShapeExtend;
myLoc : Location from TopLoc;
myFace : Face from TopoDS; -- underlying face for pcurves (real or pseudo)
myOrient : Orientation from TopAbs is protected; -- orientation of face
myResult : Shape from TopoDS is protected;
myStatus : Integer is protected;
myUResolution: Real; -- summary resolution on grid (minimum on patches)
myVResolution: Real;
myTransferParamTool: TransferParameters from ShapeAnalysis;
myInvertEdgeStatus : Boolean;
myClosedMode : Boolean;
myUClosed : Boolean;
myVClosed : Boolean;
myUPeriod : Real;
myVPeriod : Real;
end ComposeShell;

View File

@@ -18,71 +18,69 @@
// abv 22.07.99 implementing patch indices
// svv 10.01.00 porting on DEC
#include <ShapeFix_ComposeShell.ixx>
#include <Precision.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Dir2d.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfBoolean.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <IntRes2d_IntersectionSegment.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_Domain.hxx>
#include <Geom2dInt_GInter.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <BRepTools.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <ShapeExtend.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeBuild_Vertex.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_WireSegment.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <gp_Pnt.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <Extrema_ExtPC2d.hxx>
#include <ShapeAnalysis.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <IntRes2d_Domain.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_IntersectionSegment.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeAnalysis_TransferParameters.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeBuild_Vertex.hxx>
#include <ShapeExtend.hxx>
#include <ShapeExtend_CompositeSurface.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix_ComposeShell.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_WireSegment.hxx>
#include <Standard_Type.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <TColStd_Array1OfBoolean.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//=======================================================================
//function : ShapeFix_ComposeShell
//purpose :
//=======================================================================
ShapeFix_ComposeShell::ShapeFix_ComposeShell () :
myStatus(0), myClosedMode(Standard_False)
{

View File

@@ -0,0 +1,270 @@
// Created on: 1999-04-26
// Created by: Andrey BETENEV
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_ComposeShell_HeaderFile
#define _ShapeFix_ComposeShell_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS_Face.hxx>
#include <TopAbs_Orientation.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <ShapeFix_Root.hxx>
#include <ShapeExtend_Status.hxx>
#include <ShapeFix_SequenceOfWireSegment.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TopTools_SequenceOfShape.hxx>
class ShapeExtend_CompositeSurface;
class ShapeAnalysis_TransferParameters;
class TopLoc_Location;
class TopoDS_Face;
class TopoDS_Shape;
class ShapeExtend_WireData;
class gp_Lin2d;
class ShapeFix_WireSegment;
class Geom_Surface;
class ShapeFix_ComposeShell;
DEFINE_STANDARD_HANDLE(ShapeFix_ComposeShell, ShapeFix_Root)
//! This class is intended to create a shell from the composite
//! surface (grid of surfaces) and set of wires.
//! It may be either division of the supporting surface of the
//! face, or creating a shape corresponding to face on composite
//! surface which is missing in CAS.CADE but exists in some other
//! systems.
//!
//! It splits (if necessary) original face to several ones by
//! splitting lines which are joint lines on a supplied grid of
//! surfaces (U- and V- isolines of the composite surface).
//! There are two modes of work, which differ in the way of
//! handling faces on periodic surfaces:
//!
//! - if ClosedMode is False (default), when splitting itself is
//! done as if surface were not periodic. The periodicity of the
//! underlying surface is taken into account by duplicating splitting
//! lines in the periodic direction, as necessary to split all
//! the wires (whole parametrical range of a face)
//! In this mode, some regularization procedures are performed
//! (indexation of splitted segments by patch numbers), and it is
//! expected to be more reliable and robust in case of bad shapes
//!
//! - if ClosedMode is True, when everything on a periodic surfaces
//! is considered as modulo period. This allows to deal with wires
//! which are closed in 3d but not in 2d, with wires which may be
//! shifted on several periods in 2d etc. However, this mode is
//! less reliable since some regularizations do not work for it.
//!
//! The work is made basing on pcurves of the edges. These pcurves
//! should already exist (for example, in the case of division of
//! existing face), then they are taken as is. The existing pcurves
//! should be assigned to one surface (face) for all edges,
//! this surface (face) will be used only for accessing pcurves,
//! and it may have any geometry.
//!
//! All the modifications are recorded in the context tool
//! (ShapeBuild_ReShape).
class ShapeFix_ComposeShell : public ShapeFix_Root
{
public:
//! Creates empty tool.
Standard_EXPORT ShapeFix_ComposeShell();
//! Initializes with composite surface, face and precision.
//! Here face defines both set of wires and way of getting
//! pcurves. Precision is used (together with tolerance of edges)
//! for handling subtle cases, such as tangential intersections.
Standard_EXPORT void Init (const Handle(ShapeExtend_CompositeSurface)& Grid, const TopLoc_Location& L, const TopoDS_Face& Face, const Standard_Real Prec);
//! Returns (modifiable) flag for special 'closed'
//! mode which forces ComposeShell to consider
//! all pcurves on closed surface as modulo period.
//! This can reduce reliability, but allows to deal
//! with wires closed in 3d but open in 2d (missing seam)
//! Default is False
Standard_EXPORT Standard_Boolean& ClosedMode();
//! Performs the work on already loaded data.
Standard_EXPORT virtual Standard_Boolean Perform();
//! Splits edges in the original shape by grid.
//! This is a part of Perform() which does not produce any
//! resulting shape; the only result is filled context
//! where splittings are recorded.
//!
//! NOTE: If edge is splitted, it is replaced by wire, and
//! order of edges in the wire corresponds to FORWARD orientation
//! of the edge.
Standard_EXPORT void SplitEdges();
//! Returns resulting shell or face (or Null shape if not done)
Standard_EXPORT const TopoDS_Shape& Result() const;
//! Queries status of last call to Perform()
//! OK : nothing done (some kind of error)
//! DONE1: splitting is done, at least one new face created
//! DONE2: splitting is done, several new faces obtained
//! FAIL1: misoriented wire encountered (handled)
//! FAIL2: recoverable parity error
//! FAIL3: edge with no pcurve on supporting face
//! FAIL4: unrecoverable algorithm error (parity check)
Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
//! Creates new faces from the set of (closed) wires. Each wire
//! is put on corresponding patch in the composite surface,
//! and all pcurves on the initial (pseudo)face are reassigned to
//! that surface. If several wires are one inside another, single
//! face is created.
Standard_EXPORT void DispatchWires (TopTools_SequenceOfShape& faces, ShapeFix_SequenceOfWireSegment& wires) const;
//! Sets tool for transfer parameters from 3d to 2d and vice versa.
Standard_EXPORT void SetTransferParamTool (const Handle(ShapeAnalysis_TransferParameters)& TransferParam);
//! Gets tool for transfer parameters from 3d to 2d and vice versa.
Standard_EXPORT Handle(ShapeAnalysis_TransferParameters) GetTransferParamTool() const;
DEFINE_STANDARD_RTTI(ShapeFix_ComposeShell,ShapeFix_Root)
protected:
//! Fill sequence of wire segments by wires from myFace
//! (pre-loaded). It performs reorder so that edges in segments
//! are well-ordered. The context is applied to all wires
//! before using them.
Standard_EXPORT void LoadWires (ShapeFix_SequenceOfWireSegment& seqw) const;
//! Analyze tangencies and compute orientation code for wire segment
//! between two intersections: tells if segment is on left or right side
//! of cutting line, or tangent to it (by several points recomputed to 3d,
//! distance is compared with tolerance of corresponding edge).
Standard_EXPORT Standard_Integer ComputeCode (const Handle(ShapeExtend_WireData)& wire, const gp_Lin2d& line, const Standard_Integer begInd, const Standard_Integer endInd, const Standard_Real begPar, const Standard_Real endPar, const Standard_Boolean IsInternal = Standard_False);
//! Splits edges in the wire by given indices of edges and
//! parameters on them. Returns resulting wire and vertices
//! corresponding to splitting parameters. If two consequtive
//! splitting points are too near one to another (with tolerance
//! of edge), edge is divided in single point. In the same way,
//! splitting which is too near to end of edge, is not applied
//! (end vertex is returned instead).
//!
//! NOTE: If edge is splitted, it is replaced by wire, and
//! order of edges in the wire corresponds to FORWARD orientation
//! of the edge.
Standard_EXPORT ShapeFix_WireSegment SplitWire (ShapeFix_WireSegment& wire, TColStd_SequenceOfInteger& indexes, const TColStd_SequenceOfReal& values, TopTools_SequenceOfShape& vertices, const TColStd_SequenceOfInteger& segcodes, const Standard_Boolean cutbyu, const Standard_Integer cutindex);
//! Split edges in the wire by cutting line.
//! Wires with FORWARD or REVERSED orientation are considered
//! as closed.
//!
//! All modifications (splitting) are recorded in context,
//! except splitting of wires marked as EXTERNAL
//! (they are supposed to be former cutting lines).
//!
//! Method fills sequences of parameters of intersection points
//! of cutting line with all edges, their types, and corresponding
//! vertices (including ones created during splitting edges).
Standard_EXPORT Standard_Boolean SplitByLine (ShapeFix_WireSegment& wire, const gp_Lin2d& line, const Standard_Boolean cutbyu, const Standard_Integer cutindex, TColStd_SequenceOfReal& SplitLinePar, TColStd_SequenceOfInteger& SplitLineCode, TopTools_SequenceOfShape& SplitLineVertex);
//! Split edges in the sequence of wires by cutting line.
//! Wires with FORWARD or REVERSED orientation are considered
//! as closed.
//!
//! Parts of cutting line which get inside the face (defined by
//! parity check of intersections with all wires) are added
//! into that sequence (with orientation EXTERNAL). Each part
//! is represented by one-edge wire segment with no 3d curve.
//! They share common vertices with all wires they intersect.
//!
//! All modifications (splitting) are recorded in context,
//! except splitting of wires marked as EXTERNAL
//! (they are supposed to be former cutting lines).
Standard_EXPORT void SplitByLine (ShapeFix_SequenceOfWireSegment& seqw, const gp_Lin2d& line, const Standard_Boolean cutbyu, const Standard_Integer cutindex);
//! Split initial set of (closed) wires by grid of lines corresponding
//! to joints between patches on the composite surface.
//! Parts of joint lines which get inside the face are also added
//! into the sequence as wires with orientation EXTERNAL.
//! They share common vertices with all wires they intersect.
//! All modifications (splitting) are recorded in context,
//! except splitting of joint edge itself and wires marked as
//! EXTERNAL (they supposed to be another joint edges).
Standard_EXPORT void SplitByGrid (ShapeFix_SequenceOfWireSegment& seqw);
//! Break wires into open wire segments by common vertices
//! (splitting points), so that each segment is either closed and
//! not touching others, or touches others at ends (have common
//! vertices).
//! After that, each wire segment lies on its own patch of grid.
Standard_EXPORT void BreakWires (ShapeFix_SequenceOfWireSegment& seqw);
//! Collect set of wire segments (already splitted) into closed
//! wires. This is done by traversing all the segments in allowed
//! directions, starting only from the REVERSED and FORWARD and
//! taking EXTERNAL as necessary in fork points. Forks are detected
//! by common vertices. In fork point, most left way is seleccted
//! among all possible ways.
Standard_EXPORT void CollectWires (ShapeFix_SequenceOfWireSegment& wires, ShapeFix_SequenceOfWireSegment& seqw);
//! Creates new faces on one path of grid. It dispatches given loops
//! (wires) into one or several faces depending on their mutual
//! position.
Standard_EXPORT void MakeFacesOnPatch (TopTools_SequenceOfShape& faces, const Handle(Geom_Surface)& surf, TopTools_SequenceOfShape& loops) const;
TopAbs_Orientation myOrient;
TopoDS_Shape myResult;
Standard_Integer myStatus;
private:
Handle(ShapeExtend_CompositeSurface) myGrid;
TopLoc_Location myLoc;
TopoDS_Face myFace;
Standard_Real myUResolution;
Standard_Real myVResolution;
Handle(ShapeAnalysis_TransferParameters) myTransferParamTool;
Standard_Boolean myInvertEdgeStatus;
Standard_Boolean myClosedMode;
Standard_Boolean myUClosed;
Standard_Boolean myVClosed;
Standard_Real myUPeriod;
Standard_Real myVPeriod;
};
#endif // _ShapeFix_ComposeShell_HeaderFile

View File

@@ -1,202 +0,0 @@
-- Created on: 1998-06-17
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Edge from ShapeFix inherits TShared from MMgt
---Purpose: Fixing invalid edge.
-- Geometrical and/or topological inconsistency:
-- - no 3d curve or pcurve,
-- - mismatching orientation of 3d curve and pcurve,
-- - incorrect SameParameter flag (curve deviation is greater than
-- edge tolerance),
-- - not adjacent curves (3d or pcurve) to the vertices.
uses
Surface from Geom,
Surface from ShapeAnalysis,
Edge from TopoDS,
Face from TopoDS,
Location from TopLoc,
Status from ShapeExtend,
ProjectCurveOnSurface from ShapeConstruct
is
Create returns Edge from ShapeFix;
---Purpose: Empty constructor
Projector (me: mutable) returns ProjectCurveOnSurface from ShapeConstruct;
---Purpose: Returns the projector used for recomputing missing pcurves
-- Can be used for adjusting parameters of projector
FixRemovePCurve (me: mutable; edge: Edge from TopoDS;
face: Face from TopoDS)
returns Boolean;
FixRemovePCurve (me: mutable; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc)
returns Boolean;
---Purpose: Removes the pcurve(s) of the edge if it does not match the
-- vertices
-- Check is done
-- Use : It is to be called when pcurve of an edge can be wrong
-- (e.g., after import from IGES)
-- Returns: True, if does not match, removed (status DONE)
-- False, (status OK) if matches or (status FAIL) if no pcurve,
-- nothing done
FixRemoveCurve3d (me: mutable; edge: Edge from TopoDS) returns Boolean;
---Purpose: Removes 3d curve of the edge if it does not match the vertices
-- Returns: True, if does not match, removed (status DONE)
-- False, (status OK) if matches or (status FAIL) if no 3d curve,
-- nothing done
FixAddPCurve (me: mutable; edge : Edge from TopoDS;
face : Face from TopoDS;
isSeam: Boolean;
prec : Real = 0.0)
returns Boolean;
---Purpose: See method below for information
FixAddPCurve (me: mutable; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc;
isSeam : Boolean;
prec : Real = 0.0)
returns Boolean;
---Purpose: See method below for information
FixAddPCurve (me: mutable; edge : Edge from TopoDS;
face : Face from TopoDS;
isSeam : Boolean;
surfana : Surface from ShapeAnalysis;
prec : Real = 0.0)
returns Boolean;
---Purpose: See method below for information
FixAddPCurve (me: mutable; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc;
isSeam : Boolean;
surfana : Surface from ShapeAnalysis;
prec : Real = 0.0)
returns Boolean;
---Purpose: Adds pcurve(s) of the edge if missing (by projecting 3d curve)
-- Parameter isSeam indicates if the edge is a seam.
-- The parameter <prec> defines the precision for calculations.
-- If it is 0 (default), the tolerance of the edge is taken.
-- Remark : This method is rather for internal use since it accepts parameter
-- <surfana> for optimization of computations
-- Use : It is to be called after FixRemovePCurve (if removed) or in any
-- case when edge can have no pcurve
-- Returns: True if pcurve was added, else False
-- Status :
-- OK : Pcurve exists
-- FAIL1: No 3d curve
-- FAIL2: fail during projecting
-- DONE1: Pcurve was added
-- DONE2: specific case of pcurve going through degenerated point on
-- sphere encountered during projection (see class
-- ShapeConstruct_ProjectCurveOnSurface for more info)
FixAddCurve3d (me: mutable; edge: Edge from TopoDS) returns Boolean;
---Purpose: Tries to build 3d curve of the edge if missing
-- Use : It is to be called after FixRemoveCurve3d (if removed) or in any
-- case when edge can have no 3d curve
-- Returns: True if 3d curve was added, else False
-- Status :
-- OK : 3d curve exists
-- FAIL1: BRepLib::BuildCurve3d() has failed
-- DONE1: 3d curve was added
FixVertexTolerance (me: mutable; edge: Edge from TopoDS;
face: Face from TopoDS) returns Boolean;
FixVertexTolerance (me: mutable; edge: Edge from TopoDS) returns Boolean;
---Purpose: Increases the tolerances of the edge vertices to comprise
-- the ends of 3d curve and pcurve on the given face
-- (first method) or all pcurves stored in an edge (second one)
-- Returns: True, if tolerances have been increased, otherwise False
-- Status:
-- OK : the original tolerances have not been changed
-- DONE1: the tolerance of first vertex has been increased
-- DONE2: the tolerance of last vertex has been increased
FixReversed2d (me: mutable; edge: Edge from TopoDS;
face: Face from TopoDS)
returns Boolean;
FixReversed2d (me: mutable; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc)
returns Boolean;
---Purpose: Fixes edge if pcurve is directed opposite to 3d curve
-- Check is done by call to the function
-- ShapeAnalysis_Edge::CheckCurve3dWithPCurve()
-- Warning: For seam edge this method will check and fix the pcurve in only
-- one direction. Hence, it should be called twice for seam edge:
-- once with edge orientation FORWARD and once with REVERSED.
-- Returns: False if nothing done, True if reversed (status DONE)
-- Status: OK - pcurve OK, nothing done
-- FAIL1 - no pcurve
-- FAIL2 - no 3d curve
-- DONE1 - pcurve was reversed
FixSameParameter (me: mutable; edge : Edge from TopoDS;
tolerance: Real = 0.0)
returns Boolean;
---Purpose: Tries to make edge SameParameter and sets corresponding
-- tolerance and SameParameter flag.
-- First, it makes edge same range if SameRange flag is not set.
--
-- If flag SameParameter is set, this method calls the
-- function ShapeAnalysis_Edge::CheckSameParameter() that
-- calculates the maximal deviation of pcurves of the edge from
-- its 3d curve. If deviation > tolerance, the tolerance of edge
-- is increased to a value of deviation. If deviation < tolerance
-- nothing happens.
--
-- If flag SameParameter is not set, this method chooses the best
-- variant (one that has minimal tolerance), either
-- a. only after computing deviation (as above) or
-- b. after calling standard procedure BRepLib::SameParameter
-- and computing deviation (as above). If <tolerance> > 0, it is
-- used as parameter for BRepLib::SameParameter, otherwise,
-- tolerance of the edge is used.
--
-- Use : Is to be called after all pcurves and 3d curve of the edge are
-- correctly computed
-- Remark : SameParameter flag is always set to True after this method
-- Returns: True, if something done, else False
-- Status : OK - edge was initially SameParameter, nothing is done
-- FAIL1 - computation of deviation of pcurves from 3d curve has failed
-- FAIL2 - BRepLib::SameParameter() has failed
-- DONE1 - tolerance of the edge was increased
-- DONE2 - flag SameParameter was set to True (only if
-- BRepLib::SameParameter() did not set it)
-- DONE3 - edge was modified by BRepLib::SameParameter() to SameParameter
-- DONE4 - not used anymore
-- DONE5 - if the edge resulting from BRepLib has been chosen, i.e. variant b. above
-- (only for edges with not set SameParameter)
Status (me; status: Status from ShapeExtend) returns Boolean;
---Purpose: Returns the status (in the form of True/False) of last Fix
fields
myStatus: Integer is protected;
myProjector: ProjectCurveOnSurface from ShapeConstruct is protected;
end Edge;

View File

@@ -21,49 +21,49 @@
//:r4 abv 02.04.99 improving method FixSameParameter()
//:s5 abv 22.04.99 Adding debug printouts in catch {} blocks
// abv 05.05.99 S4137: method CopyPCurves moved to ShapeBuild_Edge
#include <ShapeFix_Edge.ixx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <BRep_Builder.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_ListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx>
#include <BRepLib.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BoundedCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom_Curve.hxx>
#include <GeomLib.hxx>
#include <Precision.hxx>
#include <TopExp.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeExtend.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom2d_BoundedCurve.hxx>
#include <Geom_Surface.hxx>
#include <GeomLib.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
#include <ShapeExtend.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Type.hxx>
#include <TopExp.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
//=======================================================================
//function : ShapeFix_Edge
//purpose :
//=======================================================================
ShapeFix_Edge::ShapeFix_Edge()
{
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);

View File

@@ -0,0 +1,205 @@
// Created on: 1998-06-17
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_Edge_HeaderFile
#define _ShapeFix_Edge_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <ShapeExtend_Status.hxx>
class ShapeConstruct_ProjectCurveOnSurface;
class TopoDS_Edge;
class TopoDS_Face;
class Geom_Surface;
class TopLoc_Location;
class ShapeAnalysis_Surface;
class ShapeFix_Edge;
DEFINE_STANDARD_HANDLE(ShapeFix_Edge, MMgt_TShared)
//! Fixing invalid edge.
//! Geometrical and/or topological inconsistency:
//! - no 3d curve or pcurve,
//! - mismatching orientation of 3d curve and pcurve,
//! - incorrect SameParameter flag (curve deviation is greater than
//! edge tolerance),
//! - not adjacent curves (3d or pcurve) to the vertices.
class ShapeFix_Edge : public MMgt_TShared
{
public:
//! Empty constructor
Standard_EXPORT ShapeFix_Edge();
//! Returns the projector used for recomputing missing pcurves
//! Can be used for adjusting parameters of projector
Standard_EXPORT Handle(ShapeConstruct_ProjectCurveOnSurface) Projector();
Standard_EXPORT Standard_Boolean FixRemovePCurve (const TopoDS_Edge& edge, const TopoDS_Face& face);
//! Removes the pcurve(s) of the edge if it does not match the
//! vertices
//! Check is done
//! Use : It is to be called when pcurve of an edge can be wrong
//! (e.g., after import from IGES)
//! Returns: True, if does not match, removed (status DONE)
//! False, (status OK) if matches or (status FAIL) if no pcurve,
//! nothing done
Standard_EXPORT Standard_Boolean FixRemovePCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location);
//! Removes 3d curve of the edge if it does not match the vertices
//! Returns: True, if does not match, removed (status DONE)
//! False, (status OK) if matches or (status FAIL) if no 3d curve,
//! nothing done
Standard_EXPORT Standard_Boolean FixRemoveCurve3d (const TopoDS_Edge& edge);
//! See method below for information
Standard_EXPORT Standard_Boolean FixAddPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face, const Standard_Boolean isSeam, const Standard_Real prec = 0.0);
//! See method below for information
Standard_EXPORT Standard_Boolean FixAddPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, const Standard_Boolean isSeam, const Standard_Real prec = 0.0);
//! See method below for information
Standard_EXPORT Standard_Boolean FixAddPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face, const Standard_Boolean isSeam, const Handle(ShapeAnalysis_Surface)& surfana, const Standard_Real prec = 0.0);
//! Adds pcurve(s) of the edge if missing (by projecting 3d curve)
//! Parameter isSeam indicates if the edge is a seam.
//! The parameter <prec> defines the precision for calculations.
//! If it is 0 (default), the tolerance of the edge is taken.
//! Remark : This method is rather for internal use since it accepts parameter
//! <surfana> for optimization of computations
//! Use : It is to be called after FixRemovePCurve (if removed) or in any
//! case when edge can have no pcurve
//! Returns: True if pcurve was added, else False
//! Status :
//! OK : Pcurve exists
//! FAIL1: No 3d curve
//! FAIL2: fail during projecting
//! DONE1: Pcurve was added
//! DONE2: specific case of pcurve going through degenerated point on
//! sphere encountered during projection (see class
//! ShapeConstruct_ProjectCurveOnSurface for more info)
Standard_EXPORT Standard_Boolean FixAddPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, const Standard_Boolean isSeam, const Handle(ShapeAnalysis_Surface)& surfana, const Standard_Real prec = 0.0);
//! Tries to build 3d curve of the edge if missing
//! Use : It is to be called after FixRemoveCurve3d (if removed) or in any
//! case when edge can have no 3d curve
//! Returns: True if 3d curve was added, else False
//! Status :
//! OK : 3d curve exists
//! FAIL1: BRepLib::BuildCurve3d() has failed
//! DONE1: 3d curve was added
Standard_EXPORT Standard_Boolean FixAddCurve3d (const TopoDS_Edge& edge);
Standard_EXPORT Standard_Boolean FixVertexTolerance (const TopoDS_Edge& edge, const TopoDS_Face& face);
//! Increases the tolerances of the edge vertices to comprise
//! the ends of 3d curve and pcurve on the given face
//! (first method) or all pcurves stored in an edge (second one)
//! Returns: True, if tolerances have been increased, otherwise False
//! Status:
//! OK : the original tolerances have not been changed
//! DONE1: the tolerance of first vertex has been increased
//! DONE2: the tolerance of last vertex has been increased
Standard_EXPORT Standard_Boolean FixVertexTolerance (const TopoDS_Edge& edge);
Standard_EXPORT Standard_Boolean FixReversed2d (const TopoDS_Edge& edge, const TopoDS_Face& face);
//! Fixes edge if pcurve is directed opposite to 3d curve
//! Check is done by call to the function
//! ShapeAnalysis_Edge::CheckCurve3dWithPCurve()
//! Warning: For seam edge this method will check and fix the pcurve in only
//! one direction. Hence, it should be called twice for seam edge:
//! once with edge orientation FORWARD and once with REVERSED.
//! Returns: False if nothing done, True if reversed (status DONE)
//! Status: OK - pcurve OK, nothing done
//! FAIL1 - no pcurve
//! FAIL2 - no 3d curve
//! DONE1 - pcurve was reversed
Standard_EXPORT Standard_Boolean FixReversed2d (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location);
//! Tries to make edge SameParameter and sets corresponding
//! tolerance and SameParameter flag.
//! First, it makes edge same range if SameRange flag is not set.
//!
//! If flag SameParameter is set, this method calls the
//! function ShapeAnalysis_Edge::CheckSameParameter() that
//! calculates the maximal deviation of pcurves of the edge from
//! its 3d curve. If deviation > tolerance, the tolerance of edge
//! is increased to a value of deviation. If deviation < tolerance
//! nothing happens.
//!
//! If flag SameParameter is not set, this method chooses the best
//! variant (one that has minimal tolerance), either
//! a. only after computing deviation (as above) or
//! b. after calling standard procedure BRepLib::SameParameter
//! and computing deviation (as above). If <tolerance> > 0, it is
//! used as parameter for BRepLib::SameParameter, otherwise,
//! tolerance of the edge is used.
//!
//! Use : Is to be called after all pcurves and 3d curve of the edge are
//! correctly computed
//! Remark : SameParameter flag is always set to True after this method
//! Returns: True, if something done, else False
//! Status : OK - edge was initially SameParameter, nothing is done
//! FAIL1 - computation of deviation of pcurves from 3d curve has failed
//! FAIL2 - BRepLib::SameParameter() has failed
//! DONE1 - tolerance of the edge was increased
//! DONE2 - flag SameParameter was set to True (only if
//! BRepLib::SameParameter() did not set it)
//! DONE3 - edge was modified by BRepLib::SameParameter() to SameParameter
//! DONE4 - not used anymore
//! DONE5 - if the edge resulting from BRepLib has been chosen, i.e. variant b. above
//! (only for edges with not set SameParameter)
Standard_EXPORT Standard_Boolean FixSameParameter (const TopoDS_Edge& edge, const Standard_Real tolerance = 0.0);
//! Returns the status (in the form of True/False) of last Fix
Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
DEFINE_STANDARD_RTTI(ShapeFix_Edge,MMgt_TShared)
protected:
Standard_Integer myStatus;
Handle(ShapeConstruct_ProjectCurveOnSurface) myProjector;
private:
};
#endif // _ShapeFix_Edge_HeaderFile

View File

@@ -1,54 +0,0 @@
-- Created on: 1999-05-11
-- Created by: Sergei ZERTCHANINOV
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class EdgeConnect from ShapeFix
---Purpose : Rebuilds edges to connect with new vertices, was moved from ShapeBuild.
-- Makes vertices to be shared to connect edges,
-- updates positions and tolerances for shared vertices.
-- Accepts edges bounded by two vertices each.
uses
DataMapOfShapeShape from TopTools,
DataMapOfShapeListOfShape from TopTools,
Edge from TopoDS, Shape from TopoDS
is
Create returns EdgeConnect from ShapeFix;
Add (me : in out; aFirst : Edge from TopoDS; aSecond : Edge from TopoDS);
---Purpose : Adds information on connectivity between start vertex
-- of second edge and end vertex of first edge,
-- taking edges orientation into account
Add (me : in out; aShape : Shape from TopoDS);
---Purpose : Adds connectivity information for the whole shape.
-- Note: edges in wires must be well ordered
-- Note: flag Closed should be set for closed wires
Build (me : in out);
---Purpose : Builds shared vertices, updates their positions and tolerances
Clear (me : in out);
---Purpose : Clears internal data structure
fields
myVertices : DataMapOfShapeShape from TopTools; -- Map of pairs (vertex, shared)
myLists : DataMapOfShapeListOfShape from TopTools; -- Map of pairs (shared, list of vertices/edges)
end EdgeConnect;

View File

@@ -14,32 +14,32 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_EdgeConnect.ixx>
#include <BRep_Builder.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
#include <gp_XYZ.hxx>
#include <Precision.hxx>
#include <ShapeFix_EdgeConnect.hxx>
#include <TColgp_SequenceOfXYZ.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <Precision.hxx>
#include <BRep_Builder.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_Tool.hxx>
#include <gp_XYZ.hxx>
#include <gp_Pnt.hxx>
#include <TColgp_SequenceOfXYZ.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
//#define POSITION_USES_MEAN_POINT
//=======================================================================
//function : ShapeFix_EdgeConnect
//=======================================================================
ShapeFix_EdgeConnect::ShapeFix_EdgeConnect () {}
//=======================================================================

View File

@@ -0,0 +1,84 @@
// Created on: 1999-05-11
// Created by: Sergei ZERTCHANINOV
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_EdgeConnect_HeaderFile
#define _ShapeFix_EdgeConnect_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
class TopoDS_Edge;
class TopoDS_Shape;
//! Rebuilds edges to connect with new vertices, was moved from ShapeBuild.
//! Makes vertices to be shared to connect edges,
//! updates positions and tolerances for shared vertices.
//! Accepts edges bounded by two vertices each.
class ShapeFix_EdgeConnect
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT ShapeFix_EdgeConnect();
//! Adds information on connectivity between start vertex
//! of second edge and end vertex of first edge,
//! taking edges orientation into account
Standard_EXPORT void Add (const TopoDS_Edge& aFirst, const TopoDS_Edge& aSecond);
//! Adds connectivity information for the whole shape.
//! Note: edges in wires must be well ordered
//! Note: flag Closed should be set for closed wires
Standard_EXPORT void Add (const TopoDS_Shape& aShape);
//! Builds shared vertices, updates their positions and tolerances
Standard_EXPORT void Build();
//! Clears internal data structure
Standard_EXPORT void Clear();
protected:
private:
TopTools_DataMapOfShapeShape myVertices;
TopTools_DataMapOfShapeListOfShape myLists;
};
#endif // _ShapeFix_EdgeConnect_HeaderFile

View File

@@ -1,65 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class EdgeProjAux from ShapeFix inherits TShared from MMgt
---Purpose: Project 3D point (vertex) on pcurves to find Vertex Parameter
-- on parametric representation of an edge
uses
Curve from Geom2d,
Face from TopoDS,
Edge from TopoDS,
Surface from Geom
is
Create returns EdgeProjAux from ShapeFix;
Create (F: Face from TopoDS; E: Edge from TopoDS)
returns EdgeProjAux from ShapeFix;
Init (me: mutable; F: Face from TopoDS; E: Edge from TopoDS);
Compute (me: mutable; preci: Real);
IsFirstDone (me) returns Boolean from Standard;
IsLastDone (me) returns Boolean from Standard;
FirstParam (me) returns Real from Standard;
LastParam (me) returns Real from Standard;
IsIso (me: mutable; C: Curve from Geom2d) returns Boolean;
Init2d (me: mutable; preci: Real) is protected;
Init3d (me: mutable; preci: Real) is protected;
UpdateParam2d (me: mutable; C: Curve from Geom2d) is protected;
fields
myFace: Face from TopoDS is protected;
myEdge: Edge from TopoDS is protected;
myFirstParam: Real is protected;
myLastParam: Real is protected;
myFirstDone: Boolean is protected;
myLastDone: Boolean is protected;
end EdgeProjAux;

View File

@@ -13,45 +13,41 @@
//:r5 abv 06.04.99: ec_turbine-A.stp, #4313: protect against null curve
// abv 09.04.99 S4136: add parameter preci (to eliminate BRepAPI::Precision)
#include <ShapeFix_EdgeProjAux.ixx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <ElCLib.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <BRep_Tool.hxx>
#include <ElCLib.hxx>
#include <Extrema_ExtPC.hxx>
#include <Geom2d_BoundedCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <Extrema_ExtPC.hxx>
#include <gp_Pnt.hxx>
#include <Geom2d_BoundedCurve.hxx>
#include <ShapeFix_EdgeProjAux.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Type.hxx>
#include <TopExp.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
//=======================================================================
//function : ShapeFix_EdgeProjAux
//purpose :
//=======================================================================
ShapeFix_EdgeProjAux::ShapeFix_EdgeProjAux ()
{
myFirstDone = myLastDone = Standard_False;

View File

@@ -0,0 +1,97 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_EdgeProjAux_HeaderFile
#define _ShapeFix_EdgeProjAux_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <MMgt_TShared.hxx>
class TopoDS_Face;
class TopoDS_Edge;
class Geom2d_Curve;
class ShapeFix_EdgeProjAux;
DEFINE_STANDARD_HANDLE(ShapeFix_EdgeProjAux, MMgt_TShared)
//! Project 3D point (vertex) on pcurves to find Vertex Parameter
//! on parametric representation of an edge
class ShapeFix_EdgeProjAux : public MMgt_TShared
{
public:
Standard_EXPORT ShapeFix_EdgeProjAux();
Standard_EXPORT ShapeFix_EdgeProjAux(const TopoDS_Face& F, const TopoDS_Edge& E);
Standard_EXPORT void Init (const TopoDS_Face& F, const TopoDS_Edge& E);
Standard_EXPORT void Compute (const Standard_Real preci);
Standard_EXPORT Standard_Boolean IsFirstDone() const;
Standard_EXPORT Standard_Boolean IsLastDone() const;
Standard_EXPORT Standard_Real FirstParam() const;
Standard_EXPORT Standard_Real LastParam() const;
Standard_EXPORT Standard_Boolean IsIso (const Handle(Geom2d_Curve)& C);
DEFINE_STANDARD_RTTI(ShapeFix_EdgeProjAux,MMgt_TShared)
protected:
Standard_EXPORT void Init2d (const Standard_Real preci);
Standard_EXPORT void Init3d (const Standard_Real preci);
Standard_EXPORT void UpdateParam2d (const Handle(Geom2d_Curve)& C);
TopoDS_Face myFace;
TopoDS_Edge myEdge;
Standard_Real myFirstParam;
Standard_Real myLastParam;
Standard_Boolean myFirstDone;
Standard_Boolean myLastDone;
private:
};
#endif // _ShapeFix_EdgeProjAux_HeaderFile

View File

@@ -1,295 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Face from ShapeFix inherits Root from ShapeFix
---Purpose: This operator allows to perform various fixes on face
-- and its wires: fixes provided by ShapeFix_Wire,
-- fixing orientation of wires, addition of natural bounds,
-- fixing of missing seam edge,
-- and detection and removal of null-area wires
uses
Surface from Geom,
Shape from TopoDS,
Face from TopoDS,
Wire from TopoDS,
BasicMsgRegistrator from ShapeExtend,
Status from ShapeExtend,
Surface from ShapeAnalysis,
Wire from ShapeFix,
SequenceOfShape from TopTools,
WireData from ShapeExtend,
Vertex from TopoDS,
DataMapOfShapeBox2d from ShapeFix,
DataMapOfShapeListOfShape from TopTools
is
Create returns Face from ShapeFix;
---Purpose: Creates an empty tool
Create (face: Face from TopoDS) returns Face from ShapeFix;
---Purpose: Creates a tool and loads a face
ClearModes (me: mutable) is virtual;
---Purpose: Sets all modes to default
Init (me: mutable; face: Face from TopoDS);
---Purpose: Loads a whole face already created, with its wires, sense and
-- location
Init (me: mutable; surf: Surface from Geom; preci: Real;
fwd: Boolean = Standard_True);
---Purpose: Starts the creation of the face
-- By default it will be FORWARD, or REVERSED if <fwd> is False
Init (me: mutable; surf: Surface from ShapeAnalysis; preci: Real;
fwd: Boolean = Standard_True);
---Purpose: Starts the creation of the face
-- By default it will be FORWARD, or REVERSED if <fwd> is False
SetMsgRegistrator (me: mutable; msgreg: BasicMsgRegistrator from ShapeExtend) is redefined;
---Purpose: Sets message registrator
SetPrecision (me: mutable; preci: Real) is redefined;
---Purpose: Sets basic precision value (also to FixWireTool)
SetMinTolerance (me: mutable; mintol: Real) is redefined;
---Purpose: Sets minimal allowed tolerance (also to FixWireTool)
SetMaxTolerance (me: mutable; maxtol: Real) is redefined;
---Purpose: Sets maximal allowed tolerance (also to FixWireTool)
FixWireMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying fixes of
-- ShapeFix_Wire, by default True.
FixOrientationMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the fix orientation mode, by default
-- True. If True, wires oriented to border limited square.
FixAddNaturalBoundMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the add natural bound mode.
-- If true, natural boundary is added on faces that miss them.
-- Default is False for faces with single wire (they are
-- handled by FixOrientation in that case) and True for others.
FixMissingSeamMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the fix missing seam mode, by default
-- True. If True, tries to insert seam is missed.
FixSmallAreaWireMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the fix small area wire mode, by default
-- False. If True, drops small wires.
RemoveSmallAreaFaceMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the remove face with small area, by default
-- False. If True, drops faces with small outer wires.
FixIntersectingWiresMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the fix intersecting wires mode
-- by default True.
FixLoopWiresMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the fix loop wires mode
-- by default True.
FixSplitFaceMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the fix split face mode
-- by default True.
AutoCorrectPrecisionMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the auto-correct precision mode
-- by default False.
FixPeriodicDegeneratedMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the activation flag for periodic
-- degenerated fix. False by default.
Face (me) returns Face from TopoDS;
---C++: inline
---Purpose: Returns a face which corresponds to the current state
-- Warning: The finally produced face may be another one ... but with the
-- same support
Result (me) returns Shape from TopoDS;
---C++: inline
---Purpose: Returns resulting shape (Face or Shell if splitted)
-- To be used instead of Face() if FixMissingSeam involved
Add (me: mutable; wire: Wire from TopoDS);
---Purpose: Add a wire to current face using BRep_Builder.
-- Wire is added without taking into account orientation of face
-- (as if face were FORWARD).
---Warning: Method is retained for compatibility with previous versions.
Perform (me: mutable) returns Boolean;
---Purpose: Performs all the fixes, depending on modes
-- Function Status returns the status of last call to Perform()
-- ShapeExtend_OK : face was OK, nothing done
-- ShapeExtend_DONE1: some wires are fixed
-- ShapeExtend_DONE2: orientation of wires fixed
-- ShapeExtend_DONE3: missing seam added
-- ShapeExtend_DONE4: small area wire removed
-- ShapeExtend_DONE5: natural bounds added
-- ShapeExtend_FAIL1: some fails during fixing wires
-- ShapeExtend_FAIL2: cannot fix orientation of wires
-- ShapeExtend_FAIL3: cannot add missing seam
-- ShapeExtend_FAIL4: cannot remove small area wire
FixOrientation (me: mutable) returns Boolean;
---Purpose: Fixes orientation of wires on the face
-- It tries to make all wires lie outside all others (according
-- to orientation) by reversing orientation of some of them.
-- If face lying on sphere or torus has single wire and
-- AddNaturalBoundMode is True, that wire is not reversed in
-- any case (supposing that natural bound will be added).
-- Returns True if wires were reversed
FixOrientation (me: mutable; MapWires : in out DataMapOfShapeListOfShape from TopTools)
returns Boolean;
---Purpose: Fixes orientation of wires on the face
-- It tries to make all wires lie outside all others (according
-- to orientation) by reversing orientation of some of them.
-- If face lying on sphere or torus has single wire and
-- AddNaturalBoundMode is True, that wire is not reversed in
-- any case (supposing that natural bound will be added).
-- Returns True if wires were reversed
-- OutWires return information about out wires + list of
-- internal wires for each (for performing split face).
FixAddNaturalBound(me: mutable) returns Boolean;
---Purpose: Adds natural boundary on face if it is missing.
-- Two cases are supported:
-- - face has no wires
-- - face lies on geometrically double-closed surface
-- (sphere or torus) and none of wires is left-oriented
-- Returns True if natural boundary was added
FixMissingSeam (me: mutable) returns Boolean;
---Purpose: Detects and fixes the special case when face on a closed
-- surface is given by two wires closed in 3d but with gap in 2d.
-- In that case it creates a new wire from the two, and adds a
-- missing seam edge
-- Returns True if missing seam was added
FixSmallAreaWire (me: mutable; theIsRemoveSmallFace: Boolean) returns Boolean;
---Purpose: Detects wires with small area (that is less than
-- 100*Precision::PConfusion(). Removes these wires if they are internal.
-- Returns : True if at least one small wire removed,
-- False if does nothing.
FixLoopWire(me: mutable; aResWires : out SequenceOfShape from TopTools) returns Boolean;
---Purpose: Detects if wire has a loop and fixes this situation by splitting on the few parts.
-- if wire has a loops and it was splitted Status was set to value ShapeExtend_DONE6.
SplitEdge (me: mutable; sewd: WireData from ShapeExtend; num: Integer from Standard;
param: Real from Standard; vert: Vertex from TopoDS;
preci: Real from Standard; boxes: in out DataMapOfShapeBox2d from ShapeFix)
returns Boolean from Standard is private;
SplitEdge (me: mutable; sewd: WireData from ShapeExtend; num: Integer from Standard;
param1: Real from Standard; param2: Real from Standard;
vert: Vertex from TopoDS; preci: Real from Standard;
boxes: in out DataMapOfShapeBox2d from ShapeFix)
returns Boolean from Standard is private;
FixIntersectingWires (me: mutable) returns Boolean;
---Purpose: Detects and fixes the special case when face has more than one wire
-- and this wires have intersection point
FixWiresTwoCoincEdges (me: mutable) returns Boolean;
---Purpose: If wire contains two coincidence edges it must be removed
-- Queries on status after Perform()
FixSplitFace (me: mutable; MapWires : DataMapOfShapeListOfShape from TopTools)
returns Boolean;
---Purpose: Split face if there are more than one out wire
-- using inrormation after FixOrientation()
FixPeriodicDegenerated (me: mutable)
returns Boolean;
---Purpose: Fixes topology for a specific case when face is composed
-- by a single wire belting a periodic surface. In that case
-- a degenerated edge is reconstructed in the degenerated pole
-- of the surface. Initial wire gets consistent orientation.
-- Must be used in couple and before FixMissingSeam routine
Status (me; status: Status from ShapeExtend) returns Boolean;
---Purpose: Returns the status of last call to Perform()
-- ShapeExtend_OK : face was OK, nothing done
-- ShapeExtend_DONE1: some wires are fixed
-- ShapeExtend_DONE2: orientation of wires fixed
-- ShapeExtend_DONE3: missing seam added
-- ShapeExtend_DONE4: small area wire removed
-- ShapeExtend_DONE5: natural bounds added
-- ShapeExtend_DONE8: face may be splited
-- ShapeExtend_FAIL1: some fails during fixing wires
-- ShapeExtend_FAIL2: cannot fix orientation of wires
-- ShapeExtend_FAIL3: cannot add missing seam
-- ShapeExtend_FAIL4: cannot remove small area wire
---C++: inline
FixWireTool (me: mutable) returns Wire from ShapeFix;
---Purpose: Returns tool for fixing wires.
---C++: inline
fields
mySurf : Surface from ShapeAnalysis is protected;
myFace : Face from TopoDS is protected;
myResult : Shape from TopoDS is protected; -- result (shell or face)
myFixWire: Wire from ShapeFix is protected;
myFwd : Boolean is protected;
myFixWireMode : Integer;
myFixOrientationMode : Integer;
myFixAddNaturalBoundMode : Integer;
myFixMissingSeamMode : Integer;
myFixSmallAreaWireMode : Integer;
myRemoveSmallAreaFaceMode : Integer;
myFixLoopWiresMode : Integer; -- gka 08.01.2004
myFixIntersectingWiresMode : Integer; -- skl 23.12.2003
myFixSplitFaceMode : Integer; -- skl 03.02.2004
myAutoCorrectPrecisionMode : Integer; -- skl 26.03.2010
myFixPeriodicDegenerated : Integer; -- ssv 29.09.2011
myStatus : Integer is protected;
end Face;

View File

@@ -28,85 +28,78 @@
// abv 19.10.2001 FixAddNaturalBound improved and extracted as separate fix
// skl,pdn 14.05.2002 OCC55 (correction precision for small faces)
#include <ShapeFix_Face.ixx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Precision.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_BSplineSurface.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GProp_GProps.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <BRepGProp.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_Box.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <BRep_Builder.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <Message_Msg.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <Bnd_Box2d.hxx>
#include <Geom_Circle.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeExtend_CompositeSurface.hxx>
#include <ShapeFix_ComposeShell.hxx>
#include <TColGeom_HArray2OfSurface.hxx>
#include <ShapeBuild_Edge.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <Bnd_Box.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopExp.hxx>
#include <ShapeFix.hxx>
#include <ShapeFix_DataMapOfShapeBox2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <BRepGProp.hxx>
#include <BRepTools.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <IntRes2d_Domain.hxx>
#include <Geom2dInt_GInter.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_Circle.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GProp_GProps.hxx>
#include <IntRes2d_Domain.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_Transition.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <IntRes2d_IntersectionSegment.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <IntRes2d_Transition.hxx>
#include <Message_Msg.hxx>
#include <NCollection_Array1.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend_BasicMsgRegistrator.hxx>
#include <ShapeExtend_CompositeSurface.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix.hxx>
#include <ShapeFix_ComposeShell.hxx>
#include <ShapeFix_DataMapOfShapeBox2d.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_IntersectionTool.hxx>
#include <ShapeFix_SplitTool.hxx>
#include <ShapeFix_Wire.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Type.hxx>
#include <TColGeom_HArray2OfSurface.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <NCollection_Array1.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#ifdef OCCT_DEBUG
#define DEBUG

View File

@@ -0,0 +1,290 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_Face_HeaderFile
#define _ShapeFix_Face_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <ShapeFix_Root.hxx>
#include <Standard_Real.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <ShapeFix_DataMapOfShapeBox2d.hxx>
#include <ShapeExtend_Status.hxx>
class ShapeAnalysis_Surface;
class ShapeFix_Wire;
class TopoDS_Face;
class Geom_Surface;
class ShapeExtend_BasicMsgRegistrator;
class TopoDS_Wire;
class ShapeExtend_WireData;
class TopoDS_Vertex;
class ShapeFix_Face;
DEFINE_STANDARD_HANDLE(ShapeFix_Face, ShapeFix_Root)
//! This operator allows to perform various fixes on face
//! and its wires: fixes provided by ShapeFix_Wire,
//! fixing orientation of wires, addition of natural bounds,
//! fixing of missing seam edge,
//! and detection and removal of null-area wires
class ShapeFix_Face : public ShapeFix_Root
{
public:
//! Creates an empty tool
Standard_EXPORT ShapeFix_Face();
//! Creates a tool and loads a face
Standard_EXPORT ShapeFix_Face(const TopoDS_Face& face);
//! Sets all modes to default
Standard_EXPORT virtual void ClearModes();
//! Loads a whole face already created, with its wires, sense and
//! location
Standard_EXPORT void Init (const TopoDS_Face& face);
//! Starts the creation of the face
//! By default it will be FORWARD, or REVERSED if <fwd> is False
Standard_EXPORT void Init (const Handle(Geom_Surface)& surf, const Standard_Real preci, const Standard_Boolean fwd = Standard_True);
//! Starts the creation of the face
//! By default it will be FORWARD, or REVERSED if <fwd> is False
Standard_EXPORT void Init (const Handle(ShapeAnalysis_Surface)& surf, const Standard_Real preci, const Standard_Boolean fwd = Standard_True);
//! Sets message registrator
Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE;
//! Sets basic precision value (also to FixWireTool)
Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE;
//! Sets minimal allowed tolerance (also to FixWireTool)
Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE;
//! Sets maximal allowed tolerance (also to FixWireTool)
Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE;
//! Returns (modifiable) the mode for applying fixes of
//! ShapeFix_Wire, by default True.
Standard_Integer& FixWireMode();
//! Returns (modifiable) the fix orientation mode, by default
//! True. If True, wires oriented to border limited square.
Standard_Integer& FixOrientationMode();
//! Returns (modifiable) the add natural bound mode.
//! If true, natural boundary is added on faces that miss them.
//! Default is False for faces with single wire (they are
//! handled by FixOrientation in that case) and True for others.
Standard_Integer& FixAddNaturalBoundMode();
//! Returns (modifiable) the fix missing seam mode, by default
//! True. If True, tries to insert seam is missed.
Standard_Integer& FixMissingSeamMode();
//! Returns (modifiable) the fix small area wire mode, by default
//! False. If True, drops small wires.
Standard_Integer& FixSmallAreaWireMode();
//! Returns (modifiable) the remove face with small area, by default
//! False. If True, drops faces with small outer wires.
Standard_Integer& RemoveSmallAreaFaceMode();
//! Returns (modifiable) the fix intersecting wires mode
//! by default True.
Standard_Integer& FixIntersectingWiresMode();
//! Returns (modifiable) the fix loop wires mode
//! by default True.
Standard_Integer& FixLoopWiresMode();
//! Returns (modifiable) the fix split face mode
//! by default True.
Standard_Integer& FixSplitFaceMode();
//! Returns (modifiable) the auto-correct precision mode
//! by default False.
Standard_Integer& AutoCorrectPrecisionMode();
//! Returns (modifiable) the activation flag for periodic
//! degenerated fix. False by default.
Standard_Integer& FixPeriodicDegeneratedMode();
//! Returns a face which corresponds to the current state
//! Warning: The finally produced face may be another one ... but with the
//! same support
TopoDS_Face Face() const;
//! Returns resulting shape (Face or Shell if splitted)
//! To be used instead of Face() if FixMissingSeam involved
TopoDS_Shape Result() const;
//! Add a wire to current face using BRep_Builder.
//! Wire is added without taking into account orientation of face
//! (as if face were FORWARD).
Standard_EXPORT void Add (const TopoDS_Wire& wire);
//! Performs all the fixes, depending on modes
//! Function Status returns the status of last call to Perform()
//! ShapeExtend_OK : face was OK, nothing done
//! ShapeExtend_DONE1: some wires are fixed
//! ShapeExtend_DONE2: orientation of wires fixed
//! ShapeExtend_DONE3: missing seam added
//! ShapeExtend_DONE4: small area wire removed
//! ShapeExtend_DONE5: natural bounds added
//! ShapeExtend_FAIL1: some fails during fixing wires
//! ShapeExtend_FAIL2: cannot fix orientation of wires
//! ShapeExtend_FAIL3: cannot add missing seam
//! ShapeExtend_FAIL4: cannot remove small area wire
Standard_EXPORT Standard_Boolean Perform();
//! Fixes orientation of wires on the face
//! It tries to make all wires lie outside all others (according
//! to orientation) by reversing orientation of some of them.
//! If face lying on sphere or torus has single wire and
//! AddNaturalBoundMode is True, that wire is not reversed in
//! any case (supposing that natural bound will be added).
//! Returns True if wires were reversed
Standard_EXPORT Standard_Boolean FixOrientation();
//! Fixes orientation of wires on the face
//! It tries to make all wires lie outside all others (according
//! to orientation) by reversing orientation of some of them.
//! If face lying on sphere or torus has single wire and
//! AddNaturalBoundMode is True, that wire is not reversed in
//! any case (supposing that natural bound will be added).
//! Returns True if wires were reversed
//! OutWires return information about out wires + list of
//! internal wires for each (for performing split face).
Standard_EXPORT Standard_Boolean FixOrientation (TopTools_DataMapOfShapeListOfShape& MapWires);
//! Adds natural boundary on face if it is missing.
//! Two cases are supported:
//! - face has no wires
//! - face lies on geometrically double-closed surface
//! (sphere or torus) and none of wires is left-oriented
//! Returns True if natural boundary was added
Standard_EXPORT Standard_Boolean FixAddNaturalBound();
//! Detects and fixes the special case when face on a closed
//! surface is given by two wires closed in 3d but with gap in 2d.
//! In that case it creates a new wire from the two, and adds a
//! missing seam edge
//! Returns True if missing seam was added
Standard_EXPORT Standard_Boolean FixMissingSeam();
//! Detects wires with small area (that is less than
//! 100*Precision::PConfusion(). Removes these wires if they are internal.
//! Returns : True if at least one small wire removed,
//! False if does nothing.
Standard_EXPORT Standard_Boolean FixSmallAreaWire (const Standard_Boolean theIsRemoveSmallFace);
//! Detects if wire has a loop and fixes this situation by splitting on the few parts.
//! if wire has a loops and it was splitted Status was set to value ShapeExtend_DONE6.
Standard_EXPORT Standard_Boolean FixLoopWire (TopTools_SequenceOfShape& aResWires);
//! Detects and fixes the special case when face has more than one wire
//! and this wires have intersection point
Standard_EXPORT Standard_Boolean FixIntersectingWires();
//! If wire contains two coincidence edges it must be removed
//! Queries on status after Perform()
Standard_EXPORT Standard_Boolean FixWiresTwoCoincEdges();
//! Split face if there are more than one out wire
//! using inrormation after FixOrientation()
Standard_EXPORT Standard_Boolean FixSplitFace (const TopTools_DataMapOfShapeListOfShape& MapWires);
//! Fixes topology for a specific case when face is composed
//! by a single wire belting a periodic surface. In that case
//! a degenerated edge is reconstructed in the degenerated pole
//! of the surface. Initial wire gets consistent orientation.
//! Must be used in couple and before FixMissingSeam routine
Standard_EXPORT Standard_Boolean FixPeriodicDegenerated();
//! Returns the status of last call to Perform()
//! ShapeExtend_OK : face was OK, nothing done
//! ShapeExtend_DONE1: some wires are fixed
//! ShapeExtend_DONE2: orientation of wires fixed
//! ShapeExtend_DONE3: missing seam added
//! ShapeExtend_DONE4: small area wire removed
//! ShapeExtend_DONE5: natural bounds added
//! ShapeExtend_DONE8: face may be splited
//! ShapeExtend_FAIL1: some fails during fixing wires
//! ShapeExtend_FAIL2: cannot fix orientation of wires
//! ShapeExtend_FAIL3: cannot add missing seam
//! ShapeExtend_FAIL4: cannot remove small area wire
Standard_Boolean Status (const ShapeExtend_Status status) const;
//! Returns tool for fixing wires.
Handle(ShapeFix_Wire) FixWireTool();
DEFINE_STANDARD_RTTI(ShapeFix_Face,ShapeFix_Root)
protected:
Handle(ShapeAnalysis_Surface) mySurf;
TopoDS_Face myFace;
TopoDS_Shape myResult;
Handle(ShapeFix_Wire) myFixWire;
Standard_Boolean myFwd;
Standard_Integer myStatus;
private:
Standard_EXPORT Standard_Boolean SplitEdge (const Handle(ShapeExtend_WireData)& sewd, const Standard_Integer num, const Standard_Real param, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes);
Standard_EXPORT Standard_Boolean SplitEdge (const Handle(ShapeExtend_WireData)& sewd, const Standard_Integer num, const Standard_Real param1, const Standard_Real param2, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes);
Standard_Integer myFixWireMode;
Standard_Integer myFixOrientationMode;
Standard_Integer myFixAddNaturalBoundMode;
Standard_Integer myFixMissingSeamMode;
Standard_Integer myFixSmallAreaWireMode;
Standard_Integer myRemoveSmallAreaFaceMode;
Standard_Integer myFixLoopWiresMode;
Standard_Integer myFixIntersectingWiresMode;
Standard_Integer myFixSplitFaceMode;
Standard_Integer myAutoCorrectPrecisionMode;
Standard_Integer myFixPeriodicDegenerated;
};
#include <ShapeFix_Face.lxx>
#endif // _ShapeFix_Face_HeaderFile

View File

@@ -1,52 +0,0 @@
-- Created on: 1999-06-18
-- Created by: Sergei ZERTCHANINOV
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class FaceConnect from ShapeFix
---Purpose : Rebuilds connectivity between faces in shell
uses
DataMapOfShapeListOfShape from TopTools,
Face from TopoDS, Shell from TopoDS
is
Create returns FaceConnect from ShapeFix;
Add (me : in out; aFirst : Face from TopoDS; aSecond : Face from TopoDS)
returns Boolean from Standard;
---Purpose :
Build (me : in out; shell : Shell from TopoDS;
sewtoler : Real from Standard; fixtoler : Real from Standard)
returns Shell from TopoDS;
---Purpose :
Clear (me : in out);
---Purpose : Clears internal data structure
fields
myConnected : DataMapOfShapeListOfShape from TopTools;
-- Map of pairs (face, list of connected faces) - to store connectivity info
myOriFreeEdges : DataMapOfShapeListOfShape from TopTools;
-- Map of pairs (face, list of original free edges)
myResFreeEdges : DataMapOfShapeListOfShape from TopTools;
-- Map of pairs (free edge, list of result free edges)
myResSharEdges : DataMapOfShapeListOfShape from TopTools;
-- Map of pairs (free edge, list of result shared edges)
end FaceConnect;

View File

@@ -14,36 +14,35 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_FaceConnect.ixx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_Sewing.hxx>
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <Geom2d_Curve.hxx>
#include <gp_Pnt.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <Geom2d_Curve.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_FaceConnect.hxx>
#include <ShapeFix_Wire.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#ifdef OCCT_DEBUG
#include <TopTools_MapOfShape.hxx>
#endif

View File

@@ -0,0 +1,75 @@
// Created on: 1999-06-18
// Created by: Sergei ZERTCHANINOV
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_FaceConnect_HeaderFile
#define _ShapeFix_FaceConnect_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
class TopoDS_Face;
class TopoDS_Shell;
//! Rebuilds connectivity between faces in shell
class ShapeFix_FaceConnect
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT ShapeFix_FaceConnect();
Standard_EXPORT Standard_Boolean Add (const TopoDS_Face& aFirst, const TopoDS_Face& aSecond);
Standard_EXPORT TopoDS_Shell Build (const TopoDS_Shell& shell, const Standard_Real sewtoler, const Standard_Real fixtoler);
//! Clears internal data structure
Standard_EXPORT void Clear();
protected:
private:
TopTools_DataMapOfShapeListOfShape myConnected;
TopTools_DataMapOfShapeListOfShape myOriFreeEdges;
TopTools_DataMapOfShapeListOfShape myResFreeEdges;
TopTools_DataMapOfShapeListOfShape myResSharEdges;
};
#endif // _ShapeFix_FaceConnect_HeaderFile

View File

@@ -1,89 +0,0 @@
-- Created on: 1999-09-13
-- Created by: data exchange team
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class FixSmallFace from ShapeFix inherits Root from ShapeFix
---Purpose: Fixing face with small size
uses
Shape from TopoDS,
Face from TopoDS,
Edge from TopoDS,
Compound from TopoDS,
CheckSmallFace from ShapeAnalysis
is
Create returns FixSmallFace;
---Purpose :
Init(me: mutable; S : Shape from TopoDS);
---Purpose :
Perform(me:mutable);
---Purpose :
-- Fixing case of spot face
FixSpotFace (me: mutable) returns Shape from TopoDS;
---Purpose : Fixing case of spot face, if tol = -1 used local tolerance.
ReplaceVerticesInCaseOfSpot(me; F : in out Face from TopoDS; tol : Real) returns Boolean;
---Purpose : Compute average vertex and replacing vertices by new one.
RemoveFacesInCaseOfSpot(me; F : Face from TopoDS) returns Boolean;
---Purpose : Remove spot face from compound
--
-- Fixing case of strip face
FixStripFace(me: mutable; wasdone: Boolean = Standard_False) returns Shape from TopoDS;
---Purpose : Fixing case of strip face, if tol = -1 used local tolerance
ReplaceInCaseOfStrip(me;F : in out Face from TopoDS; E1 : in out Edge from TopoDS; E2 : in out Edge from TopoDS;tol : Real) returns Boolean;
---Purpose : Replace veretces and edges.
--
RemoveFacesInCaseOfStrip(me; F : Face from TopoDS) returns Boolean;
---Purpose : Remove strip face from compound.
ComputeSharedEdgeForStripFace(me; F : Face from TopoDS; E1 : Edge from TopoDS; E2 : Edge from TopoDS;
F1 : Face from TopoDS; tol : Real )
returns Edge from TopoDS;
---Purpose : Compute average edge for strip face
-- Fixing case split
FixSplitFace(me: mutable; S: Shape from TopoDS) returns Shape from TopoDS;
---Purpose :
--
SplitOneFace(me: mutable; F : in out Face from TopoDS;theSplittedFaces: in out Compound from TopoDS) returns Boolean;
---Purpose : Compute data for face splitting.
--
--Fixes after removing
FixFace(me: mutable; F: Face from TopoDS) returns Face from TopoDS;
FixShape(me: mutable) returns Shape from TopoDS;
Shape(me : mutable) returns Shape from TopoDS;
FixPinFace (me: mutable;F : in out Face from TopoDS) returns Boolean;
fields
myShape : Shape from TopoDS;
myResult : Shape from TopoDS;
myStatus : Integer; -- error status
myAnalyzer : CheckSmallFace from ShapeAnalysis;
end FixSmallFace;

View File

@@ -11,64 +11,58 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_FixSmallFace.ixx>
#include <TopoDS.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_BezierSurface.hxx>
#include <ShapeAnalysis_Curve.hxx>
//#include <GeomLProp_SLProps.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Geom_ElementarySurface.hxx>
//#include <TColStd_Array2OfReal.hxx>
#include <gp_Dir.hxx>
#include <gp_Vec.hxx>
//#include <TColStd_Array1OfReal.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColgp_SequenceOfXYZ.hxx>
#include <BRep_Builder.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <BRepTools.hxx>
#include <ShapeFix_Edge.hxx>
#include <Precision.hxx>
#include <TopoDS_Wire.hxx>
#include <ShapeFix_Wire.hxx>
#include <Geom_Line.hxx>
#include <TopExp.hxx>
#include <ElCLib.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <Poly_Polygon3D.hxx>
#include <Geom2d_Curve.hxx>
#include <BRep_Tool.hxx>
#include <BRepLib.hxx>
#include <GeomLib.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_Wire.hxx>
#include <BRepTools.hxx>
#include <ElCLib.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_ElementarySurface.hxx>
#include <Geom_Line.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <ShapeFix_Shape.hxx>
#include <Precision.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <ShapeAnalysis_DataMapOfShapeListOfReal.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomLib.hxx>
#include <gp_Dir.hxx>
#include <gp_Vec.hxx>
#include <Message_Msg.hxx>
#include <Poly_Polygon3D.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_DataMapOfShapeListOfReal.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_FixSmallFace.hxx>
#include <ShapeFix_Shape.hxx>
#include <ShapeFix_Wire.hxx>
#include <Standard_Type.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColgp_SequenceOfXYZ.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
//#include <GeomLProp_SLProps.hxx>
//#include <TColStd_Array2OfReal.hxx>
//#include <TColStd_Array1OfReal.hxx>
ShapeFix_FixSmallFace::ShapeFix_FixSmallFace()
{
myStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK );

View File

@@ -0,0 +1,114 @@
// Created on: 1999-09-13
// Created by: data exchange team
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_FixSmallFace_HeaderFile
#define _ShapeFix_FixSmallFace_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Integer.hxx>
#include <ShapeAnalysis_CheckSmallFace.hxx>
#include <ShapeFix_Root.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
class TopoDS_Shape;
class TopoDS_Face;
class TopoDS_Edge;
class TopoDS_Compound;
class ShapeFix_FixSmallFace;
DEFINE_STANDARD_HANDLE(ShapeFix_FixSmallFace, ShapeFix_Root)
//! Fixing face with small size
class ShapeFix_FixSmallFace : public ShapeFix_Root
{
public:
Standard_EXPORT ShapeFix_FixSmallFace();
Standard_EXPORT void Init (const TopoDS_Shape& S);
//! Fixing case of spot face
Standard_EXPORT void Perform();
//! Fixing case of spot face, if tol = -1 used local tolerance.
Standard_EXPORT TopoDS_Shape FixSpotFace();
//! Compute average vertex and replacing vertices by new one.
Standard_EXPORT Standard_Boolean ReplaceVerticesInCaseOfSpot (TopoDS_Face& F, const Standard_Real tol) const;
//! Remove spot face from compound
Standard_EXPORT Standard_Boolean RemoveFacesInCaseOfSpot (const TopoDS_Face& F) const;
//! Fixing case of strip face, if tol = -1 used local tolerance
Standard_EXPORT TopoDS_Shape FixStripFace (const Standard_Boolean wasdone = Standard_False);
//! Replace veretces and edges.
Standard_EXPORT Standard_Boolean ReplaceInCaseOfStrip (TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol) const;
//! Remove strip face from compound.
Standard_EXPORT Standard_Boolean RemoveFacesInCaseOfStrip (const TopoDS_Face& F) const;
//! Compute average edge for strip face
Standard_EXPORT TopoDS_Edge ComputeSharedEdgeForStripFace (const TopoDS_Face& F, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Face& F1, const Standard_Real tol) const;
Standard_EXPORT TopoDS_Shape FixSplitFace (const TopoDS_Shape& S);
//! Compute data for face splitting.
Standard_EXPORT Standard_Boolean SplitOneFace (TopoDS_Face& F, TopoDS_Compound& theSplittedFaces);
Standard_EXPORT TopoDS_Face FixFace (const TopoDS_Face& F);
Standard_EXPORT TopoDS_Shape FixShape();
Standard_EXPORT TopoDS_Shape Shape();
Standard_EXPORT Standard_Boolean FixPinFace (TopoDS_Face& F);
DEFINE_STANDARD_RTTI(ShapeFix_FixSmallFace,ShapeFix_Root)
protected:
private:
TopoDS_Shape myShape;
TopoDS_Shape myResult;
Standard_Integer myStatus;
ShapeAnalysis_CheckSmallFace myAnalyzer;
};
#endif // _ShapeFix_FixSmallFace_HeaderFile

View File

@@ -1,62 +0,0 @@
-- Created on: 2014-11-13
-- Created by: Maxim YAKUNIN
-- Copyright (c) 2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class FixSmallSolid from ShapeFix inherits Root from ShapeFix
---Purpose: Fixing solids with small size
uses
Shape from TopoDS,
ReShape from ShapeBuild
is
Create returns FixSmallSolid;
---Purpose: Construct
SetFixMode (me: mutable; theMode: Integer);
---Purpose: Set working mode for operator:
-- - theMode = 0 use both WidthFactorThreshold and VolumeThreshold parameters
-- - theMode = 1 use only WidthFactorThreshold parameter
-- - theMode = 2 use only VolumeThreshold parameter
SetVolumeThreshold (me: mutable; theThreshold: Real = -1.0);
---Purpose: Set or clear volume threshold for small solids
SetWidthFactorThreshold (me: mutable; theThreshold: Real = -1.0);
---Purpose: Set or clear width factor threshold for small solids
Remove(me; theShape: Shape from TopoDS; theContext: ReShape from ShapeBuild)
returns Shape from TopoDS;
---Purpose: Remove small solids from the given shape
Merge (me; theShape: Shape from TopoDS; theContext: ReShape from ShapeBuild)
returns Shape from TopoDS;
---Purpose: Merge small solids in the given shape to adjacent non-small ones
IsThresholdsSet (me) returns Boolean is private;
IsSmall (me; theSolid: Shape from TopoDS) returns Boolean is private;
IsUsedWidthFactorThreshold (me) returns Boolean is private;
IsUsedVolumeThreshold (me) returns Boolean is private;
fields
myFixMode : Integer;
myVolumeThreshold : Real;
myWidthFactorThreshold : Real;
end FixSmallSolid;

View File

@@ -11,29 +11,28 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_FixSmallSolid.ixx>
#include <BRep_Builder.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <Message_Msg.hxx>
#include <Precision.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeFix_FixSmallSolid.hxx>
#include <Standard_Type.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeReal.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <GProp_GProps.hxx>
#include <BRepGProp.hxx>
#include <BRep_Builder.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <Message_Msg.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//=======================================================================
//function : ShapeFix_FixSmallSolid

View File

@@ -0,0 +1,95 @@
// Created on: 2014-11-13
// Created by: Maxim YAKUNIN
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_FixSmallSolid_HeaderFile
#define _ShapeFix_FixSmallSolid_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <ShapeFix_Root.hxx>
#include <Standard_Boolean.hxx>
class TopoDS_Shape;
class ShapeBuild_ReShape;
class ShapeFix_FixSmallSolid;
DEFINE_STANDARD_HANDLE(ShapeFix_FixSmallSolid, ShapeFix_Root)
//! Fixing solids with small size
class ShapeFix_FixSmallSolid : public ShapeFix_Root
{
public:
//! Construct
Standard_EXPORT ShapeFix_FixSmallSolid();
//! Set working mode for operator:
//! - theMode = 0 use both WidthFactorThreshold and VolumeThreshold parameters
//! - theMode = 1 use only WidthFactorThreshold parameter
//! - theMode = 2 use only VolumeThreshold parameter
Standard_EXPORT void SetFixMode (const Standard_Integer theMode);
//! Set or clear volume threshold for small solids
Standard_EXPORT void SetVolumeThreshold (const Standard_Real theThreshold = -1.0);
//! Set or clear width factor threshold for small solids
Standard_EXPORT void SetWidthFactorThreshold (const Standard_Real theThreshold = -1.0);
//! Remove small solids from the given shape
Standard_EXPORT TopoDS_Shape Remove (const TopoDS_Shape& theShape, const Handle(ShapeBuild_ReShape)& theContext) const;
//! Merge small solids in the given shape to adjacent non-small ones
Standard_EXPORT TopoDS_Shape Merge (const TopoDS_Shape& theShape, const Handle(ShapeBuild_ReShape)& theContext) const;
DEFINE_STANDARD_RTTI(ShapeFix_FixSmallSolid,ShapeFix_Root)
protected:
private:
Standard_EXPORT Standard_Boolean IsThresholdsSet() const;
Standard_EXPORT Standard_Boolean IsSmall (const TopoDS_Shape& theSolid) const;
Standard_EXPORT Standard_Boolean IsUsedWidthFactorThreshold() const;
Standard_EXPORT Standard_Boolean IsUsedVolumeThreshold() const;
Standard_Integer myFixMode;
Standard_Real myVolumeThreshold;
Standard_Real myWidthFactorThreshold;
};
#endif // _ShapeFix_FixSmallSolid_HeaderFile

View File

@@ -1,109 +0,0 @@
-- Created on: 1998-09-16
-- Created by: Roman LYGIN <rln@nnov.matra-dtv.fr>
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- Pavel DURANDIN <pdn@nnov.matra-dtv.fr>
class FreeBounds from ShapeFix
---Purpose: This class is intended to output free bounds of the shape
-- (free bounds are the wires consisting of edges referenced by the
-- only face).
-- For building free bounds it uses ShapeAnalysis_FreeBounds class.
-- This class complements it with the feature to reduce the number
-- of open wires.
-- This reduction is performed with help of connecting several
-- adjacent open wires one to another what can lead to:
-- 1. making an open wire with greater length out of several
-- open wires
-- 2. making closed wire out of several open wires
--
-- The connecting open wires is performed with a user-given
-- tolerance.
--
-- When connecting several open wires into one wire their previous
-- end vertices are replaced with new connecting vertices. After
-- that all the edges in the shape sharing previous vertices inside
-- the shape are updated with new vertices. Thus source shape can
-- be modified.
--
-- Since interface of this class is the same as one of
-- ShapeAnalysis_FreeBounds refer to its CDL for details.
uses
Shape from TopoDS,
Compound from TopoDS
is
Create returns FreeBounds from ShapeFix;
---Purpose: Empty constructor
Create (shape : Shape from TopoDS;
sewtoler : Real;
closetoler : Real;
splitclosed: Boolean;
splitopen : Boolean)
returns FreeBounds from ShapeFix;
---Purpose: Builds forecasting free bounds of the <shape> and connects
-- open wires with tolerance <closetoler>.
-- <shape> should be a compound of faces.
-- Tolerance <closetoler> should be greater than tolerance
-- <sewtoler> used for initializing sewing analyzer, otherwise
-- connection of open wires is not performed.
Create (shape : Shape from TopoDS;
closetoler : Real;
splitclosed: Boolean;
splitopen : Boolean)
returns FreeBounds from ShapeFix;
---Purpose: Builds actual free bounds of the <shape> and connects
-- open wires with tolerance <closetoler>.
-- <shape> should be a compound of shells.
GetClosedWires (me) returns Compound from TopoDS;
---Purpose: Returns compound of closed wires out of free edges.
---C++: inline
---C++: return const &
GetOpenWires (me) returns Compound from TopoDS;
---Purpose: Returns compound of open wires out of free edges.
---C++: inline
---C++: return const &
GetShape (me) returns Shape from TopoDS;
---Purpose: Returns modified source shape.
---C++: inline
---C++: return const &
---Level: Internal
Perform (me: in out) returns Boolean is private;
fields
myWires: Compound from TopoDS;
myEdges: Compound from TopoDS;
myShape: Shape from TopoDS;
myShared : Boolean;
mySewToler : Real;
myCloseToler : Real;
mySplitClosed: Boolean;
mySplitOpen : Boolean;
end FreeBounds;

View File

@@ -17,25 +17,23 @@
// 25.12.98 pdn: renaming methods GetWires and GetEdges to GetClosedWires
// and GetOpenWires respectively
#include <ShapeFix_FreeBounds.ixx>
#include <BRep_Builder.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <ShapeExtend_Explorer.hxx>
#include <ShapeFix_FreeBounds.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <ShapeExtend_Explorer.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
//=======================================================================
//function : ShapeFix_FreeBounds
//purpose :
//=======================================================================
ShapeFix_FreeBounds::ShapeFix_FreeBounds() {}
//=======================================================================

View File

@@ -0,0 +1,121 @@
// Created on: 1998-09-16
// Created by: Roman LYGIN <rln@nnov.matra-dtv.fr>
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_FreeBounds_HeaderFile
#define _ShapeFix_FreeBounds_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
class TopoDS_Shape;
class TopoDS_Compound;
//! This class is intended to output free bounds of the shape
//! (free bounds are the wires consisting of edges referenced by the
//! only face).
//! For building free bounds it uses ShapeAnalysis_FreeBounds class.
//! This class complements it with the feature to reduce the number
//! of open wires.
//! This reduction is performed with help of connecting several
//! adjacent open wires one to another what can lead to:
//! 1. making an open wire with greater length out of several
//! open wires
//! 2. making closed wire out of several open wires
//!
//! The connecting open wires is performed with a user-given
//! tolerance.
//!
//! When connecting several open wires into one wire their previous
//! end vertices are replaced with new connecting vertices. After
//! that all the edges in the shape sharing previous vertices inside
//! the shape are updated with new vertices. Thus source shape can
//! be modified.
//!
//! Since interface of this class is the same as one of
//! ShapeAnalysis_FreeBounds refer to its CDL for details.
class ShapeFix_FreeBounds
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT ShapeFix_FreeBounds();
//! Builds forecasting free bounds of the <shape> and connects
//! open wires with tolerance <closetoler>.
//! <shape> should be a compound of faces.
//! Tolerance <closetoler> should be greater than tolerance
//! <sewtoler> used for initializing sewing analyzer, otherwise
//! connection of open wires is not performed.
Standard_EXPORT ShapeFix_FreeBounds(const TopoDS_Shape& shape, const Standard_Real sewtoler, const Standard_Real closetoler, const Standard_Boolean splitclosed, const Standard_Boolean splitopen);
//! Builds actual free bounds of the <shape> and connects
//! open wires with tolerance <closetoler>.
//! <shape> should be a compound of shells.
Standard_EXPORT ShapeFix_FreeBounds(const TopoDS_Shape& shape, const Standard_Real closetoler, const Standard_Boolean splitclosed, const Standard_Boolean splitopen);
//! Returns compound of closed wires out of free edges.
const TopoDS_Compound& GetClosedWires() const;
//! Returns compound of open wires out of free edges.
const TopoDS_Compound& GetOpenWires() const;
//! Returns modified source shape.
const TopoDS_Shape& GetShape() const;
protected:
private:
Standard_EXPORT Standard_Boolean Perform();
TopoDS_Compound myWires;
TopoDS_Compound myEdges;
TopoDS_Shape myShape;
Standard_Boolean myShared;
Standard_Real mySewToler;
Standard_Real myCloseToler;
Standard_Boolean mySplitClosed;
Standard_Boolean mySplitOpen;
};
#include <ShapeFix_FreeBounds.lxx>
#endif // _ShapeFix_FreeBounds_HeaderFile

View File

@@ -1,109 +0,0 @@
-- Created on: 2004-03-05
-- Created by: Sergey KUUL
-- Copyright (c) 2004-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class IntersectionTool from ShapeFix
---Purpose: Tool for fixing selfintersecting wire
-- and intersecting wires
uses
Face from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
ReShape from ShapeBuild,
WireData from ShapeExtend,
DataMapOfShapeBox2d from ShapeFix,
Curve from Geom2d,
Box2d from Bnd
is
Create(context: ReShape from ShapeBuild;
preci: Real; maxtol: Real =1.0) returns IntersectionTool from ShapeFix;
---Purpose: Constructor
Context (me) returns ReShape from ShapeBuild;
---Purpose: Returns context
---C++: inline
SplitEdge(me; edge: Edge from TopoDS; param: Real from Standard;
vert: Vertex from TopoDS; face: Face from TopoDS;
newE1: in out Edge from TopoDS; newE2: in out Edge from TopoDS;
preci: Real from Standard)
returns Boolean from Standard;
---Purpose: Split edge on two new edges using new vertex "vert"
-- and "param" - parameter for splitting
-- The "face" is necessary for pcurves and using TransferParameterProj
CutEdge(me; edge: Edge from TopoDS; pend: Real from Standard;
cut: Real from Standard; face: Face from TopoDS;
iscutline: in out Boolean from Standard)
returns Boolean from Standard;
---Purpose: Cut edge by parameters pend and cut
SplitEdge1(me; sewd: WireData from ShapeExtend;
face: Face from TopoDS;
num: Integer from Standard;
param: Real from Standard;
vert: Vertex from TopoDS;
preci: Real from Standard;
boxes: in out DataMapOfShapeBox2d from ShapeFix)
returns Boolean from Standard is private;
SplitEdge2(me; sewd: WireData from ShapeExtend;
face: Face from TopoDS;
num: Integer from Standard;
param1: Real from Standard;
param2: Real from Standard;
vert: Vertex from TopoDS;
preci: Real from Standard;
boxes: in out DataMapOfShapeBox2d from ShapeFix)
returns Boolean from Standard is private;
UnionVertexes(me; sewd: WireData from ShapeExtend;
edge1: in out Edge from TopoDS;
edge2: in out Edge from TopoDS;
num2: Integer from Standard;
boxes: in out DataMapOfShapeBox2d from ShapeFix;
B2: Box2d from Bnd)
returns Boolean from Standard is private;
FindVertAndSplitEdge(me; param1: Real from Standard;
edge1,edge2: Edge from TopoDS;
Crv1: Curve from Geom2d;
MaxTolVert: in out Real from Standard;
num1: in out Integer from Standard;
sewd: WireData from ShapeExtend;
face: Face from TopoDS;
boxes: in out DataMapOfShapeBox2d from ShapeFix;
aTmpKey: Boolean from Standard)
returns Boolean from Standard is private;
FixSelfIntersectWire(me; sewd: in out WireData from ShapeExtend;
face: Face from TopoDS;
NbSplit: in out Integer; NbCut: in out Integer;
NbRemoved: in out Integer)
returns Boolean from Standard;
FixIntersectingWires(me; face: in out Face from TopoDS)
returns Boolean from Standard;
fields
myContext : ReShape from ShapeBuild;
myPreci : Real from Standard;
myMaxTol : Real from Standard;
end IntersectionTool;

View File

@@ -11,47 +11,51 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_IntersectionTool.ixx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <gp_Pnt.hxx>
#include <IntRes2d_Domain.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_IntersectionSegment.hxx>
#include <IntRes2d_Position.hxx>
#include <NCollection_Sequence.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix_DataMapOfShapeBox2d.hxx>
#include <ShapeFix_IntersectionTool.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <NCollection_Sequence.hxx>
//gka 06.09.04 BUG 6555 shape is modified always independently either intersection was fixed or not
//=======================================================================
//function : ShapeFix_IntersectionTool
//purpose :
//=======================================================================
ShapeFix_IntersectionTool::ShapeFix_IntersectionTool(const Handle(ShapeBuild_ReShape)& context,
const Standard_Real preci,
const Standard_Real maxtol)

View File

@@ -0,0 +1,98 @@
// Created on: 2004-03-05
// Created by: Sergey KUUL
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_IntersectionTool_HeaderFile
#define _ShapeFix_IntersectionTool_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <ShapeFix_DataMapOfShapeBox2d.hxx>
class ShapeBuild_ReShape;
class TopoDS_Edge;
class TopoDS_Vertex;
class TopoDS_Face;
class ShapeExtend_WireData;
class Bnd_Box2d;
class Geom2d_Curve;
//! Tool for fixing selfintersecting wire
//! and intersecting wires
class ShapeFix_IntersectionTool
{
public:
DEFINE_STANDARD_ALLOC
//! Constructor
Standard_EXPORT ShapeFix_IntersectionTool(const Handle(ShapeBuild_ReShape)& context, const Standard_Real preci, const Standard_Real maxtol = 1.0);
//! Returns context
Handle(ShapeBuild_ReShape) Context() const;
//! Split edge on two new edges using new vertex "vert"
//! and "param" - parameter for splitting
//! The "face" is necessary for pcurves and using TransferParameterProj
Standard_EXPORT Standard_Boolean SplitEdge (const TopoDS_Edge& edge, const Standard_Real param, const TopoDS_Vertex& vert, const TopoDS_Face& face, TopoDS_Edge& newE1, TopoDS_Edge& newE2, const Standard_Real preci) const;
//! Cut edge by parameters pend and cut
Standard_EXPORT Standard_Boolean CutEdge (const TopoDS_Edge& edge, const Standard_Real pend, const Standard_Real cut, const TopoDS_Face& face, Standard_Boolean& iscutline) const;
Standard_EXPORT Standard_Boolean FixSelfIntersectWire (Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& face, Standard_Integer& NbSplit, Standard_Integer& NbCut, Standard_Integer& NbRemoved) const;
Standard_EXPORT Standard_Boolean FixIntersectingWires (TopoDS_Face& face) const;
protected:
private:
Standard_EXPORT Standard_Boolean SplitEdge1 (const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& face, const Standard_Integer num, const Standard_Real param, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes) const;
Standard_EXPORT Standard_Boolean SplitEdge2 (const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& face, const Standard_Integer num, const Standard_Real param1, const Standard_Real param2, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes) const;
Standard_EXPORT Standard_Boolean UnionVertexes (const Handle(ShapeExtend_WireData)& sewd, TopoDS_Edge& edge1, TopoDS_Edge& edge2, const Standard_Integer num2, ShapeFix_DataMapOfShapeBox2d& boxes, const Bnd_Box2d& B2) const;
Standard_EXPORT Standard_Boolean FindVertAndSplitEdge (const Standard_Real param1, const TopoDS_Edge& edge1, const TopoDS_Edge& edge2, const Handle(Geom2d_Curve)& Crv1, Standard_Real& MaxTolVert, Standard_Integer& num1, const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& face, ShapeFix_DataMapOfShapeBox2d& boxes, const Standard_Boolean aTmpKey) const;
Handle(ShapeBuild_ReShape) myContext;
Standard_Real myPreci;
Standard_Real myMaxTol;
};
#include <ShapeFix_IntersectionTool.lxx>
#endif // _ShapeFix_IntersectionTool_HeaderFile

View File

@@ -1,127 +0,0 @@
-- Created on: 1999-08-09
-- Created by: Galina KULIKOVA
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Root from ShapeFix inherits TShared from MMgt
---Purpose: Root class for fixing operations
-- Provides context for recording changes (optional),
-- basic precision value and limit (minimal and
-- maximal) values for tolerances,
-- and message registrator
uses
Shape from TopoDS,
ReShape from ShapeBuild,
BasicMsgRegistrator from ShapeExtend,
Msg from Message,
Gravity from Message
is
Create returns Root from ShapeFix;
---Purpose: Empty Constructor (no context is created)
Set (me: mutable; Root: Root from ShapeFix) is virtual;
---Purpose: Copy all fields from another Root object
SetContext (me:mutable; context : ReShape from ShapeBuild) is virtual;
---Purpose: Sets context
Context (me) returns ReShape from ShapeBuild;
---Purpose: Returns context
---C++: inline
SetMsgRegistrator (me:mutable; msgreg: BasicMsgRegistrator from ShapeExtend) is virtual;
---Purpose: Sets message registrator
MsgRegistrator (me) returns BasicMsgRegistrator from ShapeExtend;
---Purpose: Returns message registrator
---C++: inline
SetPrecision (me:mutable; preci: Real) is virtual;
---Purpose: Sets basic precision value
Precision (me) returns Real;
---Purpose: Returns basic precision value
---C++: inline
SetMinTolerance (me:mutable; mintol: Real) is virtual;
---Purpose: Sets minimal allowed tolerance
MinTolerance (me) returns Real;
---Purpose: Returns minimal allowed tolerance
---C++: inline
SetMaxTolerance (me:mutable; maxtol: Real) is virtual;
---Purpose: Sets maximal allowed tolerance
MaxTolerance (me) returns Real;
---Purpose: Returns maximal allowed tolerance
---C++: inline
LimitTolerance (me; toler: Real) returns Real;
---Purpose: Returns tolerance limited by [myMinTol,myMaxTol]
---C++: inline
-- Methods for sending messages
SendMsg (me; shape : Shape from TopoDS;
message: Msg from Message;
gravity: Gravity from Message = Message_Info);
---Purpose: Sends a message to be attached to the shape.
-- Calls corresponding message of message registrator.
SendMsg (me; message: Msg from Message;
gravity: Gravity from Message = Message_Info);
---Purpose: Sends a message to be attached to myShape.
-- Calls previous method.
---C++ : inline
SendWarning (me; shape: Shape from TopoDS; message: Msg from Message);
---Purpose: Sends a warning to be attached to the shape.
-- Calls SendMsg with gravity set to Message_Warning.
---C++ : inline
SendWarning (me; message: Msg from Message);
---Purpose: Calls previous method for myShape.
---C++ : inline
SendFail (me; shape: Shape from TopoDS; message: Msg from Message);
---Purpose: Sends a fail to be attached to the shape.
-- Calls SendMsg with gravity set to Message_Fail.
---C++ : inline
SendFail (me; message: Msg from Message);
---Purpose: Calls previous method for myShape.
---C++ : inline
NeedFix (myclass; flag: Integer; def: Boolean = Standard_True)
returns Boolean is protected;
---Purpose: Auxiliary method for work with three-position
-- (on/off/default) flags (modes) in ShapeFix.
---C++: inline
fields
myContext : ReShape from ShapeBuild;
myMsgReg : BasicMsgRegistrator from ShapeExtend;
myPrecision: Real; -- basic precision
myMinTol : Real; -- minimal allowed tolerance
myMaxTol : Real; -- maximal allowed tolerance
myShape : Shape from TopoDS is protected; -- current processed shape
end Root;

View File

@@ -11,13 +11,18 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_Root.ixx>
#include <Message_Msg.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend_BasicMsgRegistrator.hxx>
#include <ShapeFix_Root.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
//=======================================================================
//function : ShapeFix_Root
//purpose :
//=======================================================================
ShapeFix_Root::ShapeFix_Root()
{
myPrecision = myMinTol = myMaxTol = Precision::Confusion();

View File

@@ -0,0 +1,144 @@
// Created on: 1999-08-09
// Created by: Galina KULIKOVA
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_Root_HeaderFile
#define _ShapeFix_Root_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Real.hxx>
#include <TopoDS_Shape.hxx>
#include <MMgt_TShared.hxx>
#include <Message_Gravity.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class ShapeBuild_ReShape;
class ShapeExtend_BasicMsgRegistrator;
class TopoDS_Shape;
class Message_Msg;
class ShapeFix_Root;
DEFINE_STANDARD_HANDLE(ShapeFix_Root, MMgt_TShared)
//! Root class for fixing operations
//! Provides context for recording changes (optional),
//! basic precision value and limit (minimal and
//! maximal) values for tolerances,
//! and message registrator
class ShapeFix_Root : public MMgt_TShared
{
public:
//! Empty Constructor (no context is created)
Standard_EXPORT ShapeFix_Root();
//! Copy all fields from another Root object
Standard_EXPORT virtual void Set (const Handle(ShapeFix_Root)& Root);
//! Sets context
Standard_EXPORT virtual void SetContext (const Handle(ShapeBuild_ReShape)& context);
//! Returns context
Handle(ShapeBuild_ReShape) Context() const;
//! Sets message registrator
Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg);
//! Returns message registrator
Handle(ShapeExtend_BasicMsgRegistrator) MsgRegistrator() const;
//! Sets basic precision value
Standard_EXPORT virtual void SetPrecision (const Standard_Real preci);
//! Returns basic precision value
Standard_Real Precision() const;
//! Sets minimal allowed tolerance
Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol);
//! Returns minimal allowed tolerance
Standard_Real MinTolerance() const;
//! Sets maximal allowed tolerance
Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol);
//! Returns maximal allowed tolerance
Standard_Real MaxTolerance() const;
//! Returns tolerance limited by [myMinTol,myMaxTol]
Standard_Real LimitTolerance (const Standard_Real toler) const;
//! Sends a message to be attached to the shape.
//! Calls corresponding message of message registrator.
Standard_EXPORT void SendMsg (const TopoDS_Shape& shape, const Message_Msg& message, const Message_Gravity gravity = Message_Info) const;
//! Sends a message to be attached to myShape.
//! Calls previous method.
void SendMsg (const Message_Msg& message, const Message_Gravity gravity = Message_Info) const;
//! Sends a warning to be attached to the shape.
//! Calls SendMsg with gravity set to Message_Warning.
void SendWarning (const TopoDS_Shape& shape, const Message_Msg& message) const;
//! Calls previous method for myShape.
void SendWarning (const Message_Msg& message) const;
//! Sends a fail to be attached to the shape.
//! Calls SendMsg with gravity set to Message_Fail.
void SendFail (const TopoDS_Shape& shape, const Message_Msg& message) const;
//! Calls previous method for myShape.
void SendFail (const Message_Msg& message) const;
DEFINE_STANDARD_RTTI(ShapeFix_Root,MMgt_TShared)
protected:
//! Auxiliary method for work with three-position
//! (on/off/default) flags (modes) in ShapeFix.
static Standard_Boolean NeedFix (const Standard_Integer flag, const Standard_Boolean def = Standard_True);
TopoDS_Shape myShape;
private:
Handle(ShapeBuild_ReShape) myContext;
Handle(ShapeExtend_BasicMsgRegistrator) myMsgReg;
Standard_Real myPrecision;
Standard_Real myMinTol;
Standard_Real myMaxTol;
};
#include <ShapeFix_Root.lxx>
#endif // _ShapeFix_Root_HeaderFile

View File

@@ -1,159 +0,0 @@
-- Created on: 1998-08-12
-- Created by: DATA EXCHANGE TEAM
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Shape from ShapeFix inherits Root from ShapeFix
---Purpose: Fixing shape in general
uses
Shape from TopoDS,
Solid from ShapeFix,
Shell from ShapeFix,
Face from ShapeFix,
Wire from ShapeFix,
Edge from ShapeFix,
Status from ShapeExtend,
MapOfShape from TopTools,
BasicMsgRegistrator from ShapeExtend,
ProgressIndicator from Message
is
Create returns Shape from ShapeFix;
---Purpose: Empty Constructor
Create (shape: Shape from TopoDS)
returns Shape from ShapeFix;
---Purpose: Initislises by shape.
Init (me: mutable; shape: Shape from TopoDS);
---Purpose: Initislises by shape.
Perform (me : mutable;
theProgress : ProgressIndicator from Message = 0) returns Boolean;
---Purpose: Iterates on sub- shape and performs fixes
SameParameter (me : mutable;
shape : Shape from TopoDS;
enforce : Boolean;
theProgress : ProgressIndicator from Message = 0) is protected;
---Purpose: Fixes same parameterization problem on the passed shape
-- by updating tolerances of the corresponding topological
-- entitites.
Shape (me) returns Shape from TopoDS;
---Purpose: Returns resulting shape
FixSolidTool (me) returns Solid from ShapeFix;
---Purpose: Returns tool for fixing solids.
---C++:inline
FixShellTool (me) returns Shell from ShapeFix;
---Purpose: Returns tool for fixing shells.
---C++:inline
FixFaceTool (me) returns Face from ShapeFix;
---Purpose: Returns tool for fixing faces.
---C++:inline
FixWireTool (me) returns Wire from ShapeFix;
---Purpose: Returns tool for fixing wires.
---C++:inline
FixEdgeTool (me) returns Edge from ShapeFix;
---Purpose: Returns tool for fixing edges.
---C++:inline
Status (me; status : Status from ShapeExtend) returns Boolean;
---Purpose: Returns the status of the last Fix.
-- This can be a combination of the following flags:
-- ShapeExtend_DONE1: some free edges were fixed
-- ShapeExtend_DONE2: some free wires were fixed
-- ShapeExtend_DONE3: some free faces were fixed
-- ShapeExtend_DONE4: some free shells were fixed
-- ShapeExtend_DONE5: some free solids were fixed
-- ShapeExtend_DONE6: shapes in compound(s) were fixed
SetMsgRegistrator (me: mutable; msgreg: BasicMsgRegistrator from ShapeExtend) is redefined;
---Purpose: Sets message registrator
SetPrecision (me: mutable; preci: Real) is redefined;
---Purpose: Sets basic precision value (also to FixSolidTool)
SetMinTolerance (me: mutable; mintol: Real) is redefined;
---Purpose: Sets minimal allowed tolerance (also to FixSolidTool)
SetMaxTolerance (me: mutable; maxtol: Real) is redefined;
---Purpose: Sets maximal allowed tolerance (also to FixSolidTool)
FixSolidMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying fixes of
-- ShapeFix_Solid, by default True.
FixFreeShellMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying fixes of
-- ShapeFix_Shell, by default True.
FixFreeFaceMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying fixes of
-- ShapeFix_Face, by default True.
FixFreeWireMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying fixes of
-- ShapeFix_Wire, by default True.
FixSameParameterMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying
-- ShapeFix::SameParameter after all fixes, by default True.
FixVertexPositionMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying
-- ShapeFix::FixVertexPosition before all fixes, by default False.
FixVertexTolMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for fixing tolerances of vertices on whole shape
-- after performing all fixes
fields
myResult : Shape from TopoDS is protected;
myFixSolid : Solid from ShapeFix is protected;
myMapFixingShape : MapOfShape from TopTools is protected;
myFixSolidMode : Integer is protected;
myFixShellMode : Integer is protected;
myFixFaceMode : Integer is protected;
myFixWireMode : Integer is protected;
myFixSameParameterMode : Integer is protected;
myFixVertexPositionMode : Integer is protected;
myFixVertexTolMode : Integer is protected;
myStatus : Integer is protected;
end Shape;

View File

@@ -14,36 +14,36 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_Shape.ixx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopAbs.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <ShapeFix.hxx>
#include <BRepTools.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressSentry.hxx>
#include <Precision.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend_BasicMsgRegistrator.hxx>
#include <ShapeFix.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_Shape.hxx>
#include <ShapeFix_Shell.hxx>
#include <ShapeFix_Solid.hxx>
#include <Message_ProgressSentry.hxx>
#include <ShapeFix_Wire.hxx>
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
//=======================================================================
//function : ShapeFix_Shape
//purpose :
//=======================================================================
ShapeFix_Shape::ShapeFix_Shape()
{
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);

View File

@@ -0,0 +1,170 @@
// Created on: 1998-08-12
// Created by: DATA EXCHANGE TEAM
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_Shape_HeaderFile
#define _ShapeFix_Shape_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Standard_Integer.hxx>
#include <ShapeFix_Root.hxx>
#include <Standard_Boolean.hxx>
#include <ShapeExtend_Status.hxx>
#include <Standard_Real.hxx>
class ShapeFix_Solid;
class TopoDS_Shape;
class Message_ProgressIndicator;
class ShapeFix_Shell;
class ShapeFix_Face;
class ShapeFix_Wire;
class ShapeFix_Edge;
class ShapeExtend_BasicMsgRegistrator;
class ShapeFix_Shape;
DEFINE_STANDARD_HANDLE(ShapeFix_Shape, ShapeFix_Root)
//! Fixing shape in general
class ShapeFix_Shape : public ShapeFix_Root
{
public:
//! Empty Constructor
Standard_EXPORT ShapeFix_Shape();
//! Initislises by shape.
Standard_EXPORT ShapeFix_Shape(const TopoDS_Shape& shape);
//! Initislises by shape.
Standard_EXPORT void Init (const TopoDS_Shape& shape);
//! Iterates on sub- shape and performs fixes
Standard_EXPORT Standard_Boolean Perform (const Handle(Message_ProgressIndicator)& theProgress = 0);
//! Returns resulting shape
Standard_EXPORT TopoDS_Shape Shape() const;
//! Returns tool for fixing solids.
Handle(ShapeFix_Solid) FixSolidTool() const;
//! Returns tool for fixing shells.
Handle(ShapeFix_Shell) FixShellTool() const;
//! Returns tool for fixing faces.
Handle(ShapeFix_Face) FixFaceTool() const;
//! Returns tool for fixing wires.
Handle(ShapeFix_Wire) FixWireTool() const;
//! Returns tool for fixing edges.
Handle(ShapeFix_Edge) FixEdgeTool() const;
//! Returns the status of the last Fix.
//! This can be a combination of the following flags:
//! ShapeExtend_DONE1: some free edges were fixed
//! ShapeExtend_DONE2: some free wires were fixed
//! ShapeExtend_DONE3: some free faces were fixed
//! ShapeExtend_DONE4: some free shells were fixed
//! ShapeExtend_DONE5: some free solids were fixed
//! ShapeExtend_DONE6: shapes in compound(s) were fixed
Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
//! Sets message registrator
Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE;
//! Sets basic precision value (also to FixSolidTool)
Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE;
//! Sets minimal allowed tolerance (also to FixSolidTool)
Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE;
//! Sets maximal allowed tolerance (also to FixSolidTool)
Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE;
//! Returns (modifiable) the mode for applying fixes of
//! ShapeFix_Solid, by default True.
Standard_Integer& FixSolidMode();
//! Returns (modifiable) the mode for applying fixes of
//! ShapeFix_Shell, by default True.
Standard_Integer& FixFreeShellMode();
//! Returns (modifiable) the mode for applying fixes of
//! ShapeFix_Face, by default True.
Standard_Integer& FixFreeFaceMode();
//! Returns (modifiable) the mode for applying fixes of
//! ShapeFix_Wire, by default True.
Standard_Integer& FixFreeWireMode();
//! Returns (modifiable) the mode for applying
//! ShapeFix::SameParameter after all fixes, by default True.
Standard_Integer& FixSameParameterMode();
//! Returns (modifiable) the mode for applying
//! ShapeFix::FixVertexPosition before all fixes, by default False.
Standard_Integer& FixVertexPositionMode();
//! Returns (modifiable) the mode for fixing tolerances of vertices on whole shape
//! after performing all fixes
Standard_Integer& FixVertexTolMode();
DEFINE_STANDARD_RTTI(ShapeFix_Shape,ShapeFix_Root)
protected:
//! Fixes same parameterization problem on the passed shape
//! by updating tolerances of the corresponding topological
//! entitites.
Standard_EXPORT void SameParameter (const TopoDS_Shape& shape, const Standard_Boolean enforce, const Handle(Message_ProgressIndicator)& theProgress = 0);
TopoDS_Shape myResult;
Handle(ShapeFix_Solid) myFixSolid;
TopTools_MapOfShape myMapFixingShape;
Standard_Integer myFixSolidMode;
Standard_Integer myFixShellMode;
Standard_Integer myFixFaceMode;
Standard_Integer myFixWireMode;
Standard_Integer myFixSameParameterMode;
Standard_Integer myFixVertexPositionMode;
Standard_Integer myFixVertexTolMode;
Standard_Integer myStatus;
private:
};
#include <ShapeFix_Shape.lxx>
#endif // _ShapeFix_Shape_HeaderFile

View File

@@ -1,59 +0,0 @@
-- Created on: 1998-07-22
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ShapeTolerance from ShapeFix
---Purpose: Modifies tolerances of sub-shapes (vertices, edges, faces)
uses
Shape from TopoDS,
ShapeEnum from TopAbs
is
Create returns ShapeTolerance from ShapeFix;
LimitTolerance (me; shape: Shape from TopoDS;
tmin : Real;
tmax : Real = 0.0;
styp : ShapeEnum from TopAbs = TopAbs_SHAPE)
returns Boolean;
---Purpose: Limits tolerances in a shape as follows :
-- tmin = tmax -> as SetTolerance (forces)
-- tmin = 0 -> maximum tolerance will be <tmax>
-- tmax = 0 or not given (more generally, tmax < tmin) ->
-- <tmax> ignored, minimum will be <tmin>
-- else, maximum will be <max> and minimum will be <min>
-- styp = VERTEX : only vertices are set
-- styp = EDGE : only edges are set
-- styp = FACE : only faces are set
-- styp = WIRE : to have edges and their vertices set
-- styp = other value : all (vertices,edges,faces) are set
-- Returns True if at least one tolerance of the sub-shape has
-- been modified
SetTolerance (me; shape: Shape from TopoDS;
preci: Real;
styp : ShapeEnum from TopAbs = TopAbs_SHAPE);
---Purpose: Sets (enforces) tolerances in a shape to the given value
-- styp = VERTEX : only vertices are set
-- styp = EDGE : only edges are set
-- styp = FACE : only faces are set
-- styp = WIRE : to have edges and their vertices set
-- styp = other value : all (vertices,edges,faces) are set
end ShapeTolerance;

View File

@@ -13,26 +13,23 @@
// 25.12.98 pdn: adding empty constructor
#include <ShapeFix_ShapeTolerance.ixx>
#include <BRep_Tool.hxx>
#include <BRep_TVertex.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TFace.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <BRep_TVertex.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
ShapeFix_ShapeTolerance::ShapeFix_ShapeTolerance()
{
}

View File

@@ -0,0 +1,86 @@
// Created on: 1998-07-22
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_ShapeTolerance_HeaderFile
#define _ShapeFix_ShapeTolerance_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <TopAbs_ShapeEnum.hxx>
class TopoDS_Shape;
//! Modifies tolerances of sub-shapes (vertices, edges, faces)
class ShapeFix_ShapeTolerance
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT ShapeFix_ShapeTolerance();
//! Limits tolerances in a shape as follows :
//! tmin = tmax -> as SetTolerance (forces)
//! tmin = 0 -> maximum tolerance will be <tmax>
//! tmax = 0 or not given (more generally, tmax < tmin) ->
//! <tmax> ignored, minimum will be <tmin>
//! else, maximum will be <max> and minimum will be <min>
//! styp = VERTEX : only vertices are set
//! styp = EDGE : only edges are set
//! styp = FACE : only faces are set
//! styp = WIRE : to have edges and their vertices set
//! styp = other value : all (vertices,edges,faces) are set
//! Returns True if at least one tolerance of the sub-shape has
//! been modified
Standard_EXPORT Standard_Boolean LimitTolerance (const TopoDS_Shape& shape, const Standard_Real tmin, const Standard_Real tmax = 0.0, const TopAbs_ShapeEnum styp = TopAbs_SHAPE) const;
//! Sets (enforces) tolerances in a shape to the given value
//! styp = VERTEX : only vertices are set
//! styp = EDGE : only edges are set
//! styp = FACE : only faces are set
//! styp = WIRE : to have edges and their vertices set
//! styp = other value : all (vertices,edges,faces) are set
Standard_EXPORT void SetTolerance (const TopoDS_Shape& shape, const Standard_Real preci, const TopAbs_ShapeEnum styp = TopAbs_SHAPE) const;
protected:
private:
};
#endif // _ShapeFix_ShapeTolerance_HeaderFile

View File

@@ -1,127 +0,0 @@
-- Created on: 1998-08-12
-- Created by: Galina KULIKOVA
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Shell from ShapeFix inherits Root from ShapeFix
---Purpose: Fixing orientation of faces in shell
uses
Compound from TopoDS,
Shell from TopoDS,
Shape from TopoDS,
Status from ShapeExtend,
BasicMsgRegistrator from ShapeExtend,
Face from ShapeFix,
ProgressIndicator from Message
is
Create returns Shell from ShapeFix;
---Purpose: Empty constructor
Create (shape: Shell from TopoDS)
returns Shell from ShapeFix;
---Purpose: Initializes by shell.
Init (me: mutable; shell: Shell from TopoDS);
---Purpose: Initializes by shell.
Perform (me: mutable;
theProgress : ProgressIndicator from Message = 0) returns Boolean;
---Purpose: Iterates on subshapes and performs fixes
-- (for each face calls ShapeFix_Face::Perform and
-- then calls FixFaceOrientation). The passed progress
-- indicator allows user to consult the current progress
-- stage and abort algorithm if needed.
FixFaceOrientation (me : mutable; shell : Shell from TopoDS;
isAccountMultiConex : Boolean = Standard_True;
NonManifold : Boolean = Standard_False ) returns Boolean;
---Purpose: Fixes orientation of faces in shell.
-- Changes orientation of face in the shell, if it is oriented opposite
-- to neigbouring faces. If it is not possible to orient all faces in the
-- shell (like in case of mebious band), this method orients only subset
-- of faces. Other faces are stored in Error compound.
-- Modes :
-- isAccountMultiConex - mode for account cases of multiconnexity.
-- If this mode is equal to Standard_True, separate shells will be created
-- in the cases of multiconnexity. If this mode is equal to Standard_False,
-- one shell will be created without account of multiconnexity.By defautt - Standard_True;
-- NonManifold - mode for creation of non-manifold shells.
-- If this mode is equal to Standard_True one non-manifold will be created from shell
-- contains multishared edges. Else if this mode is equal to Standard_False only
-- manifold shells will be created. By default - Standard_False.
--
---Returns: If resulting shell is ok returns TRUE, else returns FALSE.
---Status : OK - faces in shall were oriented correcty.
-- DONE - faces in shell oriented succesfully
-- FAIL - faces orientation process has been failed
Shell(me : mutable) returns Shell from TopoDS;
---Purpose: Returns fixed shell (or subset of oriented faces).
Shape(me : mutable) returns Shape from TopoDS;
---Purpose: In case of multiconnexity returns compound of fixed shells
-- else returns one shell..
NbShells(me) returns Integer;
---Purpose: Returns Number of obtainrd shells;
ErrorFaces(me) returns Compound from TopoDS;
---Purpose: Returns not oriented subset of faces.
Status (me; status : Status from ShapeExtend) returns Boolean;
---Purpose: Returns the status of the last Fix.
FixFaceTool (me:mutable) returns Face from ShapeFix;
---Purpose: Returns tool for fixing faces.
---C++:inline
SetMsgRegistrator (me: mutable; msgreg: BasicMsgRegistrator from ShapeExtend) is redefined;
---Purpose: Sets message registrator
SetPrecision (me: mutable; preci: Real) is redefined;
---Purpose: Sets basic precision value (also to FixWireTool)
SetMinTolerance (me: mutable; mintol: Real) is redefined;
---Purpose: Sets minimal allowed tolerance (also to FixWireTool)
SetMaxTolerance (me: mutable; maxtol: Real) is redefined;
---Purpose: Sets maximal allowed tolerance (also to FixWireTool)
FixFaceMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying fixes of
-- ShapeFix_Face, by default True.
FixOrientationMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying
-- FixFaceOrientation, by default True.
fields
myShell : Shell from TopoDS is protected;
myErrFaces : Compound from TopoDS is protected;
myStatus : Integer is protected;
myFixFace : Face from ShapeFix is protected;
myFixFaceMode : Integer is protected;
myFixOrientationMode : Integer is protected;
myNbShells : Integer is protected;
end Shell;

View File

@@ -16,57 +16,51 @@
// pdn 17.12.98 ie_exhaust-A.stp
#include <ShapeFix_Shell.ixx>
#include <Precision.hxx>
#include <TopAbs.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Bnd_Array1OfBox.hxx>
#include <Bnd_Box.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <ShapeAnalysis_Shell.hxx>
#include <ShapeExtend.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <Message_Msg.hxx>
#include <Message_ProgressSentry.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <Bnd_Array1OfBox.hxx>
#include <Message_Msg.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressSentry.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis_Shell.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend.hxx>
#include <ShapeExtend_BasicMsgRegistrator.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeFix_Shell.hxx>
#include <Standard_Type.hxx>
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
//=======================================================================
//function : ShapeFix_Shell
//purpose :
//=======================================================================
ShapeFix_Shell::ShapeFix_Shell()
{
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);

View File

@@ -0,0 +1,150 @@
// Created on: 1998-08-12
// Created by: Galina KULIKOVA
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_Shell_HeaderFile
#define _ShapeFix_Shell_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Compound.hxx>
#include <Standard_Integer.hxx>
#include <ShapeFix_Root.hxx>
#include <Standard_Boolean.hxx>
#include <ShapeExtend_Status.hxx>
#include <Standard_Real.hxx>
class ShapeFix_Face;
class TopoDS_Shell;
class Message_ProgressIndicator;
class TopoDS_Shape;
class TopoDS_Compound;
class ShapeExtend_BasicMsgRegistrator;
class ShapeFix_Shell;
DEFINE_STANDARD_HANDLE(ShapeFix_Shell, ShapeFix_Root)
//! Fixing orientation of faces in shell
class ShapeFix_Shell : public ShapeFix_Root
{
public:
//! Empty constructor
Standard_EXPORT ShapeFix_Shell();
//! Initializes by shell.
Standard_EXPORT ShapeFix_Shell(const TopoDS_Shell& shape);
//! Initializes by shell.
Standard_EXPORT void Init (const TopoDS_Shell& shell);
//! Iterates on subshapes and performs fixes
//! (for each face calls ShapeFix_Face::Perform and
//! then calls FixFaceOrientation). The passed progress
//! indicator allows user to consult the current progress
//! stage and abort algorithm if needed.
Standard_EXPORT Standard_Boolean Perform (const Handle(Message_ProgressIndicator)& theProgress = 0);
//! Fixes orientation of faces in shell.
//! Changes orientation of face in the shell, if it is oriented opposite
//! to neigbouring faces. If it is not possible to orient all faces in the
//! shell (like in case of mebious band), this method orients only subset
//! of faces. Other faces are stored in Error compound.
//! Modes :
//! isAccountMultiConex - mode for account cases of multiconnexity.
//! If this mode is equal to Standard_True, separate shells will be created
//! in the cases of multiconnexity. If this mode is equal to Standard_False,
//! one shell will be created without account of multiconnexity.By defautt - Standard_True;
//! NonManifold - mode for creation of non-manifold shells.
//! If this mode is equal to Standard_True one non-manifold will be created from shell
//! contains multishared edges. Else if this mode is equal to Standard_False only
//! manifold shells will be created. By default - Standard_False.
Standard_EXPORT Standard_Boolean FixFaceOrientation (const TopoDS_Shell& shell, const Standard_Boolean isAccountMultiConex = Standard_True, const Standard_Boolean NonManifold = Standard_False);
//! Returns fixed shell (or subset of oriented faces).
Standard_EXPORT TopoDS_Shell Shell();
//! In case of multiconnexity returns compound of fixed shells
//! else returns one shell..
Standard_EXPORT TopoDS_Shape Shape();
//! Returns Number of obtainrd shells;
Standard_EXPORT Standard_Integer NbShells() const;
//! Returns not oriented subset of faces.
Standard_EXPORT TopoDS_Compound ErrorFaces() const;
//! Returns the status of the last Fix.
Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
//! Returns tool for fixing faces.
Handle(ShapeFix_Face) FixFaceTool();
//! Sets message registrator
Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE;
//! Sets basic precision value (also to FixWireTool)
Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE;
//! Sets minimal allowed tolerance (also to FixWireTool)
Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE;
//! Sets maximal allowed tolerance (also to FixWireTool)
Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE;
//! Returns (modifiable) the mode for applying fixes of
//! ShapeFix_Face, by default True.
Standard_Integer& FixFaceMode();
//! Returns (modifiable) the mode for applying
//! FixFaceOrientation, by default True.
Standard_Integer& FixOrientationMode();
DEFINE_STANDARD_RTTI(ShapeFix_Shell,ShapeFix_Root)
protected:
TopoDS_Shell myShell;
TopoDS_Compound myErrFaces;
Standard_Integer myStatus;
Handle(ShapeFix_Face) myFixFace;
Standard_Integer myFixFaceMode;
Standard_Integer myFixOrientationMode;
Standard_Integer myNbShells;
private:
};
#include <ShapeFix_Shell.lxx>
#endif // _ShapeFix_Shell_HeaderFile

View File

@@ -1,99 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Solid from ShapeFix inherits Root from ShapeFix
---Purpose: Provides method to build a solid from a shells and
-- orients them in order to have a valid solid with finite volume
uses
Shell from TopoDS,
Solid from TopoDS,
Shape from TopoDS,
Shell from ShapeFix,
Status from ShapeExtend,
BasicMsgRegistrator from ShapeExtend,
ProgressIndicator from Message
is
Create returns Solid from ShapeFix;
---Purpose: Empty constructor;
Create (solid : Solid from TopoDS) returns Solid from ShapeFix;
---Purpose: Initializes by solid.
Init(me: mutable; solid : Solid from TopoDS) is virtual;
---Purpose: Initializes by solid .
Perform(me: mutable;
theProgress : ProgressIndicator from Message = 0) returns Boolean is virtual;
---Purpose: Iterates on shells and performs fixes
-- (calls ShapeFix_Shell for each subshell). The passed
-- progress indicator allows user to consult the current
-- progress stage and abort algorithm if needed.
SolidFromShell (me: mutable; shell: Shell from TopoDS)
returns Solid from TopoDS;
---Purpose: Calls MakeSolid and orients the solid to be "not infinite"
Status (me; status : Status from ShapeExtend) returns Boolean;
---Purpose: Returns the status of the last Fix.
Solid (me) returns Shape from TopoDS;
---Purpose: Returns resulting solid.
FixShellTool (me) returns Shell from ShapeFix;
---Purpose: Returns tool for fixing shells.
---C++:inline
SetMsgRegistrator (me: mutable; msgreg: BasicMsgRegistrator from ShapeExtend) is redefined;
---Purpose: Sets message registrator
SetPrecision (me: mutable; preci: Real) is redefined;
---Purpose: Sets basic precision value (also to FixShellTool)
SetMinTolerance (me: mutable; mintol: Real) is redefined;
---Purpose: Sets minimal allowed tolerance (also to FixShellTool)
SetMaxTolerance (me: mutable; maxtol: Real) is redefined;
---Purpose: Sets maximal allowed tolerance (also to FixShellTool)
FixShellMode (me: mutable) returns Integer;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for applying fixes of
-- ShapeFix_Shell, by default True.
CreateOpenSolidMode(me: mutable) returns Boolean;
---C++: return &
---C++: inline
---Purpose: Returns (modifiable) the mode for creation of solids.
-- If mode myCreateOpenSolidMode is equal to true
-- solids are created from open shells
-- else solids are created from closed shells only.
-- ShapeFix_Shell, by default False.
Shape(me : mutable) returns Shape from TopoDS;
---Purpose: In case of multiconnexity returns compound of fixed solids
-- else returns one solid.
fields
mySolid : Shape from TopoDS is protected;
myFixShell : Shell from ShapeFix is protected;
myStatus : Integer is protected;
myFixShellMode : Integer is protected;
myCreateOpenSolidMode : Boolean;
end Solid;

View File

@@ -11,65 +11,59 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_Solid.ixx>
#include <Bnd_Box2d.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <gp_Pnt.hxx>
#include <Message_Msg.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressSentry.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend.hxx>
#include <ShapeExtend_BasicMsgRegistrator.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix_Shell.hxx>
#include <ShapeFix_Solid.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <BRep_Builder.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <Precision.hxx>
#include <TopoDS_Shape.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS.hxx>
#include <ShapeExtend.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <TopoDS_Wire.hxx>
#include <ShapeExtend_WireData.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <gp_Pnt.hxx>
#include <Bnd_Box2d.hxx>
#include <ShapeAnalysis.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Surface.hxx>
#include <TopTools_ListOfShape.hxx>
#include <Precision.hxx>
#include <TopAbs.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopoDS_Solid.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS.hxx>
#include <TopoDS_CompSolid.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopAbs.hxx>
#include <BRep_Tool.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <Message_Msg.hxx>
#include <Message_ProgressSentry.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <Geom_Curve.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
//======================================================
//function : ShapeFix_Solid
//purpose :
//=======================================================================
ShapeFix_Solid::ShapeFix_Solid()
{
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);

View File

@@ -0,0 +1,131 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_Solid_HeaderFile
#define _ShapeFix_Solid_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <ShapeFix_Root.hxx>
#include <ShapeExtend_Status.hxx>
#include <Standard_Real.hxx>
class ShapeFix_Shell;
class TopoDS_Solid;
class Message_ProgressIndicator;
class TopoDS_Shell;
class TopoDS_Shape;
class ShapeExtend_BasicMsgRegistrator;
class ShapeFix_Solid;
DEFINE_STANDARD_HANDLE(ShapeFix_Solid, ShapeFix_Root)
//! Provides method to build a solid from a shells and
//! orients them in order to have a valid solid with finite volume
class ShapeFix_Solid : public ShapeFix_Root
{
public:
//! Empty constructor;
Standard_EXPORT ShapeFix_Solid();
//! Initializes by solid.
Standard_EXPORT ShapeFix_Solid(const TopoDS_Solid& solid);
//! Initializes by solid .
Standard_EXPORT virtual void Init (const TopoDS_Solid& solid);
//! Iterates on shells and performs fixes
//! (calls ShapeFix_Shell for each subshell). The passed
//! progress indicator allows user to consult the current
//! progress stage and abort algorithm if needed.
Standard_EXPORT virtual Standard_Boolean Perform (const Handle(Message_ProgressIndicator)& theProgress = 0);
//! Calls MakeSolid and orients the solid to be "not infinite"
Standard_EXPORT TopoDS_Solid SolidFromShell (const TopoDS_Shell& shell);
//! Returns the status of the last Fix.
Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
//! Returns resulting solid.
Standard_EXPORT TopoDS_Shape Solid() const;
//! Returns tool for fixing shells.
Handle(ShapeFix_Shell) FixShellTool() const;
//! Sets message registrator
Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE;
//! Sets basic precision value (also to FixShellTool)
Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE;
//! Sets minimal allowed tolerance (also to FixShellTool)
Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE;
//! Sets maximal allowed tolerance (also to FixShellTool)
Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE;
//! Returns (modifiable) the mode for applying fixes of
//! ShapeFix_Shell, by default True.
Standard_Integer& FixShellMode();
//! Returns (modifiable) the mode for creation of solids.
//! If mode myCreateOpenSolidMode is equal to true
//! solids are created from open shells
//! else solids are created from closed shells only.
//! ShapeFix_Shell, by default False.
Standard_Boolean& CreateOpenSolidMode();
//! In case of multiconnexity returns compound of fixed solids
//! else returns one solid.
Standard_EXPORT TopoDS_Shape Shape();
DEFINE_STANDARD_RTTI(ShapeFix_Solid,ShapeFix_Root)
protected:
TopoDS_Shape mySolid;
Handle(ShapeFix_Shell) myFixShell;
Standard_Integer myStatus;
Standard_Integer myFixShellMode;
private:
Standard_Boolean myCreateOpenSolidMode;
};
#include <ShapeFix_Solid.lxx>
#endif // _ShapeFix_Solid_HeaderFile

View File

@@ -1,44 +0,0 @@
-- Created on: 2004-02-04
-- Created by: Sergey KUUL
-- Copyright (c) 2004-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class SplitCommonVertex from ShapeFix inherits Root from ShapeFix
---Purpose: Two wires have common vertex - this case is valid in BRep model
-- and isn't valid in STEP => before writing into STEP it is necessary
-- to split this vertex (each wire must has one vertex)
uses
Shape from TopoDS
is
Create returns SplitCommonVertex;
---Purpose :
Init(me: mutable; S : Shape from TopoDS);
---Purpose :
Perform(me:mutable);
---Purpose :
Shape(me : mutable) returns Shape from TopoDS;
---Purpose :
fields
myShape : Shape from TopoDS;
myResult : Shape from TopoDS;
myStatus : Integer; -- error status
end SplitCommonVertex;

View File

@@ -11,33 +11,33 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_SplitCommonVertex.ixx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
#include <Message_Msg.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix_SplitCommonVertex.hxx>
#include <Standard_Type.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <Message_Msg.hxx>
#include <TopTools_SequenceOfShape.hxx>
//=======================================================================
//function : ShapeFix_SplitCommonVertex
//purpose :
//=======================================================================
ShapeFix_SplitCommonVertex::ShapeFix_SplitCommonVertex()
{
myStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK );

View File

@@ -0,0 +1,74 @@
// Created on: 2004-02-04
// Created by: Sergey KUUL
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_SplitCommonVertex_HeaderFile
#define _ShapeFix_SplitCommonVertex_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Integer.hxx>
#include <ShapeFix_Root.hxx>
class TopoDS_Shape;
class ShapeFix_SplitCommonVertex;
DEFINE_STANDARD_HANDLE(ShapeFix_SplitCommonVertex, ShapeFix_Root)
//! Two wires have common vertex - this case is valid in BRep model
//! and isn't valid in STEP => before writing into STEP it is necessary
//! to split this vertex (each wire must has one vertex)
class ShapeFix_SplitCommonVertex : public ShapeFix_Root
{
public:
Standard_EXPORT ShapeFix_SplitCommonVertex();
Standard_EXPORT void Init (const TopoDS_Shape& S);
Standard_EXPORT void Perform();
Standard_EXPORT TopoDS_Shape Shape();
DEFINE_STANDARD_RTTI(ShapeFix_SplitCommonVertex,ShapeFix_Root)
protected:
private:
TopoDS_Shape myShape;
TopoDS_Shape myResult;
Standard_Integer myStatus;
};
#endif // _ShapeFix_SplitCommonVertex_HeaderFile

View File

@@ -1,79 +0,0 @@
-- Created on: 2004-07-14
-- Created by: Sergey KUUL
-- Copyright (c) 2004-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class SplitTool from ShapeFix
---Purpose: Tool for splitting and cutting edges; includes methods
-- used in OverlappingTool and IntersectionTool
uses
Face from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
ReShape from ShapeBuild,
SequenceOfShape from TopTools
is
Create returns SplitTool from ShapeFix;
---Purpose: Empty constructor
SplitEdge(me; edge: Edge from TopoDS;
param: Real from Standard;
vert: Vertex from TopoDS;
face: Face from TopoDS;
newE1: in out Edge from TopoDS;
newE2: in out Edge from TopoDS;
tol3d, tol2d : Real from Standard)
returns Boolean from Standard;
---Purpose: Split edge on two new edges using new vertex "vert"
-- and "param" - parameter for splitting
-- The "face" is necessary for pcurves and using TransferParameterProj
SplitEdge (me; edge: Edge from TopoDS;
param1: Real from Standard;
param2: Real from Standard;
vert: Vertex from TopoDS;
face: Face from TopoDS;
newE1: in out Edge from TopoDS;
newE2: in out Edge from TopoDS;
tol3d, tol2d : Real from Standard)
returns Boolean from Standard;
---Purpose: Split edge on two new edges using new vertex "vert"
-- and "param1" and "param2" - parameter for splitting and cutting
-- The "face" is necessary for pcurves and using TransferParameterProj
CutEdge(me; edge: Edge from TopoDS; pend: Real from Standard;
cut: Real from Standard; face: Face from TopoDS;
iscutline: in out Boolean from Standard)
returns Boolean from Standard;
---Purpose: Cut edge by parameters pend and cut
SplitEdge(me; edge: Edge from TopoDS; fp: Real from Standard;
V1: Vertex from TopoDS; lp: Real from Standard;
V2: Vertex from TopoDS; face: Face from TopoDS;
SeqE: in out SequenceOfShape from TopTools;
aNum: in out Integer from Standard;
context: ReShape from ShapeBuild;
tol3d, tol2d : Real from Standard)
returns Boolean from Standard;
---Purpose: Split edge on two new edges using two new vertex V1 and V2
-- and two parameters for splitting - fp and lp correspondingly
-- The "face" is necessary for pcurves and using TransferParameterProj
-- aNum - number of edge in SeqE which corresponding to [fp,lp]
end SplitTool;

View File

@@ -13,33 +13,35 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_SplitTool.ixx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom_Curve.hxx>
#include <gp_Pnt.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend_WireData.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_Line.hxx>
#include <gp_Pnt.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Wire.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_SplitTool.hxx>
#include <TopExp_Explorer.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
//=======================================================================
//function : ShapeFix_SplitTool()
//purpose : Constructor
//=======================================================================
ShapeFix_SplitTool::ShapeFix_SplitTool()
{
}

View File

@@ -0,0 +1,87 @@
// Created on: 2004-07-14
// Created by: Sergey KUUL
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_SplitTool_HeaderFile
#define _ShapeFix_SplitTool_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <Standard_Integer.hxx>
class TopoDS_Edge;
class TopoDS_Vertex;
class TopoDS_Face;
class ShapeBuild_ReShape;
//! Tool for splitting and cutting edges; includes methods
//! used in OverlappingTool and IntersectionTool
class ShapeFix_SplitTool
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT ShapeFix_SplitTool();
//! Split edge on two new edges using new vertex "vert"
//! and "param" - parameter for splitting
//! The "face" is necessary for pcurves and using TransferParameterProj
Standard_EXPORT Standard_Boolean SplitEdge (const TopoDS_Edge& edge, const Standard_Real param, const TopoDS_Vertex& vert, const TopoDS_Face& face, TopoDS_Edge& newE1, TopoDS_Edge& newE2, const Standard_Real tol3d, const Standard_Real tol2d) const;
//! Split edge on two new edges using new vertex "vert"
//! and "param1" and "param2" - parameter for splitting and cutting
//! The "face" is necessary for pcurves and using TransferParameterProj
Standard_EXPORT Standard_Boolean SplitEdge (const TopoDS_Edge& edge, const Standard_Real param1, const Standard_Real param2, const TopoDS_Vertex& vert, const TopoDS_Face& face, TopoDS_Edge& newE1, TopoDS_Edge& newE2, const Standard_Real tol3d, const Standard_Real tol2d) const;
//! Cut edge by parameters pend and cut
Standard_EXPORT Standard_Boolean CutEdge (const TopoDS_Edge& edge, const Standard_Real pend, const Standard_Real cut, const TopoDS_Face& face, Standard_Boolean& iscutline) const;
//! Split edge on two new edges using two new vertex V1 and V2
//! and two parameters for splitting - fp and lp correspondingly
//! The "face" is necessary for pcurves and using TransferParameterProj
//! aNum - number of edge in SeqE which corresponding to [fp,lp]
Standard_EXPORT Standard_Boolean SplitEdge (const TopoDS_Edge& edge, const Standard_Real fp, const TopoDS_Vertex& V1, const Standard_Real lp, const TopoDS_Vertex& V2, const TopoDS_Face& face, TopTools_SequenceOfShape& SeqE, Standard_Integer& aNum, const Handle(ShapeBuild_ReShape)& context, const Standard_Real tol3d, const Standard_Real tol2d) const;
protected:
private:
};
#endif // _ShapeFix_SplitTool_HeaderFile

View File

@@ -1,897 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Wire from ShapeFix inherits Root from ShapeFix
---Purpose: This class provides a set of tools for repairing a wire.
--
-- These are methods Fix...(), organised in two levels:
--
-- Level 1: Advanced - each method in this level fixes one separate problem,
-- usually dealing with either single edge or connection of the
-- two adjacent edges. These methods should be used carefully and
-- called in right sequence, because some of them depend on others.
--
-- Level 2: Public (API) - methods which group several methods of level 1
-- and call them in a proper sequence in order to make some
-- consistent set of fixes for a whole wire. It is possible to
-- control calls to methods of the advanced level from methods of
-- the public level by use of flags Fix..Mode() (see below).
--
-- Fixes can be made in three ways:
-- 1. Increasing tolerance of an edge or a vertex
-- 2. Changing topology (adding/removing/replacing edge in the wire
-- and/or replacing the vertex in the edge)
-- 3. Changing geometry (shifting vertex or adjusting ends of edge
-- curve to vertices, or recomputing curves of the edge)
--
-- When fix can be made in more than one way (e.g., either
-- by increasing tolerance or shifting a vertex), it is choosen
-- according to the flags:
-- ModifyTopologyMode - allows modification of the topology.
-- This flag can be set when fixing a wire on
-- the separate (free) face, and should be
-- unset for face which is part of shell.
-- ModifyGeometryMode - allows modification of the geometry.
--
-- The order of descriptions of Fix() methods in this CDL
-- approximately corresponds to the optimal order of calls.
--
-- NOTE: most of fixing methods expect edges in the
-- ShapeExtend_WireData to be ordered, so it is necessary to make
-- call to FixReorder() before any other fixes
--
-- ShapeFix_Wire should be initialized prior to any fix by the
-- following data:
-- a) Wire (ether TopoDS_Wire or ShapeExtend_Wire)
-- b) Face or surface
-- c) Precision
-- d) Maximal tail angle and width
-- This can be done either by calling corresponding methods
-- (LoadWire, SetFace or SetSurface, SetPrecision, SetMaxTailAngle
-- and SetMaxTailWidth), or
-- by loading already filled ShapeAnalisis_Wire with method Load
uses
Surface from Geom,
Face from TopoDS,
Vertex from TopoDS,
Wire from TopoDS,
Location from TopLoc,
WireData from ShapeExtend,
Status from ShapeExtend,
Wire from ShapeAnalysis,
WireOrder from ShapeAnalysis,
Edge from ShapeFix
is
Create returns Wire from ShapeFix;
---Purpose: Empty Constructor, creates clear object with default flags
Create (wire: Wire from TopoDS; face: Face from TopoDS; prec: Real)
returns Wire from ShapeFix;
---Purpose: Create new object with default flags and prepare it for use
-- (Loads analyzer with all the data for the wire and face)
--- Loading and extracting the wire and other working data:
ClearModes (me: mutable);
---Purpose: Sets all modes to default
ClearStatuses (me: mutable);
---Purpose: Clears all statuses
Init (me: mutable; wire: Wire from TopoDS;
face: Face from TopoDS; prec: Real);
---Purpose: Load analyzer with all the data for the wire and face
-- and drops all fixing statuses
Init (me: mutable; saw: Wire from ShapeAnalysis);
---Purpose: Load analyzer with all the data already prepared
-- and drops all fixing statuses
-- If analyzer contains face, there is no need to set it
-- by SetFace or SetSurface
Load (me: mutable; wire: Wire from TopoDS);
---Purpose: Load data for the wire, and drops all fixing statuses
---Note : It is necessary to set face or surface for the wire before fixes
Load (me: mutable; sbwd: WireData from ShapeExtend);
---Purpose: Load data for the wire, and drops all fixing statuses
---Note : It is necessary to set face or surface for the wire before fixes
SetFace (me: mutable; face: Face from TopoDS);
---C++: inline
---Purpose: Set working face for the wire
SetSurface (me: mutable; surf: Surface from Geom);
---C++: inline
---Purpose: Set surface for the wire
---Remark : This function creates new face and calls SetFace
SetSurface (me: mutable; surf: Surface from Geom;
loc: Location from TopLoc);
---C++: inline
---Purpose: Set surface for the wire
---Remark : This function creates new face and calls SetFace
SetPrecision (me: mutable; prec: Real) is redefined;
---Purpose: Set working precision (to root and to analyzer)
SetMaxTailAngle (me: mutable; theMaxTailAngle: Real);
---Purpose: Sets the maximal allowed angle of the tails in radians.
SetMaxTailWidth (me: mutable; theMaxTailWidth: Real);
---Purpose: Sets the maximal allowed width of the tails.
IsLoaded (me) returns Boolean;
---C++: inline
---Purpose: Tells if the wire is loaded
---Remark: returns myAnalyzer.IsLoadaed()
IsReady (me) returns Boolean;
---C++: inline
---Purpose: Tells if the wire and face are loaded
---Remark: returns myAnalyzer.IsReady()
NbEdges (me) returns Integer;
---Purpose: returns number of edges in the working wire
---Remark: returns myAnalyzer.NbEdges()
Wire (me) returns Wire from TopoDS;
---C++: inline
---Purpose: Makes the resulting Wire (by basic Brep_Builder)
---Remark: returns myAnalyzer.Wire()
WireAPIMake (me) returns Wire from TopoDS;
---C++: inline
---Purpose: Makes the resulting Wire (by BRepAPI_MakeWire)
---Remark: returns myAnalyzer.WireAPIMake()
Analyzer (me) returns Wire from ShapeAnalysis;
---Purpose: returns field Analyzer (working tool)
WireData (me) returns WireData from ShapeExtend;
---C++: inline
---C++: return const &
---Purpose: returns working wire
---Remark: calls Analyzer.WireData()
Face (me) returns Face from TopoDS;
---C++: inline
---C++: return const &
---Purpose: returns working face (Analyzer.Face())
--- Parameters:
ModifyTopologyMode (me: mutable) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether it is
-- allowed to modify topology of the wire during fixing
-- (adding/removing edges etc.)
---Use : This flag can be set to True for wire on separate (free) face.
-- It should be set to False if the wire is on face which is a part
-- of a shell.
---Default: False
ModifyGeometryMode (me: mutable) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether the Fix..()
-- methods are allowed to modify geometry of the edges and vertices
---Default: True
---Remark : Currently is not used
ModifyRemoveLoopMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether the Fix..()
-- methods are allowed to modify RemoveLoop of the edges
---Default: -1
---Remark : Currently is not used
ClosedWireMode (me: mutable) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether the wire
-- is to be closed (by calling methods like FixDegenerated()
-- and FixConnected() for last and first edges).
---Use : This flag should be set to False if wire is not a face boundary
-- but is a (not closed) curve on a face.
---Default: True
PreferencePCurveMode (me: mutable) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether the 2d (True)
-- representation of the wire is preferable over 3d one (in the
-- case of ambiguity in FixEdgeCurves).
---Default: True (means that 2d representation is preferable).
---Remark : Currently is not used
FixGapsByRangesMode (me: mutable) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether tool
-- tries to fix gaps first by changing curves ranges (i.e.
-- using intersection, extrema, projections) or not.
---Default: False (means that tool will only bend curves).
---Remark : Currently is not used
--- Flags:
--- Level: Public (API)
-- These flags are only used in Perform()
FixReorderMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixSmallMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixConnectedMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixEdgeCurvesMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixDegeneratedMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixSelfIntersectionMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixLackingMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixGaps3dMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixGaps2dMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag for corresponding Fix..() method
-- which defines whether this method will be called from the
-- method APIFix():
-- -1 default
-- 1 method will be called
-- 0 method will not be called
--- Level: Advanced:
-- These flags are only used in FixEdgeCurves() and FixSelfIntersection()
-- For FixEdgeCurves():
FixReversed2dMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixRemovePCurveMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixAddPCurveMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixRemoveCurve3dMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixAddCurve3dMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixSeamMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixShiftedMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixSameParameterMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixVertexToleranceMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
-- For FixSelfIntersection():
FixNotchedEdgesMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixSelfIntersectingEdgeMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixIntersectingEdgesMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
FixNonAdjacentIntersectingEdgesMode (me: mutable) returns Integer;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag for corresponding Fix..() method
-- which defines whether this method will be called from the
-- corresponding Fix..() method of the public level:
-- -1 default
-- 1 method will be called
-- 0 method will not be called
FixTailMode(me: mutable) returns Integer;
---C++: inline
---C++: return &
--- Fixing methods:
--- Level: Public (API)
Perform (me: mutable) returns Boolean;
---Purpose: This method performs all the available fixes.
-- If some fix is turned on or off explicitly by the Fix..Mode() flag,
-- this fix is either called or not depending on that flag.
-- Else (i.e. if flag is default) fix is called depending on the
-- situation: some fixes are not called or are limited if order of
-- edges in the wire is not OK, or depending on modes
--
-- The order of the fixes and default behaviour of Perform() are:
-- FixReorder
-- FixSmall (with lockvtx true if ! TopoMode or if wire is not ordered)
-- FixConnected (if wire is ordered)
-- FixEdgeCurves (without FixShifted if wire is not ordered)
-- FixDegenerated (if wire is ordered)
-- FixSelfIntersection (if wire is ordered and ClosedMode is True)
-- FixLacking (if wire is ordered)
--
---Returns: False if nothing done, else True
-- Use methods Status...() to investigate the results of calls to the
-- each fixing method. All statuses are dropped at the start of Perform().
FixReorder (me: mutable) returns Boolean;
---Purpose: Performs an analysis and reorders edges in the wire using
-- class WireOrder
---Returns: False if nothing to do, True if some edges were reordered
---Status : See StatusReorder() for details
-- FAIL1 - ShapeAnalysis_WireOrder has detected several loops
-- FAIL2 - ShapeAnalysis_WireOrder failed (result is incorrect)
-- DONE1 - Reorder done OK
-- DONE2 - in addition to DONE1 - some gaps remain
-- DONE3 - in addition to DONE1 - some edges were reversed
FixSmall (me: mutable; lockvtx: Boolean; precsmall: Real = 0.0)
returns Integer;
---Purpose: Applies FixSmall(num) to all edges in the wire
---Returns: True if some edges were removed, else False
---Status : See StatusSmall() for details
-- OK : Edge is not null-length
-- DONE1: Edge is null-length and has the same vertices at begin
-- and end; removed
-- DONE2: (only if lockvtx is False and ModifyTopologyMode is True)
-- Edge is null-length and has different vertices at begin and end;
-- edge removed, and CheckConnected called for adjacent edges
-- FAIL1: Edge cannot be checked (no 3d curve and no pcurve)
-- FAIL2: Edge is null-length and has different vertices at begin
-- and end, and lockvtx is True or ModifyTopologyMode is False;
-- edge is not removed
-- FAIL3: In the case of DONE2, CheckConnected has failed
FixConnected (me: mutable; prec: Real = -1.0) returns Boolean;
---Purpose: Applies FixConnected(num) to all edges in the wire
-- Connection between first and last edges is treated only if
-- flag ClosedMode is True
-- If <prec> is -1 then MaxTolerance() is taken.
---Returns: True if some vertices were replaced, False if OK or fail
---Status : See StatusConnected() for details
-- OK : If they are already the same, nothing done
-- DONE1: Absolutely confused (gp::Resolution), set the same
-- DONE2: Confused with Analyzer.Precision(), set the same
-- DONE3: Confused with <prec> but not Analyzer.Precision(), set the same
-- FAIL1: Not confused neither with prec nor Analyzer.Precision()
FixEdgeCurves (me: mutable) returns Boolean;
---Purpose: Groups the fixes dealing with 3d and pcurves of the edges.
-- The order of the fixes and the default behaviour are:
-- ShapeFix_Edge::FixReversed2d
-- ShapeFix_Edge::FixRemovePCurve (only if forced)
-- ShapeFix_Edge::FixAddPCurve
-- ShapeFix_Edge::FixRemoveCurve3d (only if forced)
-- ShapeFix_Edge::FixAddCurve3d
-- FixSeam,
-- FixShifted,
-- ShapeFix_Edge::FixSameParameter
---Returns: False if nothing done, else True
---Status : See StatusEdgeCurves() for details
-- OK - no problem was detected, nothing fixed
-- DONE1, FAIL1 - FixReversed2d was fixed and/or failed
-- DONE2, FAIL2 - FixRemovePCurve was fixed and/or failed
-- DONE3, FAIL3 - FixAddPCurve was fixed and/or failed
-- DONE4, FAIL4 - FixRemoveCurve3d was fixed and/or failed
-- DONE5, FAIL5 - FixAddCurve3d was fixed and/or failed
-- DONE6, FAIL6 - FixSeam was fixed and/or failed
-- DONE7, FAIL7 - FixShifted was fixed and/or failed
-- DONE8, FAIL8 - FixSameParameter or FixVertexTolerance were fixed and/or failed
FixDegenerated (me: mutable) returns Boolean;
---Purpose: Applies FixDegenerated(num) to all edges in the wire
-- Connection between first and last edges is treated only if
-- flag ClosedMode is True
---Returns: True if at least one degenerated edge was fixed or added
---Status : See StatusDegenerated() for details
-- OK : Nothing done
-- FAIL1: Analysis has failed
-- DONE1: New degenerated edge was added
-- DONE2: Edge <num> was made degenerated
FixSelfIntersection ( me: mutable ) returns Boolean;
---Purpose: Applies FixSelfIntersectingEdge(num) and
-- FixIntersectingEdges(num) to all edges in the wire and
-- FixIntersectingEdges(num1, num2) for all pairs num1 and num2
-- such that num2 >= num1 + 2
-- and removes wrong edges if any
---Returns: True if something was fixed, else False
---Status : See StatusSelfIntersection() for details
-- OK : No intersection found
-- FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
-- FAIL2: self-intersection was found, but not fixed because of
-- limit of increasing tolerance (MaxTolerance)
-- FAIL3: intercestion of non adjacent edges found, but not fixed
-- because of limit of increasing tolerance (MaxTolerance)
-- DONE1: tolerance of vertex was increased to fix self-intersection
-- DONE2: vertex was moved to fix self-intersection
-- DONE3: some edges were removed because of intersection
-- DONE4: pcurve(s) was(were) modified
-- DONE5: non adjacent intersection fixed by increasing tolerance of
-- vertex(vertices)
-- DONE6: tolerance of edge was increased to hide intersection
-- DONE7: range of some edges was decreased to avoid intersection
FixLacking (me: mutable; force: Boolean = Standard_False) returns Boolean;
---Purpose: Applies FixLacking(num) to all edges in the wire
-- Connection between first and last edges is treated only if
-- flag ClosedMode is True
-- If <force> is False (default), test for connectness is done with
-- precision of vertex between edges, else it is done with minimal
-- value of vertex tolerance and Analyzer.Precision().
-- Hence, <force> will lead to inserting lacking edges in replacement
-- of vertices which have big tolerances.
---Returns: True if lacking edge was fixed, else False.
---Status : See StatusLacking() for more details
-- OK : No problems detected
-- FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
-- FAIL2: lacking edge not fixed because of
-- limit of increasing tolerance (MaxTolerance)
-- FAIL3: failed to build lacking edge (3d curve)
-- DONE1: tolerance was increased to fix lacking edge
-- DONE2: lacking edge was inserted
FixClosed (me: mutable; prec: Real = -1.0) returns Boolean;
---Purpose: Fixes a wire to be well closed
-- It performs FixConnected, FixDegenerated and FixLacking between
-- last and first edges (independingly on flag ClosedMode and modes
-- for these fixings)
-- If <prec> is -1 then MaxTolerance() is taken.
---Returns: False if nothing done, else True
---Status : See StatusClosed() for details
-- OK - no problem was detected, nothing fixed
-- DONE1, FAIL1 - FixConnected was fixed and/or failed
-- DONE2, FAIL2 - FixDegenerated was fixed and/or failed
-- DONE3, FAIL3 - FixLacking was fixed and/or failed
FixGaps3d (me: mutable) returns Boolean;
---Purpose: Fixes gaps between ends of 3d curves on adjacent edges
-- myPrecision is used to detect the gaps.
---Returns: False if nothing done, else True
---Status : See StatusGaps3d() for details
-- OK - no problem was detected, nothing fixed
-- DONE1 - Some gaps in 3d were found and fixed
-- FAIL1 - There was no 3d curve found on some edges
-- FAIL2 - Method failed to fix some gaps
FixGaps2d (me: mutable) returns Boolean;
---Purpose: Fixes gaps between ends of pcurves on adjacent edges
-- myPrecision is used to detect the gaps.
---Returns: False if nothing done, else True
---Status : See StatusGaps2d() for details
-- OK - no problem was detected, nothing fixed
-- DONE1 - Some gaps in 2d were found and fixed
-- FAIL1 - There was no pcurve found on some edges
-- FAIL2 - Method failed to fix some gaps
--- Level: Advanced
---Status: For analyzing the status of the last performed method use
-- LastFixStatus(status)
--
-- All the Fix.. methods below return False if the problem was not
-- fixed, in this case LastFixStatus contains either FAIL or OK.
-- If a method returns True the LastFixStatus contains DONE,
-- this means that some fix was made
-- For detailed meaning of Status see corresponding method.
FixReorder (me: mutable; wi: in WireOrder from ShapeAnalysis) returns Boolean;
---Purpose: Reorder edges in the wire as determined by WireOrder
-- that should be filled and computed before
---Returns: False if nothing to do, True if some edges were reordered
---Status : See LastFixStatus() for details
-- OK - edges are ordered well
-- FAIL1 - WireOrder has detected several loops
-- FAIL2 - WireOrder is incorrect (wrong number of edges)
-- FAIL3 - WireOrder is incorrect
-- DONE1 - reorder was performed successfully
FixSmall (me: mutable; num: Integer; lockvtx: Boolean; precsmall: Real)
returns Boolean;
---Purpose: Fixes Null Length Edge to be removed
-- If an Edge has Null Length (regarding preci, or <precsmall>
-- - what is smaller), it should be removed
-- It can be with no problem if its two vertices are the same
-- Else, if lockvtx is False, it is removed and its end vertex
-- is put on the preceeding edge
-- But if lockvtx is True, this edge must be kept ...
---Use : Is to be used in the case if some edges can be too short, and
-- should be removed (hence, if topology of the wire can be modified).
-- It is recommended to call this method before FixIntersection()
--
---Returns: True if null edge was removed, False if nothing done
---Status : See LastFixStatus() for details
-- OK : Edge is not null-length
-- DONE1: Edge is null-length and has the same vertices at begin
-- and end; removed
-- DONE2: (only if lockvtx is False and ModifyTopologyMode is True)
-- Edge is null-length and has different vertices at begin and end;
-- edge removed, and CheckConnected called for adjacent edges
-- FAIL1: Edge cannot be checked (no 3d curve and no pcurve)
-- FAIL2: Edge is null-length and has different vertices at begin
-- and end, and lockvtx is True or ModifyTopologyMode is False;
-- edge is not removed
-- FAIL3: In the case of DONE2, CheckConnected has failed
FixConnected (me: mutable; num: Integer; prec: Real)
returns Boolean;
---Purpose: Fixes connected edges (preceeding and current)
-- Forces Vertices (end of preceeding-begin of current) to be
-- the same one
-- Tests with starting preci or, if given greater, <prec>
-- If <prec> is -1 then MaxTolerance() is taken.
--
---Use : It is to be used if two consequent edges in the wire have not
-- the same common vertex, e.g., if wire was constructed from
-- not connected edges or some operations like adding/removing an
-- edge were done.
-- While it may change vertices, it should not be
-- called in cases when vertices may not be changed ...
--
---Remark : Replacement of vertices in the edges is made by copying these edges
--
---Returns: False if edges are already connected (vertices are the same) or if
-- it is not possible to perform fix (edges have a gap more than <prec>);
-- True if disconnected situation was fixed by producing a new Vertex
-- at the middle of the former ones.
---Status:
-- OK : If they are already the same, nothing done
-- DONE1: Absolutely confused (gp::Resolution), set the same
-- DONE2: Confused with Analyzer.Precision(), set the same
-- DONE3: Confused with <prec> but not Analyzer.Precision(), set the same
-- FAIL1: Not confused neither with prec nor Analyzer.Precision()
FixSeam (me: mutable; num: Integer) returns Boolean;
---Purpose: Fixes a seam edge
-- A Seam edge has two pcurves, one for forward. one for reversed
-- The forward pcurve must be set as first
--
-- NOTE that correct order of pcurves in the seam edge depends on
-- its orientation (i.e., on orientation of the wire, method of
-- exploration of edges etc.).
-- Since wire represented by the ShapeExtend_WireData is always forward
-- (orientation is accounted by edges), it will work correct if:
-- 1. Wire created from ShapeExtend_WireData with methods
-- ShapeExtend_WireData::Wire..() is added into the FORWARD face
-- (orientation can be applied later)
-- 2. Wire is extracted from the face with orientation not composed
-- with orientation of the face
--
---Use : This operation should be called after reversing the wire if it
-- contains seam edges.
--
---Returns: True if edge is a seam and its curves were fixed (reordered), else False
---Status : See StatusSeam() for details
-- OK - edge is not a seam or has pcurves OK
-- DONE1 - seam pcurves were fixed
FixShifted (me: mutable) returns Boolean;
---Purpose: Fixes edges which have pcurves shifted by whole parameter
-- range on the closed surface (the case may occur if pcurve
-- of edge was computed by projecting 3d curve, which goes
-- along the seam).
-- It compares each two consequent edges and tries to connect them
-- if distance between ends is near to range of the surface.
-- It also can detect and fix the case if all pcurves are connected,
-- but lie out of parametric bounds of the surface.
-- In addition to FixShifted from ShapeFix_Wire, more
-- sophisticated check of degenerate points is performed,
-- and special cases like sphere given by two meridians
-- are treated.
---Use : Is to be used if some pcurves were recomputed.
-- It is recommended to use it before FixDegenerated.
---Returns: False if nothing done, else True
---Status : See StatusShifted() for details
-- OK: If pcurves are OK
-- FAIL1: some pcurves are missing
-- DONE1: some pcurves were shifted in order to ensure connection
-- between edges
-- DONE2: all pcurves were shifted in order to be in the parametric
-- range of a surface
FixDegenerated (me: mutable; num: Integer) returns Boolean;
---Purpose: Fixes Degenerated Edge
-- Checks an <num-th> edge or a point between <num>th-1 and <num>th
-- edges for a singularity on a supporting surface.
-- If singularity is detected, either adds new degenerated edge
-- (before <num>th), or makes <num>th edge to be degenerated.
---Use : It is to be called for faces which lie on surfaces with
-- singularities.
-- It should be called after all pcurves are correctly computed.
---Returns: False if nothing done, else True
---Status : See LastFixStatus() for details
-- OK : Nothing done
-- FAIL1: Analysis has failed
-- DONE1: New degenerated edge was added
-- DONE2: Edge <num> was made degenerated
-- DONE3: Edge <num> was incorrectly coded as degenerated, removed
FixSelfIntersectingEdge ( me: mutable; num: Integer )
returns Boolean is private;
---Purpose: Detect and fix self-intersecting pcurve of edge <num>.
-- Fix is made by one of two methods:
-- - cut out the self-intersection loop on pcurve (thus
-- producing C0 pcurve). This also increases tolerance of edge
-- in order to satisfy SameParameter requirement.
-- - increase tolerance of the vertex of edge nearest to the
-- self-intersection point so that it comprises that point.
-- The first method is considered only if ModifyGeometryMode
-- is True. In that case, the method which requires less
-- increasing of tolerance is selected.
---Returns: True if it was done, else False
---Status : See LastFixStatus() for details
-- OK : Edge is not self-intersecting
-- FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
-- FAIL2: self-intersection was found, but not fixed because of
-- limit of increasing tolerance (MaxTolerance)
-- DONE1: tolerance was increased to fix self-intersection
-- DONE4: pcurve was modified (self-intersection loop cutted out)
FixIntersectingEdges ( me: mutable; num: Integer )
returns Boolean is private;
---Purpose: Test if two consequent edges are intersecting and fix it
-- by increasing of tolerance of vertex between edges,
-- shifting this vertex to the point of intersection,
-- cutting edges to the intersection point.
-- It also can give signal to remove edge if it whole is cut by
-- intersection (if flag ModifyTopologyMode is set).
--
---Returns: False if nothing done, True if something was fixed.
---Status : See LastFixStatus() for details
-- OK : No intersection found
-- FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
-- FAIL2: self-intersection was found, but not fixed because of
-- limit of increasing tolerance (MaxTolerance)
-- DONE1: tolerance was increased to fix self-intersection
-- DONE2: vertex was moved to fix self-intersection
-- DONE3: previous or
-- DONE4: current edge should be removed because of intersection
-- DONE6: tolerance of edge was increased to hide intersection
-- DONE7: range of some edges was decreased to avoid intersection
FixIntersectingEdges (me: mutable; num1 : Integer;
num2 : Integer)
returns Boolean is private;
---Purpose: Tests if two edges <num1> and <num2> are intersecting and
-- fix intersection by increasing of tolerance of vertex
-- nearest to the point of intersection.
--
---Returns: False if nothing done, True if something was fixed.
---Status : See LastFixStatus() for details
-- OK : No intersection found
-- FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
-- FAIL2: self-intersection was found, but not fixed because of
-- limit of increasing tolerance (MaxTolerance)
-- DONE1: tolerance was increased to fix self-intersection
FixLacking ( me: mutable; num: Integer; force: Boolean = Standard_False )
returns Boolean;
---Purpose: Fixes Lacking Edge
-- Test if two adjucent edges are disconnected in 2d (while
-- connected in 3d), and in that case either increase tolerance
-- of the vertex or add a new edge (straight in 2d space), in
-- order to close wire in 2d.
-- Returns True if edge was added or tolerance was increased.
---Algorithm:
-- 1. Compute the 2d gap between edges and calculate a tolerance
-- which should have vertex in order to comprise the gap
-- (using GeomAdaptor_Surface); computed value is inctol
-- 2. If inctol < tol of vertex, return False (everything is OK)
-- 3. If inctol < Precision, just increase tolerance of vertex to inctol
-- 4. Else (if both edges are not degenerated) try to add new edge
-- with straight pcurve (in order to close the gap):
-- a) if flag MayEdit is False
-- 1. if inctol < MaxTolerance, increase tolerance of vertex to inctol
-- 2. else try to add degenerated edge (check that middle point of
-- that pcurve is inside the vertex)
-- b) if MayEdit is True
-- 1. try to replace big vertex with two new small vertices
-- connected by new edge. This is made if there is a 3d space
-- between ends of adjacent edges.
-- 2. if inctol < MaxTolerance, increase tolerance of vertex to inctol
-- 3. else add either degenerated or closed edge (if middle point
-- of a pcurve of a new edge is inside the vertex, then
-- degenerated edge is added, else new edge is closed).
-- 5. If new edge cannot be added, but inctol < MaxTolerance,
-- when increase tolerance of vertex to a value of inctol
--
---Use : This method should be used after all pcurves in the wire are
-- correctly computed. It is not recommended to use this method
-- after FixDegenerated() and before FixSelfIntersection().
--
---Returns: False if nothing done, else True.
---Status : See LastFixStatus() for more details
-- OK : If nothing done
-- FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
-- FAIL2: lacking edge not fixed because of
-- limit of increasing tolerance (MaxTolerance)
-- FAIL3: failed to build lacking edge (3d curve)
-- DONE1: tolerance was increased to fix lacking edge
-- DONE2: lacking edge was inserted
-- DONE3: (in addition to DONE2) inserted edge is degenerated
-- DONE4: (in addition to DONE2) inserted edge is closed
-- DONE5: pcurves of edges were bent (only if ModifyGeometry is True)
FixNotchedEdges(me: mutable) returns Boolean;
FixDummySeam(me: mutable; num: Integer) is private;
FixGap3d ( me: mutable; num: Integer; convert: Boolean = Standard_False )
returns Boolean;
---Purpose: Fixes gap between ends of 3d curves on num-1 and num-th edges.
-- myPrecision is used to detect the gap.
-- If convert is True, converts curves to bsplines to bend.
---Algorithm:
---Returns: False if nothing done, else True
---Status : See StatusGaps3d() for details
-- OK - no problem was detected, nothing fixed
-- DONE1 - A gap in 3d were found and fixed
-- FAIL1 - There was no 3d curve found on some edge
-- FAIL2 - Method failed to fix the gap
FixGap2d ( me: mutable; num: Integer; convert: Boolean = Standard_False )
returns Boolean;
---Purpose: Fixes gap between ends of pcurves on num-1 and num-th edges.
-- myPrecision is used to detect the gap.
-- If convert is True, converts pcurves to bsplines to bend.
---Algorithm:
---Returns: False if nothing done, else True
---Status : See StatusGaps2d() for details
-- OK - no problem was detected, nothing fixed
-- DONE1 - A gap in 2d were found and fixed
-- FAIL1 - There was no pcurve found on some edge
-- FAIL2 - Method failed to fix the gap
FixTails(me: mutable) returns Boolean;
--- Result of fixes:
StatusReorder (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusSmall (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusConnected (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusEdgeCurves (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusDegenerated (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusSelfIntersection (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusLacking (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusClosed (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusGaps3d (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusGaps2d (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusNotches (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusRemovedSegment (me) returns Boolean;
---C++: inline
---Purpose: Querying the status of perfomed API fixing procedures
-- Each Status..() methods gives information about the last call to
-- the corresponding Fix..() method of API level:
-- OK : no problems detected; nothing done
-- DONE: some problem(s) was(were) detected and successfully fixed
-- FAIL: some problem(s) cannot be fixed
---Level : Public (API)
StatusFixTails(me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
LastFixStatus (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
---Purpose: Queries the status of last call to methods Fix... of
-- advanced level
-- For details see corresponding methods; universal statuses are:
-- OK : problem not detected; nothing done
-- DONE: problem was detected and successfully fixed
-- FAIL: problem cannot be fixed
---Level : Advanced
FixEdgeTool (me) returns Edge from ShapeFix;
---Purpose: Returns tool for fixing wires.
---C++: inline
UpdateWire (me: mutable) is protected;
---Purpose: Updates WireData if some replacements are made
-- This is necessary for wires (unlike other shape types)
-- since one edge can present in wire several times
fields
myFixEdge : Edge from ShapeFix is protected;
myAnalyzer: Wire from ShapeAnalysis is protected; -- working analyzer
myGeomMode: Boolean is protected; -- may change geometry
myTopoMode: Boolean is protected; -- may change topology
myClosedMode: Boolean is protected; -- should wire be closed?
myPreference2d: Boolean is protected; -- is 2d representation of edge preferred
myFixGapsByRanges: Boolean is protected; -- try to fix gaps by changing curves ranges
myFixReversed2dMode: Integer is protected;
myFixRemovePCurveMode: Integer is protected;
myFixAddPCurveMode: Integer is protected;
myFixRemoveCurve3dMode: Integer is protected;
myFixAddCurve3dMode: Integer is protected;
myFixSeamMode: Integer is protected;
myFixShiftedMode: Integer is protected;
myFixSameParameterMode: Integer is protected;
myFixVertexToleranceMode: Integer is protected;
myFixNotchedEdgesMode: Integer is protected;
myFixSelfIntersectingEdgeMode: Integer is protected;
myFixIntersectingEdgesMode: Integer is protected;
myFixNonAdjacentIntersectingEdgesMode: Integer is protected;
myFixTailMode: Integer is protected;
myRemoveLoopMode: Integer is protected;
-- -1 - old variant (default)
-- 0 - try remove both 2d loop and 3d loop
-- 1 - try insert new vertex
myFixReorderMode: Integer is protected;
myFixSmallMode: Integer is protected;
myFixConnectedMode: Integer is protected;
myFixEdgeCurvesMode: Integer is protected;
myFixDegeneratedMode: Integer is protected;
myFixSelfIntersectionMode: Integer is protected;
myFixLackingMode: Integer is protected;
myFixGaps3dMode: Integer is protected;
myFixGaps2dMode: Integer is protected;
myLastFixStatus: Integer is protected; -- status of last fix of advanced level
-- statuses corresponding to API methods, queried by Status..(status) methods
myStatusReorder: Integer is protected;
myStatusSmall: Integer is protected;
myStatusConnected: Integer is protected;
myStatusEdgeCurves: Integer is protected;
myStatusDegenerated: Integer is protected;
myStatusClosed: Integer is protected;
myStatusSelfIntersection: Integer is protected;
myStatusLacking: Integer is protected;
myStatusGaps3d: Integer is protected;
myStatusGaps2d: Integer is protected;
myStatusRemovedSegment: Boolean is protected;
myStatusNotches: Integer is protected;
myStatusFixTails: Integer is protected;
myMaxTailAngleSine: Real is protected;
myMaxTailWidth: Real is protected;
end Wire;

View File

@@ -43,93 +43,89 @@
// one pcurve we make replace pcurve)
// PTV 26.06.2002 Remove regressions after fix OCC450
#include <ShapeFix_Wire.ixx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <Precision.hxx>
#include <Geom_Curve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_SphericalSurface.hxx> //S4135
#include <Geom_SurfaceOfRevolution.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <GeomAPI.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dConvert.hxx>
#include <Bnd_Box2d.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Bnd_Array1OfBox2d.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <IntRes2d_SequenceOfIntersectionPoint.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <gp_Pln.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepTools.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom2dConvert.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_OffsetCurve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomAPI.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <gp_Pln.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_SequenceOfIntersectionPoint.hxx>
#include <Message_Msg.hxx>
#include <ShapeExtend.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_Vertex.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <Geom_Plane.hxx>
#include <Geom_OffsetCurve.hxx>
#include <TColStd_HSequenceOfReal.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <ShapeAnalysis_TransferParameters.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeBuild_Vertex.hxx>
#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
#include <ShapeExtend.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_IntersectionTool.hxx>
#include <ShapeFix_SplitTool.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeFix_Wire.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Type.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_HSequenceOfReal.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
//S4135
//#######################################################################
// Constructors, initializations, modes, querying
//#######################################################################
//=======================================================================
//function : ShapeFix_Wire
//purpose :
//=======================================================================
ShapeFix_Wire::ShapeFix_Wire() : myMaxTailAngleSine(0), myMaxTailWidth(-1)
{
myFixEdge = new ShapeFix_Edge;

View File

@@ -0,0 +1,557 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_Wire_HeaderFile
#define _ShapeFix_Wire_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <ShapeFix_Root.hxx>
#include <TopoDS_Wire.hxx>
#include <ShapeExtend_Status.hxx>
class ShapeFix_Edge;
class ShapeAnalysis_Wire;
class TopoDS_Wire;
class TopoDS_Face;
class ShapeExtend_WireData;
class Geom_Surface;
class TopLoc_Location;
class ShapeAnalysis_WireOrder;
class ShapeFix_Wire;
DEFINE_STANDARD_HANDLE(ShapeFix_Wire, ShapeFix_Root)
//! This class provides a set of tools for repairing a wire.
//!
//! These are methods Fix...(), organised in two levels:
//!
//! Level 1: Advanced - each method in this level fixes one separate problem,
//! usually dealing with either single edge or connection of the
//! two adjacent edges. These methods should be used carefully and
//! called in right sequence, because some of them depend on others.
//!
//! Level 2: Public (API) - methods which group several methods of level 1
//! and call them in a proper sequence in order to make some
//! consistent set of fixes for a whole wire. It is possible to
//! control calls to methods of the advanced level from methods of
//! the public level by use of flags Fix..Mode() (see below).
//!
//! Fixes can be made in three ways:
//! 1. Increasing tolerance of an edge or a vertex
//! 2. Changing topology (adding/removing/replacing edge in the wire
//! and/or replacing the vertex in the edge)
//! 3. Changing geometry (shifting vertex or adjusting ends of edge
//! curve to vertices, or recomputing curves of the edge)
//!
//! When fix can be made in more than one way (e.g., either
//! by increasing tolerance or shifting a vertex), it is choosen
//! according to the flags:
//! ModifyTopologyMode - allows modification of the topology.
//! This flag can be set when fixing a wire on
//! the separate (free) face, and should be
//! unset for face which is part of shell.
//! ModifyGeometryMode - allows modification of the geometry.
//!
//! The order of descriptions of Fix() methods in this CDL
//! approximately corresponds to the optimal order of calls.
//!
//! NOTE: most of fixing methods expect edges in the
//! ShapeExtend_WireData to be ordered, so it is necessary to make
//! call to FixReorder() before any other fixes
//!
//! ShapeFix_Wire should be initialized prior to any fix by the
//! following data:
//! a) Wire (ether TopoDS_Wire or ShapeExtend_Wire)
//! b) Face or surface
//! c) Precision
//! d) Maximal tail angle and width
//! This can be done either by calling corresponding methods
//! (LoadWire, SetFace or SetSurface, SetPrecision, SetMaxTailAngle
//! and SetMaxTailWidth), or
//! by loading already filled ShapeAnalisis_Wire with method Load
class ShapeFix_Wire : public ShapeFix_Root
{
public:
//! Empty Constructor, creates clear object with default flags
Standard_EXPORT ShapeFix_Wire();
//! Create new object with default flags and prepare it for use
//! (Loads analyzer with all the data for the wire and face)
Standard_EXPORT ShapeFix_Wire(const TopoDS_Wire& wire, const TopoDS_Face& face, const Standard_Real prec);
//! Sets all modes to default
Standard_EXPORT void ClearModes();
//! Clears all statuses
Standard_EXPORT void ClearStatuses();
//! Load analyzer with all the data for the wire and face
//! and drops all fixing statuses
Standard_EXPORT void Init (const TopoDS_Wire& wire, const TopoDS_Face& face, const Standard_Real prec);
//! Load analyzer with all the data already prepared
//! and drops all fixing statuses
//! If analyzer contains face, there is no need to set it
//! by SetFace or SetSurface
Standard_EXPORT void Init (const Handle(ShapeAnalysis_Wire)& saw);
//! Load data for the wire, and drops all fixing statuses
Standard_EXPORT void Load (const TopoDS_Wire& wire);
//! Load data for the wire, and drops all fixing statuses
Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd);
//! Set working face for the wire
void SetFace (const TopoDS_Face& face);
//! Set surface for the wire
void SetSurface (const Handle(Geom_Surface)& surf);
//! Set surface for the wire
void SetSurface (const Handle(Geom_Surface)& surf, const TopLoc_Location& loc);
//! Set working precision (to root and to analyzer)
Standard_EXPORT virtual void SetPrecision (const Standard_Real prec) Standard_OVERRIDE;
//! Sets the maximal allowed angle of the tails in radians.
Standard_EXPORT void SetMaxTailAngle (const Standard_Real theMaxTailAngle);
//! Sets the maximal allowed width of the tails.
Standard_EXPORT void SetMaxTailWidth (const Standard_Real theMaxTailWidth);
//! Tells if the wire is loaded
Standard_Boolean IsLoaded() const;
//! Tells if the wire and face are loaded
Standard_Boolean IsReady() const;
//! returns number of edges in the working wire
Standard_EXPORT Standard_Integer NbEdges() const;
//! Makes the resulting Wire (by basic Brep_Builder)
TopoDS_Wire Wire() const;
//! Makes the resulting Wire (by BRepAPI_MakeWire)
TopoDS_Wire WireAPIMake() const;
//! returns field Analyzer (working tool)
Standard_EXPORT Handle(ShapeAnalysis_Wire) Analyzer() const;
//! returns working wire
const Handle(ShapeExtend_WireData)& WireData() const;
//! returns working face (Analyzer.Face())
const TopoDS_Face& Face() const;
//! Returns (modifiable) the flag which defines whether it is
//! allowed to modify topology of the wire during fixing
//! (adding/removing edges etc.)
Standard_Boolean& ModifyTopologyMode();
//! Returns (modifiable) the flag which defines whether the Fix..()
//! methods are allowed to modify geometry of the edges and vertices
Standard_Boolean& ModifyGeometryMode();
//! Returns (modifiable) the flag which defines whether the Fix..()
//! methods are allowed to modify RemoveLoop of the edges
Standard_Integer& ModifyRemoveLoopMode();
//! Returns (modifiable) the flag which defines whether the wire
//! is to be closed (by calling methods like FixDegenerated()
//! and FixConnected() for last and first edges).
Standard_Boolean& ClosedWireMode();
//! Returns (modifiable) the flag which defines whether the 2d (True)
//! representation of the wire is preferable over 3d one (in the
//! case of ambiguity in FixEdgeCurves).
Standard_Boolean& PreferencePCurveMode();
//! Returns (modifiable) the flag which defines whether tool
//! tries to fix gaps first by changing curves ranges (i.e.
//! using intersection, extrema, projections) or not.
Standard_Boolean& FixGapsByRangesMode();
Standard_Integer& FixReorderMode();
Standard_Integer& FixSmallMode();
Standard_Integer& FixConnectedMode();
Standard_Integer& FixEdgeCurvesMode();
Standard_Integer& FixDegeneratedMode();
Standard_Integer& FixSelfIntersectionMode();
Standard_Integer& FixLackingMode();
Standard_Integer& FixGaps3dMode();
//! Returns (modifiable) the flag for corresponding Fix..() method
//! which defines whether this method will be called from the
//! method APIFix():
//! -1 default
//! 1 method will be called
//! 0 method will not be called
Standard_Integer& FixGaps2dMode();
Standard_Integer& FixReversed2dMode();
Standard_Integer& FixRemovePCurveMode();
Standard_Integer& FixAddPCurveMode();
Standard_Integer& FixRemoveCurve3dMode();
Standard_Integer& FixAddCurve3dMode();
Standard_Integer& FixSeamMode();
Standard_Integer& FixShiftedMode();
Standard_Integer& FixSameParameterMode();
Standard_Integer& FixVertexToleranceMode();
Standard_Integer& FixNotchedEdgesMode();
Standard_Integer& FixSelfIntersectingEdgeMode();
Standard_Integer& FixIntersectingEdgesMode();
//! Returns (modifiable) the flag for corresponding Fix..() method
//! which defines whether this method will be called from the
//! corresponding Fix..() method of the public level:
//! -1 default
//! 1 method will be called
//! 0 method will not be called
Standard_Integer& FixNonAdjacentIntersectingEdgesMode();
Standard_Integer& FixTailMode();
//! This method performs all the available fixes.
//! If some fix is turned on or off explicitly by the Fix..Mode() flag,
//! this fix is either called or not depending on that flag.
//! Else (i.e. if flag is default) fix is called depending on the
//! situation: some fixes are not called or are limited if order of
//! edges in the wire is not OK, or depending on modes
//!
//! The order of the fixes and default behaviour of Perform() are:
//! FixReorder
//! FixSmall (with lockvtx true if ! TopoMode or if wire is not ordered)
//! FixConnected (if wire is ordered)
//! FixEdgeCurves (without FixShifted if wire is not ordered)
//! FixDegenerated (if wire is ordered)
//! FixSelfIntersection (if wire is ordered and ClosedMode is True)
//! FixLacking (if wire is ordered)
Standard_EXPORT Standard_Boolean Perform();
//! Performs an analysis and reorders edges in the wire using
//! class WireOrder
Standard_EXPORT Standard_Boolean FixReorder();
//! Applies FixSmall(num) to all edges in the wire
Standard_EXPORT Standard_Integer FixSmall (const Standard_Boolean lockvtx, const Standard_Real precsmall = 0.0);
//! Applies FixConnected(num) to all edges in the wire
//! Connection between first and last edges is treated only if
//! flag ClosedMode is True
//! If <prec> is -1 then MaxTolerance() is taken.
Standard_EXPORT Standard_Boolean FixConnected (const Standard_Real prec = -1.0);
//! Groups the fixes dealing with 3d and pcurves of the edges.
//! The order of the fixes and the default behaviour are:
//! ShapeFix_Edge::FixReversed2d
//! ShapeFix_Edge::FixRemovePCurve (only if forced)
//! ShapeFix_Edge::FixAddPCurve
//! ShapeFix_Edge::FixRemoveCurve3d (only if forced)
//! ShapeFix_Edge::FixAddCurve3d
//! FixSeam,
//! FixShifted,
//! ShapeFix_Edge::FixSameParameter
Standard_EXPORT Standard_Boolean FixEdgeCurves();
//! Applies FixDegenerated(num) to all edges in the wire
//! Connection between first and last edges is treated only if
//! flag ClosedMode is True
Standard_EXPORT Standard_Boolean FixDegenerated();
//! Applies FixSelfIntersectingEdge(num) and
//! FixIntersectingEdges(num) to all edges in the wire and
//! FixIntersectingEdges(num1, num2) for all pairs num1 and num2
//! such that num2 >= num1 + 2
//! and removes wrong edges if any
Standard_EXPORT Standard_Boolean FixSelfIntersection();
//! Applies FixLacking(num) to all edges in the wire
//! Connection between first and last edges is treated only if
//! flag ClosedMode is True
//! If <force> is False (default), test for connectness is done with
//! precision of vertex between edges, else it is done with minimal
//! value of vertex tolerance and Analyzer.Precision().
//! Hence, <force> will lead to inserting lacking edges in replacement
//! of vertices which have big tolerances.
Standard_EXPORT Standard_Boolean FixLacking (const Standard_Boolean force = Standard_False);
//! Fixes a wire to be well closed
//! It performs FixConnected, FixDegenerated and FixLacking between
//! last and first edges (independingly on flag ClosedMode and modes
//! for these fixings)
//! If <prec> is -1 then MaxTolerance() is taken.
Standard_EXPORT Standard_Boolean FixClosed (const Standard_Real prec = -1.0);
//! Fixes gaps between ends of 3d curves on adjacent edges
//! myPrecision is used to detect the gaps.
Standard_EXPORT Standard_Boolean FixGaps3d();
//! Fixes gaps between ends of pcurves on adjacent edges
//! myPrecision is used to detect the gaps.
Standard_EXPORT Standard_Boolean FixGaps2d();
//! Reorder edges in the wire as determined by WireOrder
//! that should be filled and computed before
Standard_EXPORT Standard_Boolean FixReorder (const ShapeAnalysis_WireOrder& wi);
//! Fixes Null Length Edge to be removed
//! If an Edge has Null Length (regarding preci, or <precsmall>
//! - what is smaller), it should be removed
//! It can be with no problem if its two vertices are the same
//! Else, if lockvtx is False, it is removed and its end vertex
//! is put on the preceeding edge
//! But if lockvtx is True, this edge must be kept ...
Standard_EXPORT Standard_Boolean FixSmall (const Standard_Integer num, const Standard_Boolean lockvtx, const Standard_Real precsmall);
//! Fixes connected edges (preceeding and current)
//! Forces Vertices (end of preceeding-begin of current) to be
//! the same one
//! Tests with starting preci or, if given greater, <prec>
//! If <prec> is -1 then MaxTolerance() is taken.
Standard_EXPORT Standard_Boolean FixConnected (const Standard_Integer num, const Standard_Real prec);
//! Fixes a seam edge
//! A Seam edge has two pcurves, one for forward. one for reversed
//! The forward pcurve must be set as first
//!
//! NOTE that correct order of pcurves in the seam edge depends on
//! its orientation (i.e., on orientation of the wire, method of
//! exploration of edges etc.).
//! Since wire represented by the ShapeExtend_WireData is always forward
//! (orientation is accounted by edges), it will work correct if:
//! 1. Wire created from ShapeExtend_WireData with methods
//! ShapeExtend_WireData::Wire..() is added into the FORWARD face
//! (orientation can be applied later)
//! 2. Wire is extracted from the face with orientation not composed
//! with orientation of the face
Standard_EXPORT Standard_Boolean FixSeam (const Standard_Integer num);
//! Fixes edges which have pcurves shifted by whole parameter
//! range on the closed surface (the case may occur if pcurve
//! of edge was computed by projecting 3d curve, which goes
//! along the seam).
//! It compares each two consequent edges and tries to connect them
//! if distance between ends is near to range of the surface.
//! It also can detect and fix the case if all pcurves are connected,
//! but lie out of parametric bounds of the surface.
//! In addition to FixShifted from ShapeFix_Wire, more
//! sophisticated check of degenerate points is performed,
//! and special cases like sphere given by two meridians
//! are treated.
Standard_EXPORT Standard_Boolean FixShifted();
//! Fixes Degenerated Edge
//! Checks an <num-th> edge or a point between <num>th-1 and <num>th
//! edges for a singularity on a supporting surface.
//! If singularity is detected, either adds new degenerated edge
//! (before <num>th), or makes <num>th edge to be degenerated.
Standard_EXPORT Standard_Boolean FixDegenerated (const Standard_Integer num);
//! Fixes Lacking Edge
//! Test if two adjucent edges are disconnected in 2d (while
//! connected in 3d), and in that case either increase tolerance
//! of the vertex or add a new edge (straight in 2d space), in
//! order to close wire in 2d.
//! Returns True if edge was added or tolerance was increased.
Standard_EXPORT Standard_Boolean FixLacking (const Standard_Integer num, const Standard_Boolean force = Standard_False);
Standard_EXPORT Standard_Boolean FixNotchedEdges();
//! Fixes gap between ends of 3d curves on num-1 and num-th edges.
//! myPrecision is used to detect the gap.
//! If convert is True, converts curves to bsplines to bend.
Standard_EXPORT Standard_Boolean FixGap3d (const Standard_Integer num, const Standard_Boolean convert = Standard_False);
//! Fixes gap between ends of pcurves on num-1 and num-th edges.
//! myPrecision is used to detect the gap.
//! If convert is True, converts pcurves to bsplines to bend.
Standard_EXPORT Standard_Boolean FixGap2d (const Standard_Integer num, const Standard_Boolean convert = Standard_False);
Standard_EXPORT Standard_Boolean FixTails();
Standard_Boolean StatusReorder (const ShapeExtend_Status status) const;
Standard_Boolean StatusSmall (const ShapeExtend_Status status) const;
Standard_Boolean StatusConnected (const ShapeExtend_Status status) const;
Standard_Boolean StatusEdgeCurves (const ShapeExtend_Status status) const;
Standard_Boolean StatusDegenerated (const ShapeExtend_Status status) const;
Standard_Boolean StatusSelfIntersection (const ShapeExtend_Status status) const;
Standard_Boolean StatusLacking (const ShapeExtend_Status status) const;
Standard_Boolean StatusClosed (const ShapeExtend_Status status) const;
Standard_Boolean StatusGaps3d (const ShapeExtend_Status status) const;
Standard_Boolean StatusGaps2d (const ShapeExtend_Status status) const;
Standard_Boolean StatusNotches (const ShapeExtend_Status status) const;
//! Querying the status of perfomed API fixing procedures
//! Each Status..() methods gives information about the last call to
//! the corresponding Fix..() method of API level:
//! OK : no problems detected; nothing done
//! DONE: some problem(s) was(were) detected and successfully fixed
//! FAIL: some problem(s) cannot be fixed
Standard_Boolean StatusRemovedSegment() const;
Standard_Boolean StatusFixTails (const ShapeExtend_Status status) const;
//! Queries the status of last call to methods Fix... of
//! advanced level
//! For details see corresponding methods; universal statuses are:
//! OK : problem not detected; nothing done
//! DONE: problem was detected and successfully fixed
//! FAIL: problem cannot be fixed
Standard_Boolean LastFixStatus (const ShapeExtend_Status status) const;
//! Returns tool for fixing wires.
Handle(ShapeFix_Edge) FixEdgeTool() const;
DEFINE_STANDARD_RTTI(ShapeFix_Wire,ShapeFix_Root)
protected:
//! Updates WireData if some replacements are made
//! This is necessary for wires (unlike other shape types)
//! since one edge can present in wire several times
Standard_EXPORT void UpdateWire();
Handle(ShapeFix_Edge) myFixEdge;
Handle(ShapeAnalysis_Wire) myAnalyzer;
Standard_Boolean myGeomMode;
Standard_Boolean myTopoMode;
Standard_Boolean myClosedMode;
Standard_Boolean myPreference2d;
Standard_Boolean myFixGapsByRanges;
Standard_Integer myFixReversed2dMode;
Standard_Integer myFixRemovePCurveMode;
Standard_Integer myFixAddPCurveMode;
Standard_Integer myFixRemoveCurve3dMode;
Standard_Integer myFixAddCurve3dMode;
Standard_Integer myFixSeamMode;
Standard_Integer myFixShiftedMode;
Standard_Integer myFixSameParameterMode;
Standard_Integer myFixVertexToleranceMode;
Standard_Integer myFixNotchedEdgesMode;
Standard_Integer myFixSelfIntersectingEdgeMode;
Standard_Integer myFixIntersectingEdgesMode;
Standard_Integer myFixNonAdjacentIntersectingEdgesMode;
Standard_Integer myFixTailMode;
Standard_Integer myRemoveLoopMode;
Standard_Integer myFixReorderMode;
Standard_Integer myFixSmallMode;
Standard_Integer myFixConnectedMode;
Standard_Integer myFixEdgeCurvesMode;
Standard_Integer myFixDegeneratedMode;
Standard_Integer myFixSelfIntersectionMode;
Standard_Integer myFixLackingMode;
Standard_Integer myFixGaps3dMode;
Standard_Integer myFixGaps2dMode;
Standard_Integer myLastFixStatus;
Standard_Integer myStatusReorder;
Standard_Integer myStatusSmall;
Standard_Integer myStatusConnected;
Standard_Integer myStatusEdgeCurves;
Standard_Integer myStatusDegenerated;
Standard_Integer myStatusClosed;
Standard_Integer myStatusSelfIntersection;
Standard_Integer myStatusLacking;
Standard_Integer myStatusGaps3d;
Standard_Integer myStatusGaps2d;
Standard_Boolean myStatusRemovedSegment;
Standard_Integer myStatusNotches;
Standard_Integer myStatusFixTails;
Standard_Real myMaxTailAngleSine;
Standard_Real myMaxTailWidth;
private:
//! Detect and fix self-intersecting pcurve of edge <num>.
//! Fix is made by one of two methods:
//! - cut out the self-intersection loop on pcurve (thus
//! producing C0 pcurve). This also increases tolerance of edge
//! in order to satisfy SameParameter requirement.
//! - increase tolerance of the vertex of edge nearest to the
//! self-intersection point so that it comprises that point.
//! The first method is considered only if ModifyGeometryMode
//! is True. In that case, the method which requires less
//! increasing of tolerance is selected.
Standard_EXPORT Standard_Boolean FixSelfIntersectingEdge (const Standard_Integer num);
//! Test if two consequent edges are intersecting and fix it
//! by increasing of tolerance of vertex between edges,
//! shifting this vertex to the point of intersection,
//! cutting edges to the intersection point.
//! It also can give signal to remove edge if it whole is cut by
//! intersection (if flag ModifyTopologyMode is set).
Standard_EXPORT Standard_Boolean FixIntersectingEdges (const Standard_Integer num);
//! Tests if two edges <num1> and <num2> are intersecting and
//! fix intersection by increasing of tolerance of vertex
//! nearest to the point of intersection.
Standard_EXPORT Standard_Boolean FixIntersectingEdges (const Standard_Integer num1, const Standard_Integer num2);
Standard_EXPORT void FixDummySeam (const Standard_Integer num);
};
#include <ShapeFix_Wire.lxx>
#endif // _ShapeFix_Wire_HeaderFile

View File

@@ -1,147 +0,0 @@
-- Created on: 1999-04-27
-- Created by: Andrey BETENEV
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class WireSegment from ShapeFix
---Purpose: This class is auxiliary class (data storage) used in ComposeShell.
-- It is intended for representing segment of the wire
-- (or whole wire). The segment itself is represented by
-- ShapeExtend_WireData. In addition, some associated data
-- necessary for computations are stored:
--
-- * Orientation flag - determines current use of the segment
-- and used for parity checking:
--
-- TopAbs_FORWARD and TopAbs_REVERSED - says that segment was
-- traversed once in the corresponding direction, and hence
-- it should be traversed once more in opposite direction;
--
-- TopAbs_EXTERNAL - the segment was not yet traversed in any
-- direction (i.e. not yet used as boundary)
--
-- TopAbs_INTERNAL - the segment was traversed in both
-- directions and hence is out of further work.
--
-- Segments of initial bounding wires are created with
-- orientation REVERSED (for outer wire) or FORWARD (for inner
-- wires), and segments of splitting seams - with orientation
-- EXTERNAL.
uses
Orientation from TopAbs,
Edge from TopoDS,
Wire from TopoDS,
Vertex from TopoDS,
WireData from ShapeExtend,
HSequenceOfInteger from TColStd
is
Create returns WireSegment;
---Purpose: Creates empty segment.
Create (wire: WireData from ShapeExtend;
ori: Orientation from TopAbs = TopAbs_EXTERNAL)
returns WireSegment;
---Purpose: Creates segment and initializes it with wire and orientation.
Create (wire: Wire from TopoDS;
ori: Orientation from TopAbs = TopAbs_EXTERNAL)
returns WireSegment;
---Purpose: Creates segment and initializes it with wire and orientation.
Clear (me: in out);
---Purpose: Clears all fields.
Load (me: in out; wire: WireData from ShapeExtend);
---Purpose: Loads wire.
WireData (me) returns WireData from ShapeExtend;
---Purpose: Returns wire.
---C++: return const &
Orientation (me: in out; ori: Orientation from TopAbs);
---Purpose: Sets orientation flag.
Orientation (me) returns Orientation from TopAbs;
---Purpose: Returns orientation flag.
FirstVertex (me) returns Vertex from TopoDS;
---Purpose: Returns first vertex of the first edge in the wire
-- (no dependance on Orientation()).
LastVertex (me) returns Vertex from TopoDS;
---Purpose: Returns last vertex of the last edge in the wire
-- (no dependance on Orientation()).
IsClosed (me) returns Boolean;
---Purpose: Returns True if FirstVertex() == LastVertex()
---Scope: work with edges and synchronous maintaining patch indices
NbEdges (me) returns Integer;
---Purpose: Returns Number of edges in the wire
Edge (me; i: Integer) returns Edge from TopoDS;
---Purpose: Returns edge by given index in the wire
SetEdge (me: in out; i: Integer; edge: Edge from TopoDS);
---Purpose: Replaces edge at index i by new one.
AddEdge (me: in out; i: Integer; edge: Edge from TopoDS);
---Purpose: Insert a new edge with index i and implicitly defined
-- patch indices (indefinite patch).
-- If i==0, edge is inserted at end of wire.
AddEdge (me: in out; i: Integer; edge: Edge from TopoDS;
iumin, iumax, ivmin, ivmax: Integer);
---Purpose: Insert a new edge with index i and explicitly defined
-- patch indices. If i==0, edge is inserted at end of wire.
SetPatchIndex (me: in out; i: Integer; iumin, iumax, ivmin, ivmax: Integer);
---Purpose: Set patch indices for edge i.
DefineIUMin (me: in out; i: Integer; iumin: Integer);
DefineIUMax (me: in out; i: Integer; iumax: Integer);
DefineIVMin (me: in out; i: Integer; ivmin: Integer);
DefineIVMax (me: in out; i: Integer; ivmax: Integer);
---Purpose: Modify minimal or maximal patch index for edge i.
-- The corresponding patch index for that edge is modified so
-- as to satisfy eq. iumin <= myIUMin(i) <= myIUMax(i) <= iumax
GetPatchIndex (me; i: Integer; iumin, iumax, ivmin, ivmax: out Integer);
---Purpose: Returns patch indices for edge i.
CheckPatchIndex (me; i: Integer) returns Boolean;
---Purpose: Checks patch indices for edge i to satisfy equations
-- IUMin(i) <= IUMax(i) <= IUMin(i)+1
-- for non-manifold faces if face contains INTERNAL vertices
SetVertex(me: in out; theVertex: Vertex from TopoDS);
--SetVertex(me: in out; theVertex: Vertex from TopoDS;iumin, iumax, ivmin, ivmax: Integer );
GetVertex(me) returns Vertex from TopoDS;
IsVertex(me) returns Boolean;
fields
myWire : WireData from ShapeExtend;
myVertex : Vertex from TopoDS;
myOrient: Orientation from TopAbs;
myIUMin : HSequenceOfInteger from TColStd; -- indices
myIUMax : HSequenceOfInteger from TColStd; -- for
myIVMin : HSequenceOfInteger from TColStd; -- patch
myIVMax : HSequenceOfInteger from TColStd; --
end WireSegment;

View File

@@ -14,15 +14,18 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_WireSegment.ixx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix_WireSegment.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
//=======================================================================
//function : ShapeFix_WireSegment
//purpose :
//=======================================================================
ShapeFix_WireSegment::ShapeFix_WireSegment()
{
Clear();

View File

@@ -0,0 +1,175 @@
// Created on: 1999-04-27
// Created by: Andrey BETENEV
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_WireSegment_HeaderFile
#define _ShapeFix_WireSegment_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopAbs_Orientation.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class ShapeExtend_WireData;
class TopoDS_Wire;
class TopoDS_Vertex;
class TopoDS_Edge;
//! This class is auxiliary class (data storage) used in ComposeShell.
//! It is intended for representing segment of the wire
//! (or whole wire). The segment itself is represented by
//! ShapeExtend_WireData. In addition, some associated data
//! necessary for computations are stored:
//!
//! * Orientation flag - determines current use of the segment
//! and used for parity checking:
//!
//! TopAbs_FORWARD and TopAbs_REVERSED - says that segment was
//! traversed once in the corresponding direction, and hence
//! it should be traversed once more in opposite direction;
//!
//! TopAbs_EXTERNAL - the segment was not yet traversed in any
//! direction (i.e. not yet used as boundary)
//!
//! TopAbs_INTERNAL - the segment was traversed in both
//! directions and hence is out of further work.
//!
//! Segments of initial bounding wires are created with
//! orientation REVERSED (for outer wire) or FORWARD (for inner
//! wires), and segments of splitting seams - with orientation
//! EXTERNAL.
class ShapeFix_WireSegment
{
public:
DEFINE_STANDARD_ALLOC
//! Creates empty segment.
Standard_EXPORT ShapeFix_WireSegment();
//! Creates segment and initializes it with wire and orientation.
Standard_EXPORT ShapeFix_WireSegment(const Handle(ShapeExtend_WireData)& wire, const TopAbs_Orientation ori = TopAbs_EXTERNAL);
//! Creates segment and initializes it with wire and orientation.
Standard_EXPORT ShapeFix_WireSegment(const TopoDS_Wire& wire, const TopAbs_Orientation ori = TopAbs_EXTERNAL);
//! Clears all fields.
Standard_EXPORT void Clear();
//! Loads wire.
Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& wire);
//! Returns wire.
Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const;
//! Sets orientation flag.
Standard_EXPORT void Orientation (const TopAbs_Orientation ori);
//! Returns orientation flag.
Standard_EXPORT TopAbs_Orientation Orientation() const;
//! Returns first vertex of the first edge in the wire
//! (no dependance on Orientation()).
Standard_EXPORT TopoDS_Vertex FirstVertex() const;
//! Returns last vertex of the last edge in the wire
//! (no dependance on Orientation()).
Standard_EXPORT TopoDS_Vertex LastVertex() const;
//! Returns True if FirstVertex() == LastVertex()
Standard_EXPORT Standard_Boolean IsClosed() const;
//! Returns Number of edges in the wire
Standard_EXPORT Standard_Integer NbEdges() const;
//! Returns edge by given index in the wire
Standard_EXPORT TopoDS_Edge Edge (const Standard_Integer i) const;
//! Replaces edge at index i by new one.
Standard_EXPORT void SetEdge (const Standard_Integer i, const TopoDS_Edge& edge);
//! Insert a new edge with index i and implicitly defined
//! patch indices (indefinite patch).
//! If i==0, edge is inserted at end of wire.
Standard_EXPORT void AddEdge (const Standard_Integer i, const TopoDS_Edge& edge);
//! Insert a new edge with index i and explicitly defined
//! patch indices. If i==0, edge is inserted at end of wire.
Standard_EXPORT void AddEdge (const Standard_Integer i, const TopoDS_Edge& edge, const Standard_Integer iumin, const Standard_Integer iumax, const Standard_Integer ivmin, const Standard_Integer ivmax);
//! Set patch indices for edge i.
Standard_EXPORT void SetPatchIndex (const Standard_Integer i, const Standard_Integer iumin, const Standard_Integer iumax, const Standard_Integer ivmin, const Standard_Integer ivmax);
Standard_EXPORT void DefineIUMin (const Standard_Integer i, const Standard_Integer iumin);
Standard_EXPORT void DefineIUMax (const Standard_Integer i, const Standard_Integer iumax);
Standard_EXPORT void DefineIVMin (const Standard_Integer i, const Standard_Integer ivmin);
//! Modify minimal or maximal patch index for edge i.
//! The corresponding patch index for that edge is modified so
//! as to satisfy eq. iumin <= myIUMin(i) <= myIUMax(i) <= iumax
Standard_EXPORT void DefineIVMax (const Standard_Integer i, const Standard_Integer ivmax);
//! Returns patch indices for edge i.
Standard_EXPORT void GetPatchIndex (const Standard_Integer i, Standard_Integer& iumin, Standard_Integer& iumax, Standard_Integer& ivmin, Standard_Integer& ivmax) const;
//! Checks patch indices for edge i to satisfy equations
//! IUMin(i) <= IUMax(i) <= IUMin(i)+1
Standard_EXPORT Standard_Boolean CheckPatchIndex (const Standard_Integer i) const;
Standard_EXPORT void SetVertex (const TopoDS_Vertex& theVertex);
Standard_EXPORT TopoDS_Vertex GetVertex() const;
Standard_EXPORT Standard_Boolean IsVertex() const;
protected:
private:
Handle(ShapeExtend_WireData) myWire;
TopoDS_Vertex myVertex;
TopAbs_Orientation myOrient;
Handle(TColStd_HSequenceOfInteger) myIUMin;
Handle(TColStd_HSequenceOfInteger) myIUMax;
Handle(TColStd_HSequenceOfInteger) myIVMin;
Handle(TColStd_HSequenceOfInteger) myIVMax;
};
#endif // _ShapeFix_WireSegment_HeaderFile

View File

@@ -1,74 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class WireVertex from ShapeFix
---Purpose: Fixing disconnected edges in the wire
-- Fixes vertices in the wire on the basis of pre-analysis
-- made by ShapeAnalysis_WireVertex (given as argument).
-- The Wire has formerly been loaded in a ShapeExtend_WireData.
uses
Wire from TopoDS,
WireData from ShapeExtend,
WireVertex from ShapeAnalysis
is
Create returns WireVertex from ShapeFix;
Init (me: in out; wire: Wire from TopoDS; preci: Real);
---Purpose: Loads the wire, ininializes internal analyzer
-- (ShapeAnalysis_WireVertex) with the given precision,
-- and performs analysis
Init (me: in out; sbwd: WireData from ShapeExtend; preci: Real);
---Purpose: Loads the wire, ininializes internal analyzer
-- (ShapeAnalysis_WireVertex) with the given precision,
-- and performs analysis
Init (me: in out; sawv: WireVertex from ShapeAnalysis);
---Purpose: Loads all the data on wire, already analysed by
-- ShapeAnalysis_WireVertex
Analyzer (me) returns WireVertex from ShapeAnalysis;
---C++: return const &
---Purpose: returns internal analyzer
WireData (me) returns WireData from ShapeExtend;
---C++: return const &
---Purpose: returns data on wire (fixed)
---Remark : calls Analyzer().WireData()
Wire (me) returns Wire from TopoDS;
---Purpose: returns resulting wire (fixed)
---Remark : calls Analyzer().WireData()->Wire()
FixSame (me: in out) returns Integer;
---Purpose: Fixes "Same" or "Close" status (same vertex may be set,
-- without changing parameters)
-- Returns the count of fixed vertices, 0 if none
Fix (me: in out) returns Integer;
---Purpose: Fixes all statuses except "Disjoined", i.e. the cases in which a
-- common value has been set, with or without changing parameters
-- Returns the count of fixed vertices, 0 if none
fields
myAnalyzer: WireVertex from ShapeAnalysis;
end WireVertex;

View File

@@ -12,25 +12,26 @@
// commercial license or contractual agreement.
//szv#4 S4163
#include <ShapeFix_WireVertex.ixx>
#include <BRep_Builder.hxx>
#include <gp_Pnt.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_WireVertex.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix_WireVertex.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <BRep_Builder.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <gp_Pnt.hxx> //ied_modif_for_compil_Nov-19-1998
//ied_modif_for_compil_Nov-19-1998
//=======================================================================
//function : ShapeFix_WireVertex
//purpose :
//=======================================================================
ShapeFix_WireVertex::ShapeFix_WireVertex()
{
}

View File

@@ -0,0 +1,102 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_WireVertex_HeaderFile
#define _ShapeFix_WireVertex_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <ShapeAnalysis_WireVertex.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
class TopoDS_Wire;
class ShapeExtend_WireData;
class ShapeAnalysis_WireVertex;
//! Fixing disconnected edges in the wire
//! Fixes vertices in the wire on the basis of pre-analysis
//! made by ShapeAnalysis_WireVertex (given as argument).
//! The Wire has formerly been loaded in a ShapeExtend_WireData.
class ShapeFix_WireVertex
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT ShapeFix_WireVertex();
//! Loads the wire, ininializes internal analyzer
//! (ShapeAnalysis_WireVertex) with the given precision,
//! and performs analysis
Standard_EXPORT void Init (const TopoDS_Wire& wire, const Standard_Real preci);
//! Loads the wire, ininializes internal analyzer
//! (ShapeAnalysis_WireVertex) with the given precision,
//! and performs analysis
Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& sbwd, const Standard_Real preci);
//! Loads all the data on wire, already analysed by
//! ShapeAnalysis_WireVertex
Standard_EXPORT void Init (const ShapeAnalysis_WireVertex& sawv);
//! returns internal analyzer
Standard_EXPORT const ShapeAnalysis_WireVertex& Analyzer() const;
//! returns data on wire (fixed)
Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const;
//! returns resulting wire (fixed)
Standard_EXPORT TopoDS_Wire Wire() const;
//! Fixes "Same" or "Close" status (same vertex may be set,
//! without changing parameters)
//! Returns the count of fixed vertices, 0 if none
Standard_EXPORT Standard_Integer FixSame();
//! Fixes all statuses except "Disjoined", i.e. the cases in which a
//! common value has been set, with or without changing parameters
//! Returns the count of fixed vertices, 0 if none
Standard_EXPORT Standard_Integer Fix();
protected:
private:
ShapeAnalysis_WireVertex myAnalyzer;
};
#endif // _ShapeFix_WireVertex_HeaderFile

View File

@@ -1,128 +0,0 @@
-- Created on: 1999-08-24
-- Created by: Sergei ZERTCHANINOV
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Wireframe from ShapeFix inherits Root from ShapeFix
---Purpose : Provides methods for fixing wireframe of shape
uses
Shape from TopoDS,
Status from ShapeExtend,
Shape from GeomAbs,
HArray1OfReal from TColStd,
MapOfShape from TopTools,
DataMapOfShapeListOfShape from TopTools
is
Create returns Wireframe from ShapeFix;
Create (shape: Shape from TopoDS) returns Wireframe from ShapeFix;
ClearStatuses (me: mutable) is virtual;
---Purpose: Clears all statuses
Load (me : mutable; shape: Shape from TopoDS);
---Purpose: Loads a shape, resets statuses
FixWireGaps (me : mutable) returns Boolean from Standard;
---Purpose : Fixes gaps between ends of curves of adjacent edges
-- (both 3d and pcurves) in wires
-- If precision is 0.0, uses Precision::Confusion().
---Status : See StatusWireGaps() for details
-- OK - No gaps were found
-- DONE1 - Some gaps in 3D were fixed
-- DONE2 - Some gaps in 2D were fixed
-- FAIL1 - Failed to fix some gaps in 3D
-- FAIL2 - Failed to fix some gaps in 2D
---Returns : False if nothing done, else True
FixSmallEdges (me : mutable) returns Boolean from Standard;
---Purpose : Fixes small edges in shape by merging adjacent edges
-- If precision is 0.0, uses Precision::Confusion().
---Status : See StatusSmallEdges() for details
-- OK - No small edges were found
-- DONE1 - Some small edges were fixed
-- FAIL1 - Failed to fix some small edges
---Returns : False if nothing done, else True
CheckSmallEdges (me: mutable; theSmallEdges: out MapOfShape from TopTools;
theEdgeToFaces: out DataMapOfShapeListOfShape from TopTools;
theFaceWithSmall: out DataMapOfShapeListOfShape from TopTools;
theMultyEdges: out MapOfShape from TopTools)
returns Boolean from Standard;
---Purpose: Auxiliary tool for FixSmallEdges which checks for small edges and fills the maps.
-- Returns True if at least one small edge has been found.
MergeSmallEdges (me: mutable; theSmallEdges: in out MapOfShape from TopTools;
theEdgeToFaces: in out DataMapOfShapeListOfShape from TopTools;
theFaceWithSmall: in out DataMapOfShapeListOfShape from TopTools;
theMultyEdges: out MapOfShape from TopTools;
theModeDrop: Boolean = Standard_False;
theLimitAngle: Real = -1)
returns Boolean from Standard;
---Purpose: Auxiliary tool for FixSmallEdges which merges small edges.
-- If theModeDrop is equal to Standard_True then small edges,
-- which cannot be connected with adjacent edges are dropped.
-- Otherwise they are kept.
-- theLimitAngle specifies maximum allowed tangency
-- discontinuity between adjacent edges.
-- If theLimitAngle is equal to -1, this angle is not taken into account.
StatusWireGaps (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
---Purpose : Decodes the status of the last FixWireGaps.
-- OK - No gaps were found
-- DONE1 - Some gaps in 3D were fixed
-- DONE2 - Some gaps in 2D were fixed
-- FAIL1 - Failed to fix some gaps in 3D
-- FAIL2 - Failed to fix some gaps in 2D
StatusSmallEdges (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
---Purpose : Decodes the status of the last FixSmallEdges.
-- OK - No small edges were found
-- DONE1 - Some small edges were fixed
-- FAIL1 - Failed to fix some small edges
Shape (me : mutable) returns Shape from TopoDS;
---C++: inline
ModeDropSmallEdges(me : mutable) returns Boolean;
---C++: return &
---C++: inline
---Purpose: Returns mode managing removing small edges.
SetLimitAngle(me:mutable; theLimitAngle : Real);
---C++: inline
---Purpose:Set limit angle for merging edges.
LimitAngle(me) returns Real;
---C++: inline
---Purpose:Get limit angle for merging edges.
fields
myShape : Shape from TopoDS is protected;
myModeDrop : Boolean;
myLimitAngle : Real;
myStatusWireGaps : Integer from Standard;
myStatusSmallEdges : Integer from Standard;
end Wireframe;

View File

@@ -14,52 +14,52 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeFix_Wireframe.ixx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>
//#include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Iterator.hxx>
#include <ShapeFix_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Curve.hxx>
#include <GeomAPI.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <Message_Msg.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeConstruct.hxx>
#include <ShapeConstruct_Curve.hxx>
#include <ShapeFix.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeConstruct_Curve.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_Wireframe.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Type.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <Geom_Curve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <gp_Pnt.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <BRep_Tool.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <gp_Pln.hxx>
#include <GeomAPI.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <ShapeConstruct.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <Message_Msg.hxx>
//#include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
//=======================================================================
//function : ShapeFix_Wireframe
//purpose :
//=======================================================================
ShapeFix_Wireframe::ShapeFix_Wireframe()
{
ClearStatuses();

View File

@@ -0,0 +1,130 @@
// Created on: 1999-08-24
// Created by: Sergei ZERTCHANINOV
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeFix_Wireframe_HeaderFile
#define _ShapeFix_Wireframe_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <ShapeFix_Root.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <ShapeExtend_Status.hxx>
class TopoDS_Shape;
class ShapeFix_Wireframe;
DEFINE_STANDARD_HANDLE(ShapeFix_Wireframe, ShapeFix_Root)
//! Provides methods for fixing wireframe of shape
class ShapeFix_Wireframe : public ShapeFix_Root
{
public:
Standard_EXPORT ShapeFix_Wireframe();
Standard_EXPORT ShapeFix_Wireframe(const TopoDS_Shape& shape);
//! Clears all statuses
Standard_EXPORT virtual void ClearStatuses();
//! Loads a shape, resets statuses
Standard_EXPORT void Load (const TopoDS_Shape& shape);
//! Fixes gaps between ends of curves of adjacent edges
//! (both 3d and pcurves) in wires
//! If precision is 0.0, uses Precision::Confusion().
Standard_EXPORT Standard_Boolean FixWireGaps();
//! Fixes small edges in shape by merging adjacent edges
//! If precision is 0.0, uses Precision::Confusion().
Standard_EXPORT Standard_Boolean FixSmallEdges();
//! Auxiliary tool for FixSmallEdges which checks for small edges and fills the maps.
//! Returns True if at least one small edge has been found.
Standard_EXPORT Standard_Boolean CheckSmallEdges (TopTools_MapOfShape& theSmallEdges, TopTools_DataMapOfShapeListOfShape& theEdgeToFaces, TopTools_DataMapOfShapeListOfShape& theFaceWithSmall, TopTools_MapOfShape& theMultyEdges);
//! Auxiliary tool for FixSmallEdges which merges small edges.
//! If theModeDrop is equal to Standard_True then small edges,
//! which cannot be connected with adjacent edges are dropped.
//! Otherwise they are kept.
//! theLimitAngle specifies maximum allowed tangency
//! discontinuity between adjacent edges.
//! If theLimitAngle is equal to -1, this angle is not taken into account.
Standard_EXPORT Standard_Boolean MergeSmallEdges (TopTools_MapOfShape& theSmallEdges, TopTools_DataMapOfShapeListOfShape& theEdgeToFaces, TopTools_DataMapOfShapeListOfShape& theFaceWithSmall, TopTools_MapOfShape& theMultyEdges, const Standard_Boolean theModeDrop = Standard_False, const Standard_Real theLimitAngle = -1);
//! Decodes the status of the last FixWireGaps.
//! OK - No gaps were found
//! DONE1 - Some gaps in 3D were fixed
//! DONE2 - Some gaps in 2D were fixed
//! FAIL1 - Failed to fix some gaps in 3D
//! FAIL2 - Failed to fix some gaps in 2D
Standard_Boolean StatusWireGaps (const ShapeExtend_Status status) const;
//! Decodes the status of the last FixSmallEdges.
//! OK - No small edges were found
//! DONE1 - Some small edges were fixed
//! FAIL1 - Failed to fix some small edges
Standard_Boolean StatusSmallEdges (const ShapeExtend_Status status) const;
TopoDS_Shape Shape();
//! Returns mode managing removing small edges.
Standard_Boolean& ModeDropSmallEdges();
//! Set limit angle for merging edges.
void SetLimitAngle (const Standard_Real theLimitAngle);
//! Get limit angle for merging edges.
Standard_Real LimitAngle() const;
DEFINE_STANDARD_RTTI(ShapeFix_Wireframe,ShapeFix_Root)
protected:
TopoDS_Shape myShape;
private:
Standard_Boolean myModeDrop;
Standard_Real myLimitAngle;
Standard_Integer myStatusWireGaps;
Standard_Integer myStatusSmallEdges;
};
#include <ShapeFix_Wireframe.lxx>
#endif // _ShapeFix_Wireframe_HeaderFile