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

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
-- File: BRepOffsetAPI.cdl
-- Created: Mon Oct 11 16:29:02 1999
-- Author: Atelier CAS2000
-- <cas@h2ox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
package BRepOffsetAPI
uses
Standard,
StdFail,
gp,
GeomAbs,
Geom,
Approx,
TopoDS,
TopTools,
BRepAlgo,
BRepBuilderAPI,
BRepSweep,
BRepPrimAPI,
BRepFill,
Law,
Draft,
BRepOffset,
TColStd,
TCollection
is
--
-- Sweeping
--
class MakePipe; --- inherits MakeSweep from BRepPrimAPI
---Purpose: To create shape by pipe
class MakePipeShell; --- inherits MakeSweep from BRepPrimAPI
---Purpose: Numerous posibilities to create shell by sweeping
class MakeDraft; --- inherits MakeShape from BRepBuilderAPI
class DraftAngle; --- inherits MakeShape from BRepBuilderAPI
class FindContigousEdges;
---Purpose: find the contigous edges of shapes for control
-- (continuity C0, C1, ...)
alias Sewing is Sewing from BRepBuilderAPI;
---Purpose: sew the shapes along their common edges
--
-- Evolved and Offseting
--
class MakeOffset; --- inherits MakeShape from BRepBuilderAPI
---Purpose: Offsets to a set of plane wires.
class MakeOffsetShape; --- inherits MakeShape from BRepBuilderAPI
--Purpose: Offset shape to shells or solids.
class MakeThickSolid; --- inherits MakeOffsetShape from BRepOffsetAPI
---Purpose: Thick solid to shells or solids.
class MakeEvolved; --- inherits MakeShape from BRepBuilderAPI
--
-- Construction of Shape through sections.
--
class ThruSections; --- inherits MakeShape from BRepBuilderAPI
class NormalProjection ; --- inherits MakeShape from BRepBuilderAPI
--
-- Plate
--
class MakeFilling; --- inherits MakeShape from BRepBuilderAPI
---Purpose: N-Side Filling
-- This algorithm avoids to build a face from:
-- * a set of edges defining the bounds of the face and some
-- constraints the surface of the face has to satisfy
-- * a set of edges and points defining some constraints
-- the support surface has to satisfy
-- * an initial surface to deform for satisfying the constraints
-- * a set of parameters to control the constraints.
class SequenceOfSequenceOfReal instantiates
Sequence from TCollection (SequenceOfReal from TColStd);
class SequenceOfSequenceOfShape instantiates
Sequence from TCollection (SequenceOfShape from TopTools);
end;

View File

@@ -0,0 +1,265 @@
-- File: BRepOffsetAPI_DraftAngle.cdl
-- Created: Wed Feb 22 11:32:25 1995
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1995
class DraftAngle from BRepOffsetAPI inherits ModifyShape from BRepBuilderAPI
---Purpose: Taper-adding transformations on a shape.
-- The resulting shape is constructed by defining one face
-- to be tapered after another one, as well as the
-- geometric properties of their tapered transformation.
-- Each tapered transformation is propagated along the
-- series of faces which are tangential to one another and
-- which contains the face to be tapered.
-- This algorithm is useful in the construction of molds or
-- dies. It facilitates the removal of the article being produced.
-- A DraftAngle object provides a framework for:
-- - initializing the construction algorithm with a given shape,
-- - acquiring the data characterizing the faces to be tapered,
-- - implementing the construction algorithm, and
-- - consulting the results.
-- Warning
-- - This algorithm treats planar, cylindrical and conical faces.
-- - Do not use shapes, which with a draft angle added to
-- a face would modify the topology. This would, for
-- example, involve creation of new vertices, edges or
-- faces, or suppression of existing vertices, edges or faces.
-- - Any face, which is continuous in tangency with the
-- face to be tapered, will also be tapered. These
-- connected faces must also respect the above criteria.
uses
Shape from TopoDS,
Face from TopoDS,
ShapeModification from BRepBuilderAPI,
ListOfShape from TopTools,
Dir from gp,
Pln from gp,
ErrorStatus from Draft
raises
NotDone from StdFail,
NullObject from Standard,
NoSuchObject from Standard,
ConstructionError from Standard
is
Create
returns DraftAngle from BRepOffsetAPI;
---Purpose: Constructs an empty algorithm to perform
-- taper-adding transformations on faces of a shape.
-- Use the Init function to define the shape to be tapered.
Create(S: Shape from TopoDS)
returns DraftAngle from BRepOffsetAPI;
---Purpose: Initializes an algorithm to perform taper-adding
-- transformations on faces of the shape S.
-- S will be referred to as the initial shape of the algorithm.
Clear(me: in out)
---Purpose: Cancels the results of all taper-adding transformations
-- performed by this algorithm on the initial shape. These
-- results will have been defined by successive calls to the function Add.
is static;
Init(me: in out; S: Shape from TopoDS)
---Purpose: Initializes, or reinitializes this taper-adding algorithm with the shape S.
-- S will be referred to as the initial shape of this algorithm.
is static;
Add(me: in out; F : Face from TopoDS;
Direction : Dir from gp;
Angle : Real from Standard;
NeutralPlane: Pln from gp;
Flag : Boolean from Standard = Standard_True)
---Purpose: Adds the face F, the direction
-- Direction, the angle Angle, the plane NeutralPlane, and the flag
-- Flag to the framework created at construction time, and with this
-- data, defines the taper-adding transformation.
-- F is a face, which belongs to the initial shape of this algorithm or
-- to the shape loaded by the function Init.
-- Only planar, cylindrical or conical faces can be tapered:
-- - If the face F is planar, it is tapered by inclining it
-- through the angle Angle about the line of intersection between the
-- plane NeutralPlane and F.
-- Direction indicates the side of NeutralPlane from which matter is
-- removed if Angle is positive or added if Angle is negative.
-- - If F is cylindrical or conical, it is transformed in the
-- same way on a single face, resulting in a conical face if F
-- is cylindrical, and a conical or cylindrical face if it is already conical.
-- The taper-adding transformation is propagated from the face F along
-- the series of planar, cylindrical or conical faces containing F,
-- which are tangential to one another.
-- Use the function AddDone to check if this taper-adding transformation is successful.
-- Warning
-- Nothing is done if:
-- - the face F does not belong to the initial shape of this algorithm, or
-- - the face F is not planar, cylindrical or conical.
-- Exceptions
-- - Standard_NullObject if the initial shape is not
-- defined, i.e. if this algorithm has not been initialized
-- with the non-empty constructor or the Init function.
-- - Standard_ConstructionError if the previous call to
-- Add has failed. The function AddDone ought to have
-- been used to check for this, and the function Remove
-- to cancel the results of the unsuccessful taper-adding
-- transformation and to retrieve the previous shape.
raises NullObject from Standard,
ConstructionError from Standard
is static;
AddDone(me)
---Purpose: Returns true if the previous taper-adding
-- transformation performed by this algorithm in the last
-- call to Add, was successful.
-- If AddDone returns false:
-- - the function ProblematicShape returns the face
-- on which the error occurred,
-- - the function Remove has to be used to cancel the
-- results of the unsuccessful taper-adding
-- transformation and to retrieve the previous shape.
-- Exceptions
-- Standard_NullObject if the initial shape has not
-- been defined, i.e. if this algorithm has not been
-- initialized with the non-empty constructor or the .Init function.
returns Boolean from Standard
raises NullObject from Standard
is static;
Remove(me: in out; F: Face from TopoDS)
---Purpose: Cancels the taper-adding transformation previously
-- performed by this algorithm on the face F and the
-- series of tangential faces which contain F, and retrieves
-- the shape before the last taper-adding transformation.
-- Warning
-- You will have to use this function if the previous call to
-- Add fails. Use the function AddDone to check it.
-- Exceptions
-- - Standard_NullObject if the initial shape has not
-- been defined, i.e. if this algorithm has not been
-- initialized with the non-empty constructor or the Init function.
-- - Standard_NoSuchObject if F has not been added
-- or has already been removed.
raises NullObject from Standard,
NoSuchObject from Standard
is static;
ProblematicShape(me)
returns Shape from TopoDS
---Purpose: Returns the shape on which an error occurred after an
-- unsuccessful call to Add or when IsDone returns false.
-- Exceptions
-- Standard_NullObject if the initial shape has not been
-- defined, i.e. if this algorithm has not been initialized with
-- the non-empty constructor or the Init function.
---C++: return const&
raises NullObject from Standard
is static;
Status(me)
---Purpose: Returns an error status when an error has occured
-- (Face, Edge or Vertex recomputaion problem).
-- Otherwise returns Draft_NoError. The method may be
-- called if AddDone returns Standard_False, or when
-- IsDone returns Standard_False.
returns ErrorStatus from Draft
raises NullObject from Standard
-- The exception is raised if no shape has been
-- given(constructor or Init method).
is static;
ConnectedFaces(me; F: Face from TopoDS)
returns ListOfShape from TopTools
---Purpose: Returns all the faces which have been added
-- together with the face <F>.
--
---C++: return const&
raises NullObject from Standard,
-- The exception is raised if no shape has been
-- given(constructor or Init method).
NoSuchObject from Standard,
-- The exception is raised if F has not been added.
NotDone from StdFail
-- The exception is raised if AddDone returns False.
is static;
ModifiedFaces(me)
returns ListOfShape from TopTools
---Purpose: Returns all the faces on which a modification has
-- been given.
--
---C++: return const&
raises NullObject from Standard,
-- The exception is raised if no shape has been
-- given(constructor or Init method).
NotDone from StdFail
-- The exception is raised if AddDone returns False.
is static;
Build(me : in out)
---Purpose: Builds the resulting shape (redefined from MakeShape).
---Level: Public
is redefined;
CorrectWires(me : in out);
Generated (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes generated from the
-- shape <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined virtual;
Modified (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes modified from the shape
-- <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined virtual;
fields
myModifiedShapes : ListOfShape from TopTools;
end DraftAngle;

View File

@@ -0,0 +1,858 @@
// File: BRepOffsetAPI_DraftAngle.cxx
// Created: Wed Feb 22 11:32:25 1995
// Author: Jacques GOUSSARD
// <jag@topsn2>
#include <BRepOffsetAPI_DraftAngle.ixx>
#include <Draft_Modification.hxx>
#include <TopoDS.hxx>
#include <Geom_Surface.hxx>
#include <TopLoc_Location.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepLib.hxx>
#include <BRepFill_DataMapOfShapeSequenceOfReal.hxx>
#include <TopTools_DataMapOfShapeSequenceOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepTools.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TopOpeBRep_EdgesIntersector.hxx>
#include <TopOpeBRep_Point2d.hxx>
#include <Precision.hxx>
#include <BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal.hxx>
#include <BRepOffsetAPI_SequenceOfSequenceOfReal.hxx>
#include <BRepOffsetAPI_SequenceOfSequenceOfShape.hxx>
#include <BRepTools_Substitution.hxx>
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_GCurve.hxx>
#include <TopoDS_Wire.hxx>
#include <BRepAdaptor_Curve2d.hxx>
//=======================================================================
//function : BRepOffsetAPI_DraftAngle
//purpose :
//=======================================================================
BRepOffsetAPI_DraftAngle::BRepOffsetAPI_DraftAngle () {}
//=======================================================================
//function : BRepOffsetAPI_DraftAngle
//purpose :
//=======================================================================
BRepOffsetAPI_DraftAngle::BRepOffsetAPI_DraftAngle (const TopoDS_Shape& S)
{
myInitialShape = S;
myModification = new Draft_Modification(S);
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BRepOffsetAPI_DraftAngle::Clear ()
{
if (!myModification.IsNull()) {
(*((Handle(Draft_Modification)*)&myModification))->Clear();
}
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepOffsetAPI_DraftAngle::Init (const TopoDS_Shape& S)
{
myInitialShape = S;
NotDone();
if (!myModification.IsNull()) {
(*((Handle(Draft_Modification)*)&myModification))->Init(S);
}
else {
myModification = new Draft_Modification(S);
}
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void BRepOffsetAPI_DraftAngle::Add(const TopoDS_Face& F,
const gp_Dir& D,
const Standard_Real Angle,
const gp_Pln& Plane,
const Standard_Boolean Flag)
{
// POP-DPF : protection
if ( Abs(Angle) <= 1.e-04 )
return;
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
(*((Handle(Draft_Modification)*)&myModification))->Add(F,D,Angle,Plane, Flag);
}
//=======================================================================
//function : AddDone
//purpose :
//=======================================================================
Standard_Boolean BRepOffsetAPI_DraftAngle::AddDone () const
{
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
return (*((Handle(Draft_Modification)*)&myModification))
->ProblematicShape().IsNull();
}
//=======================================================================
//function : Remove
//purpose :
//=======================================================================
void BRepOffsetAPI_DraftAngle::Remove(const TopoDS_Face& F)
{
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
(*((Handle(Draft_Modification)*)&myModification))->Remove(F);
}
//=======================================================================
//function : ProblematicShape
//purpose :
//=======================================================================
const TopoDS_Shape& BRepOffsetAPI_DraftAngle::ProblematicShape () const
{
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
return (*((Handle(Draft_Modification)*)&myModification))->ProblematicShape();
}
//=======================================================================
//function : ErrorStatus
//purpose :
//=======================================================================
Draft_ErrorStatus BRepOffsetAPI_DraftAngle::Status () const
{
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
return (*((Handle(Draft_Modification)*)&myModification))->Error();
}
//=======================================================================
//function : ConnectedFaces
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::ConnectedFaces
(const TopoDS_Face& F) const
{
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
return (*((Handle(Draft_Modification)*)&myModification))->ConnectedFaces(F);
}
//=======================================================================
//function : ModifiedFaces
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::ModifiedFaces() const
{
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
return (*((Handle(Draft_Modification)*)&myModification))->ModifiedFaces();
}
//=======================================================================
//function : ModifiedFaces
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::Generated(const TopoDS_Shape& S)
{
myGenerated.Clear();
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
Handle(Draft_Modification) DMod = (*((Handle(Draft_Modification)*)&myModification));
if (S.ShapeType() == TopAbs_FACE) {
Handle(Geom_Surface) Surf;
TopLoc_Location L;
Standard_Real Tol;
Standard_Boolean RW,RF;
if (DMod->NewSurface(TopoDS::Face(S), Surf, L, Tol, RW, RF)) {
myGenerated.Append(ModifiedShape (S));
}
}
return myGenerated;
}
//=======================================================================
//function : ModifiedFaces
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_DraftAngle::Modified(const TopoDS_Shape& S)
{
myGenerated.Clear();
Standard_NullObject_Raise_if(myInitialShape.IsNull(),"");
Handle(Draft_Modification) DMod = (*((Handle(Draft_Modification)*)&myModification));
if (S.ShapeType() == TopAbs_FACE) {
Handle(Geom_Surface) Surf;
TopLoc_Location L;
Standard_Real Tol;
Standard_Boolean RW,RF;
if (!DMod->NewSurface(TopoDS::Face(S), Surf, L, Tol, RW, RF)) {
// Ce n est pas une generation => peut etre une modif
myGenerated.Append(ModifiedShape (S));
if (myGenerated.Extent() == 1 && myGenerated.First().IsSame(S)) {
myGenerated.Clear();
}
}
}
return myGenerated;
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepOffsetAPI_DraftAngle::Build()
{
(*((Handle(Draft_Modification)*)&myModification))->Perform();
if (!(*((Handle(Draft_Modification)*)&myModification))->IsDone()) {
NotDone();
}
else {
DoModif(myInitialShape);
//BRepLib::SameParameter( myShape, 1.0e-7, Standard_True ); //patch
CorrectWires();
BRepLib::SameParameter( myShape, 1.0e-7, Standard_True ); //patch
}
}
//=======================================================================
//function : CorrectWires
//purpose :
//=======================================================================
void BRepOffsetAPI_DraftAngle::CorrectWires()
{
Standard_Real TolInter = 1.e-7;
Standard_Integer i, j, k;
TopTools_SequenceOfShape Eseq;
TopTools_SequenceOfShape Wseq;
TopTools_SequenceOfShape Fseq;
TopoDS_Shape CurEdge, CurWire, CurFace;
TopoDS_Iterator wit, eit;
TopExp_Explorer fexp( myShape, TopAbs_FACE );
for (; fexp.More(); fexp.Next())
{
CurFace = fexp.Current();
wit.Initialize( CurFace );
for (; wit.More(); wit.Next())
{
CurWire = wit.Value();
TopTools_MapOfShape emap;
eit.Initialize( CurWire );
for (; eit.More(); eit.Next())
emap.Add( eit.Value() );
TopTools_MapIteratorOfMapOfShape mapit( emap );
for (; mapit.More(); mapit.Next())
{
CurEdge = mapit.Key();
if (BRepTools::IsReallyClosed( TopoDS::Edge(CurEdge), TopoDS::Face(CurFace) ))
{
Eseq.Append( CurEdge );
Wseq.Append( CurWire );
Fseq.Append( CurFace );
}
}
}
}
BRepFill_DataMapOfShapeSequenceOfReal Emap;
TopTools_SequenceOfShape NonSeam;
TopTools_SequenceOfShape NonSeamWires;
BRepOffsetAPI_SequenceOfSequenceOfReal ParsNonSeam;
BRepOffsetAPI_SequenceOfSequenceOfShape Seam;
BRepOffsetAPI_SequenceOfSequenceOfReal ParsSeam;
TopTools_DataMapOfShapeShape WFmap;
TopTools_DataMapOfShapeListOfShape WWmap;
for (i = 1; i <= Eseq.Length(); i++)
{
CurEdge = Eseq(i);
CurWire = Wseq(i);
CurFace = Fseq(i);
wit.Initialize( CurFace );
for (; wit.More(); wit.Next())
{
TopoDS_Shape aWire = wit.Value();
if (! aWire.IsSame( CurWire ))
{
TColgp_SequenceOfPnt pts;
TopTools_SequenceOfShape edges;
TColStd_SequenceOfReal pars;
Standard_Boolean Wadd = Standard_False;
eit.Initialize( aWire );
for (; eit.More(); eit.Next())
{
TopoDS_Shape anEdge = eit.Value();
TopOpeBRep_EdgesIntersector EInter;
EInter.SetFaces( CurFace, CurFace );
EInter.ForceTolerances( TolInter, TolInter );
EInter.Perform( CurEdge, anEdge );
if (EInter.IsEmpty())
{
EInter.Perform( CurEdge.Reversed(), anEdge );
if (EInter.IsEmpty())
continue;
}
Wadd = Standard_True;
if (! WFmap.IsBound( aWire ))
WFmap.Bind( aWire, CurFace );
Standard_Integer ind = 0;
for (j = 1; j <= NonSeam.Length(); j++)
if (anEdge.IsSame( NonSeam(j) ))
{
ind = j;
break;
}
if (ind == 0)
{
NonSeam.Append( anEdge );
NonSeamWires.Append( aWire );
ind = NonSeam.Length();
TColStd_SequenceOfReal emptyseq1, emptyseq2;
TopTools_SequenceOfShape emptyedgeseq;
ParsNonSeam.Append( emptyseq1 );
Seam.Append( emptyedgeseq );
ParsSeam.Append( emptyseq2 );
}
if (! Emap.IsBound( CurEdge ))
{
TColStd_SequenceOfReal emptyseq;
Emap.Bind( CurEdge, emptyseq );
}
EInter.InitPoint();
for (; EInter.MorePoint(); EInter.NextPoint())
{
const TopOpeBRep_Point2d& bp = EInter.Point();
if (bp.IsVertex(2))
{
gp_Pnt Pnt = bp.Value();
Standard_Integer ied = 0;
for (j = 1; j <= pts.Length(); j++)
if (Pnt.IsEqual( pts(j), Precision::Confusion() ))
{
ied = j;
break;
}
if (ied == 0)
{
pts.Append( Pnt );
edges.Append( anEdge );
pars.Append( bp.Parameter(2) );
Emap(CurEdge).Append( bp.Parameter(1) );
ParsNonSeam(ind).Append( bp.Parameter(2) );
Seam(ind).Append( CurEdge );
ParsSeam(ind).Append( bp.Parameter(1) );
}
/*
else
{
Standard_Real ParOnSeam = bp.Parameter(1);
Standard_Real Par1 = pars(ied);
Standard_Real Par2 = bp.Parameter(2);
BRepAdaptor_Curve2d SeamCurve( CurEdge, CurFace );
BRepAdaptor_Curve2d Curve1( edges(ied), CurFace );
BRepAdaptor_Curve2d Curve2( anEdge. CurFace );
gp_Pnt2d P2d;
gp_Vec2d SeamDer, Der1, Der2;
//SeamCurve->D1( ParOnSeam, P2d, SeamDer );
//Curve1->D1( Par1, P2d, Der1 );
//Curve2->D1( Par2, P2d, Der2 );
Standard_Real Crossed1 = SeamDer ^ Der1;
Standard_Real Crossed2 = SeamDer ^ Der2;
//if (Crossed1 > 0
}
*/
}
else // ! bp.IsVertex(2)
{
//Temporary the case of tangency is not implemented
Emap(CurEdge).Append( bp.Parameter(1) );
ParsNonSeam(ind).Append( bp.Parameter(2) );
Seam(ind).Append( CurEdge );
ParsSeam(ind).Append( bp.Parameter(1) );
}
} //for (; EInter.MorePoint(); EInter.NextPoint())
} //for (; eit.More(); eit.Next())
if (Wadd)
{
if (! WWmap.IsBound( CurWire ))
{
TopTools_ListOfShape emptylist;
WWmap.Bind( CurWire, emptylist );
}
WWmap(CurWire).Append( aWire );
}
} //if (! aWire.IsSame( CurWire ))
} //for (; wit.More(); wit.Next())
} //for (i = 1; i <= Eseq.Length(); i++)
//Sorting
for (i = 1; i <= NonSeam.Length(); i++)
for (j = 1; j < ParsNonSeam(i).Length(); j++)
for (k = j+1; k <= ParsNonSeam(i).Length(); k++)
if (ParsNonSeam(i)(k) < ParsNonSeam(i)(j))
{
Standard_Real temp = ParsNonSeam(i)(j);
ParsNonSeam(i)(j) = ParsNonSeam(i)(k);
ParsNonSeam(i)(k) = temp;
TopoDS_Shape tmp = Seam(i)(j);
Seam(i)(j) = Seam(i)(k);
Seam(i)(k) = tmp;
temp = ParsSeam(i)(j);
ParsSeam(i)(j) = ParsSeam(i)(k);
ParsSeam(i)(k) = temp;
}
BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal iter( Emap );
for (; iter.More(); iter.Next())
{
TColStd_SequenceOfReal Seq;
Seq = iter.Value();
for (i = 1; i < Seq.Length(); i++)
for (j = i+1; j <= Seq.Length(); j++)
if (Seq(j) < Seq(i))
{
Standard_Real temp = Seq(i);
Seq(i) = Seq(j);
Seq(j) = temp;
}
Emap( iter.Key() ) = Seq;
}
BRepFill_DataMapOfShapeSequenceOfReal EPmap;
TopTools_DataMapOfShapeSequenceOfShape EVmap; //Seam
TopTools_DataMapOfShapeSequenceOfShape EWmap; //Seam and wires intersecting it
iter.Initialize( Emap );
for (; iter.More(); iter.Next())
{
TColStd_SequenceOfReal parseq;
EPmap.Bind( iter.Key(), parseq );
TopTools_SequenceOfShape shapeseq;
EVmap.Bind( iter.Key(), shapeseq );
TopTools_SequenceOfShape shapeseq2;
EWmap.Bind( iter.Key(), shapeseq2 );
}
//Reconstruction of non-seam edges
BRepTools_Substitution aSub;
BRep_Builder BB;
for (i = 1; i <= NonSeam.Length(); i++)
{
TopoDS_Edge anEdge = TopoDS::Edge( NonSeam(i) );
TopTools_ListOfShape NewEdges;
TopoDS_Edge NewE;
TopoDS_Vertex Vfirst, Vlast;
TopExp::Vertices( anEdge, Vfirst, Vlast );
Standard_Real par, FirstPar, LastPar;
BRep_Tool::Range( anEdge, FirstPar, LastPar );
Standard_Integer firstind = 1;
par = ParsNonSeam(i)(1);
TopoDS_Edge SeamEdge = TopoDS::Edge( Seam(i)(1) );
//Find the face
for (j = 1; j <= Eseq.Length(); j++)
if (SeamEdge.IsSame( Eseq(j) ))
break;
TopoDS_Face theFace = TopoDS::Face( Fseq(j) );
TopLoc_Location L;
Handle( Geom_Surface ) theSurf = BRep_Tool::Surface( theFace, L );
if (Abs(par-FirstPar) <= Precision::Confusion())
{
BB.UpdateVertex( Vfirst, ParsSeam(i)(1), SeamEdge, BRep_Tool::Tolerance(Vfirst) );
EPmap( SeamEdge ).Append( ParsSeam(i)(1) );
EVmap( SeamEdge ).Append( Vfirst );
EWmap( SeamEdge ).Append( NonSeamWires(i) );
firstind = 2;
}
Standard_Real prevpar = FirstPar;
TopoDS_Vertex PrevV = Vfirst;
for (j = firstind; j <= ParsNonSeam(i).Length(); j++)
{
TopoDS_Shape aLocalShape = anEdge.EmptyCopied();
NewE = TopoDS::Edge( aLocalShape );
//NewE = TopoDS::Edge( anEdge.EmptyCopied() );
TopoDS_Vertex NewV;
par = ParsNonSeam(i)(j);
BB.Range( NewE, prevpar, par );
SeamEdge = TopoDS::Edge( Seam(i)(j) );
if (j == ParsNonSeam(i).Length() && Abs(par-LastPar) <= Precision::Confusion())
{
NewV = Vlast;
if (firstind == 2 && j == 2)
{
BB.UpdateVertex( Vlast, ParsSeam(i)(j), SeamEdge, BRep_Tool::Tolerance(Vlast) );
EPmap( SeamEdge ).Append( ParsSeam(i)(j) );
EVmap( SeamEdge ).Append( Vlast );
EWmap( SeamEdge ).Append( NonSeamWires(i) );
break;
}
}
else
{
BRepAdaptor_Curve bcur( NewE );
gp_Pnt Point = bcur.Value( par );
NewV = BRepLib_MakeVertex( Point );
BB.UpdateVertex( NewV, par, NewE, 10.*Precision::Confusion() );
}
BB.UpdateVertex( NewV, ParsSeam(i)(j), SeamEdge, 10.*Precision::Confusion() );
NewE.Orientation( TopAbs_FORWARD );
BB.Add( NewE, PrevV.Oriented(TopAbs_FORWARD) );
BB.Add( NewE, NewV.Oriented(TopAbs_REVERSED) );
NewEdges.Append( NewE );
EPmap( SeamEdge ).Append( ParsSeam(i)(j) );
EVmap( SeamEdge ).Append( NewV );
EWmap( SeamEdge ).Append( NonSeamWires(i) );
prevpar = par;
PrevV = NewV;
}
//The last edge
TopoDS_Shape aLocalShape = anEdge.EmptyCopied();
NewE = TopoDS::Edge( aLocalShape );
//NewE = TopoDS::Edge( anEdge.EmptyCopied() );
par = LastPar;
if (Abs(prevpar-par) > Precision::Confusion())
{
BB.Range( NewE, prevpar, par );
NewE.Orientation( TopAbs_FORWARD );
BB.Add( NewE, PrevV.Oriented(TopAbs_FORWARD) );
BB.Add( NewE, Vlast.Oriented(TopAbs_REVERSED) );
NewEdges.Append( NewE );
}
//Substitute anEdge by NewEdges
aSub.Substitute( anEdge, NewEdges );
}
//Sorting of EPmap and EVmap and removing repeating points from them
iter.Initialize( EPmap );
for (; iter.More(); iter.Next())
{
TColStd_SequenceOfReal Seq;
Seq = iter.Value();
TopTools_SequenceOfShape SeqShape;
SeqShape = EVmap( iter.Key() );
TopTools_SequenceOfShape SeqShape2;
SeqShape2 = EWmap( iter.Key() );
for (i = 1; i < Seq.Length(); i++)
for (j = i+1; j <= Seq.Length(); j++)
if (Seq(j) < Seq(i))
{
Standard_Real temp = Seq(i);
Seq(i) = Seq(j);
Seq(j) = temp;
TopoDS_Shape tmp = SeqShape(i);
SeqShape(i) = SeqShape(j);
SeqShape(j) = tmp;
tmp = SeqShape2(i);
SeqShape2(i) = SeqShape2(j);
SeqShape2(j) = tmp;
}
EPmap( iter.Key() ) = Seq;
EVmap( iter.Key() ) = SeqShape;
EWmap( iter.Key() ) = SeqShape2;
}
iter.Initialize( EPmap );
for (; iter.More(); iter.Next())
{
TColStd_SequenceOfReal Seq;
Seq = iter.Value();
TopTools_SequenceOfShape SeqShape;
SeqShape = EVmap( iter.Key() );
TopTools_SequenceOfShape SeqShape2;
SeqShape2 = EWmap( iter.Key() );
Standard_Boolean remove = Standard_True;
while (remove)
{
remove = Standard_False;
for (i = 1; i < Seq.Length(); i++)
if (Abs(Seq(i)-Seq(i+1)) <= Precision::Confusion())
{
Seq.Remove(i+1);
SeqShape.Remove(i+1);
SeqShape2.Remove(i+1);
remove = Standard_True;
}
}
EPmap( iter.Key() ) = Seq;
EVmap( iter.Key() ) = SeqShape;
EWmap( iter.Key() ) = SeqShape2;
}
//Reconstruction of seam edges
TopTools_DataMapOfShapeShape VEmap;
iter.Initialize( Emap );
for (; iter.More(); iter.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge( iter.Key() );
Standard_Boolean onepoint = Standard_False;
TopTools_ListOfShape NewEdges;
TColStd_SequenceOfReal Seq;
Seq = iter.Value();
TColStd_SequenceOfReal Seq2;
Seq2 = EPmap( anEdge );
TopTools_SequenceOfShape SeqVer;
SeqVer = EVmap( anEdge );
TopTools_SequenceOfShape SeqWire;
SeqWire = EWmap( anEdge );
TopoDS_Vertex Vfirst, Vlast;
TopExp::Vertices( anEdge, Vfirst, Vlast );
Standard_Real fpar, lpar, FirstPar, LastPar;
BRep_Tool::Range( anEdge, FirstPar, LastPar );
fpar = FirstPar;
lpar = Seq(1);
TopoDS_Edge NewE;
Standard_Integer firstind = 1;
if (Abs(fpar-lpar) <= Precision::Confusion())
{
firstind = 2;
fpar = Seq(1);
lpar = Seq(2);
}
else
{
if (Seq.Length()%2 != 0)
{
VEmap.Bind( Vfirst, anEdge );
firstind = 2;
fpar = Seq(1);
if (Seq.Length() > 2)
lpar = Seq(2);
else
onepoint = Standard_True;
}
}
if (!onepoint)
{
TopoDS_Shape aLocalShape = anEdge.EmptyCopied();
NewE = TopoDS::Edge( aLocalShape );
//NewE = TopoDS::Edge( anEdge.EmptyCopied() );
BB.Range( NewE, fpar, lpar );
NewE.Orientation( TopAbs_FORWARD );
if (firstind == 1)
{
BB.Add( NewE, Vfirst.Oriented(TopAbs_FORWARD) );
aLocalShape = SeqVer(1).Oriented(TopAbs_REVERSED);
BB.Add( NewE, TopoDS::Vertex( aLocalShape ) );
//BB.Add( NewE, TopoDS::Vertex( SeqVer(1).Oriented(TopAbs_REVERSED) ) );
}
else
{
aLocalShape = SeqVer(1).Oriented(TopAbs_FORWARD);
BB.Add( NewE, TopoDS::Vertex( aLocalShape ) );
aLocalShape = SeqVer(2).Oriented(TopAbs_REVERSED);
BB.Add( NewE, TopoDS::Vertex( aLocalShape ) );
//BB.Add( NewE, TopoDS::Vertex( SeqVer(1).Oriented(TopAbs_FORWARD) ) );
//BB.Add( NewE, TopoDS::Vertex( SeqVer(2).Oriented(TopAbs_REVERSED) ) );
}
NewEdges.Append( NewE );
firstind++;
for (i = firstind; i < Seq.Length(); i += 2)
{
aLocalShape = anEdge.EmptyCopied();
NewE = TopoDS::Edge( aLocalShape );
//NewE = TopoDS::Edge( anEdge.EmptyCopied() );
fpar = Seq(i);
lpar = Seq(i+1);
BB.Range( NewE, fpar, lpar );
//Find vertices
for (j = 1; j <= Seq2.Length(); j++)
if (Abs(fpar-Seq2(j)) <= Precision::Confusion())
break;
NewE.Orientation( TopAbs_FORWARD );
TopoDS_Shape aLocalShape = SeqVer(j).Oriented(TopAbs_FORWARD);
BB.Add( NewE, TopoDS::Vertex( aLocalShape ) );
aLocalShape = SeqVer(j+1).Oriented(TopAbs_REVERSED);
BB.Add( NewE, TopoDS::Vertex( aLocalShape ) );
//BB.Add( NewE, TopoDS::Vertex( SeqVer(j).Oriented(TopAbs_FORWARD) ) );
//BB.Add( NewE, TopoDS::Vertex( SeqVer(j+1).Oriented(TopAbs_REVERSED) ) );
NewEdges.Append( NewE );
}
}
i = Seq.Length();
fpar = Seq(i);
lpar = LastPar;
if (Abs(fpar-lpar) <= Precision::Confusion())
continue;
TopoDS_Shape aLocalShape = anEdge.EmptyCopied();
NewE = TopoDS::Edge( aLocalShape );
//NewE = TopoDS::Edge( anEdge.EmptyCopied() );
BB.Range( NewE, fpar, lpar );
NewE.Orientation( TopAbs_FORWARD );
aLocalShape = SeqVer(SeqVer.Length()).Oriented(TopAbs_FORWARD);
BB.Add( NewE, TopoDS::Vertex( aLocalShape ) );
//BB.Add( NewE, TopoDS::Vertex( SeqVer(SeqVer.Length()).Oriented(TopAbs_FORWARD) ) );
BB.Add( NewE, Vlast.Oriented(TopAbs_REVERSED) );
NewEdges.Append( NewE );
//Substitute anEdge by NewEdges
aSub.Substitute( anEdge, NewEdges );
}
//Removing edges connected with missing extremities of seam edges
TopTools_DataMapIteratorOfDataMapOfShapeShape itve( VEmap );
for (; itve.More(); itve.Next())
{
TopoDS_Shape V = itve.Key();
TopoDS_Shape E = itve.Value();
TopoDS_Shape W;
for (i = 1; i <= Eseq.Length(); i++)
if (E.IsSame( Eseq(i) ))
{
W = Wseq(i);
break;
}
TopoDS_Shape Etoremove;
eit.Initialize( W );
for (; eit.More(); eit.Next())
{
TopoDS_Edge CurE = TopoDS::Edge( eit.Value() );
if (CurE.IsSame( E ))
continue;
TopoDS_Vertex Vfirst, Vlast;
TopExp::Vertices( CurE, Vfirst, Vlast );
if (Vfirst.IsSame( V ) || Vlast.IsSame( V ))
{
Etoremove = CurE;
break;
}
}
if (! Etoremove.IsNull())
{
W.Free( Standard_True );
BB.Remove( W, Etoremove );
}
}
aSub.Build( myShape );
if (aSub.IsCopied( myShape ))
{
const TopTools_ListOfShape& listSh = aSub.Copy( myShape );
if (! listSh.IsEmpty())
myShape = listSh.First();
}
//Reconstruction of wires
TopTools_ListOfShape theCopy;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itww( WWmap );
for (; itww.More(); itww.Next())
{
CurWire = itww.Key();
theCopy = aSub.Copy( CurWire );
CurWire = theCopy.First();
CurWire.Free( Standard_True );
TopTools_ListIteratorOfListOfShape itl( itww.Value() );
for (; itl.More(); itl.Next())
{
TopoDS_Shape aWire = itl.Value();
CurFace = WFmap( aWire );
theCopy = aSub.Copy( aWire );
aWire = theCopy.First();
//Adjusting period
TopLoc_Location L;
Handle( Geom_Surface ) theSurf = BRep_Tool::Surface( TopoDS::Face(CurFace), L );
eit.Initialize( aWire );
for (; eit.More(); eit.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge( eit.Value() );
gp_Pnt2d Pfirst, Plast, Pmid;
BRep_Tool::UVPoints( anEdge, TopoDS::Face(CurFace), Pfirst, Plast );
BRepAdaptor_Curve2d bc2d( anEdge, TopoDS::Face(CurFace) );
Pmid = bc2d.Value( (bc2d.FirstParameter()+bc2d.LastParameter())/2. );
gp_Vec2d offset;
Standard_Boolean translate = Standard_False;
if (Pfirst.X()-2.*PI > Precision::Confusion() ||
Plast.X()-2.*PI > Precision::Confusion() ||
Pmid.X()-2.*PI > Precision::Confusion())
{
offset.SetCoord( -2.*PI, 0 );
translate = Standard_True;
}
if (Pfirst.X() < -Precision::Confusion() ||
Plast.X() < -Precision::Confusion() ||
Pmid.X() < -Precision::Confusion())
{
offset.SetCoord( 2.*PI, 0 );
translate = Standard_True;
}
if (translate)
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &anEdge.TShape());
BRep_ListIteratorOfListOfCurveRepresentation itcr( TE->ChangeCurves() );
Handle(BRep_GCurve) GC;
for (; itcr.More(); itcr.Next())
{
GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
if (!GC.IsNull() && GC->IsCurveOnSurface( theSurf, L ))
{
Handle(Geom2d_Curve) PC = GC->PCurve();
PC = Handle(Geom2d_Curve)::DownCast( PC->Translated( offset ) );
GC->PCurve( PC );
TE->ChangeCurves().Remove( itcr );
TE->ChangeCurves().Append( GC );
break;
}
}
}
}
///////////////////
eit.Initialize( aWire, Standard_False );
for (; eit.More(); eit.Next())
{
TopoDS_Shape anEdge = eit.Value();
BB.Add( CurWire, anEdge );
}
if (aSub.IsCopied( CurFace ))
{
theCopy = aSub.Copy( CurFace );
CurFace = theCopy.First();
}
CurFace.Free( Standard_True );
BB.Remove( CurFace, aWire );
}
}
}

View File

@@ -0,0 +1,161 @@
-- File: BRepOffsetAPI_FindContigousEdges.cdl
-- Created: Tue May 2 11:38:44 1995
-- Author: Jing Cheng MEI
-- <mei@junon>
---Copyright: Matra Datavision 1995
class FindContigousEdges from BRepOffsetAPI
---Purpose: Provides methods to identify contigous boundaries
-- for continuity control (C0, C1, ...)
--
-- Use this function as following:
-- - create an object
-- - default tolerance 1.E-06
-- - with analysis of degenerated faces on
-- - define if necessary a new tolerance
-- - set if necessary analysis of degenerated shapes off
-- - add shapes to be controlled -> Add
-- - compute -> Perfom
-- - output couples of connected edges for control
-- - output the problems if any
uses
Edge from TopoDS,
Shape from TopoDS,
ListOfShape from TopTools,
Sewing from BRepBuilderAPI
raises
OutOfRange from Standard,
NoSuchObject from Standard
is
Create(tolerance: Real = 1.0e-06; -- tolerance of connexity
option: Boolean = Standard_True) -- option for analysis of degenerated shapes
---Purpose: Initializes an algorithm for identifying contiguous edges
-- on shapes with tolerance as the tolerance of contiguity
-- (defaulted to 1.0e-6). This tolerance value is used to
-- determine whether two edges or sections of edges are coincident.
-- Use the function Add to define the shapes to be checked.
-- Set option to false. This argument (defaulted to true) will
-- serve in subsequent software releases for performing an
-- analysis of degenerated shapes.
returns FindContigousEdges from BRepOffsetAPI;
Init(me: in out; tolerance: Real; option: Boolean);
---Purpose: Initializes this algorithm for identifying contiguous edges
-- on shapes using the tolerance of contiguity tolerance.
-- This tolerance value is used to determine whether two
-- edges or sections of edges are coincident.
-- Use the function Add to define the shapes to be checked.
-- Sets <option> to false.
Add(me: in out; shape: Shape from TopoDS);
---Purpose: Adds the shape shape to the list of shapes to be
-- checked by this algorithm.
-- Once all the shapes to be checked have been added,
-- use the function Perform to find the contiguous edges
-- and the function ContigousEdge to return these edges.
Perform(me: in out);
---Purpose: Finds coincident parts of edges of two or more shapes
-- added to this algorithm and breaks down these edges
-- into contiguous and non-contiguous sections on copies
-- of the initial shapes.
-- The function ContigousEdge returns contiguous
-- edges. The function Modified can be used to return
-- modified copies of the initial shapes where one or more
-- edges were broken down into contiguous and non-contiguous sections.
-- Warning
-- This function must be used once all the shapes to be
-- checked have been added. It is not possible to add
-- further shapes subsequently and then to repeat the call to Perform.
NbEdges(me) returns Integer;
---Purpose: Gives the number of edges (free edges + contigous
-- edges + multiple edge)
NbContigousEdges(me) returns Integer;
---Purpose: Returns the number of contiguous edges found by the
-- function Perform on the shapes added to this algorithm.
ContigousEdge(me; index: Integer) returns Edge from TopoDS
---Purpose: Returns the contiguous edge of index index found by
-- the function Perform on the shapes added to this algorithm.
-- Exceptions
-- Standard_OutOfRange if:
-- - index is less than 1, or
-- - index is greater than the number of contiguous
-- edges found by the function Perform on the shapes added to this algorithm.
---C++: return const &
raises
OutOfRange from Standard;
ContigousEdgeCouple(me; index: Integer) returns ListOfShape from TopTools
---Purpose: Returns a list of edges coincident with the contiguous
-- edge of index index found by the function Perform.
-- There are as many edges in the list as there are faces
-- adjacent to this contiguous edge.
-- Exceptions
-- Standard_OutOfRange if:
-- - index is less than 1, or
-- - index is greater than the number of contiguous edges
-- found by the function Perform on the shapes added to this algorithm.
---C++: return const &
raises
OutOfRange from Standard;
SectionToBoundary(me; section: Edge from TopoDS) returns Edge from TopoDS
---Purpose: Returns the edge on the initial shape, of which the
-- modified copy contains the edge section.
-- section is coincident with a contiguous edge found by
-- the function Perform. Use the function
-- ContigousEdgeCouple to obtain a valid section.
-- This information is useful for verification purposes, since
-- it provides a means of determining the surface to which
-- the contiguous edge belongs.
-- Exceptions
-- Standard_NoSuchObject if section is not coincident
-- with a contiguous edge. Use the function
-- ContigousEdgeCouple to obtain a valid section.
---C++: return const &
raises
NoSuchObject from Standard;
NbDegeneratedShapes(me) returns Integer;
---Purpose: Gives the number of degenerated shapes
DegeneratedShape(me; index: Integer) returns Shape from TopoDS
---Purpose: Gives a degenerated shape
---C++: return const &
raises
OutOfRange from Standard;
-- raised if index < 1 or > NbDegeneratedShapes
IsDegenerated(me; shape: Shape from TopoDS) returns Boolean;
---Purpose: Indicates if a input shape is degenerated
IsModified(me; shape: Shape from TopoDS) returns Boolean;
---Purpose: Returns true if the copy of the initial shape shape was
-- modified by the function Perform (i.e. if one or more of
-- its edges was broken down into contiguous and non-contiguous sections).
-- Warning
-- Returns false if shape is not one of the initial shapes
-- added to this algorithm.
Modified(me; shape: Shape from TopoDS) returns Shape from TopoDS
---Purpose: Gives a modifieded shape
-- Raises NoSuchObject if shape has not been modified
---C++: return const &
raises
NoSuchObject from Standard;
Dump(me);
---Purpose: Dump properties of resulting shape.
fields
mySewing : Sewing from BRepBuilderAPI;
end FindContigousEdges;

View File

@@ -0,0 +1,158 @@
// File: BRepOffsetAPI_FindContigousEdges.cxx
// Created: Fri May 5 09:45:44 1995
// Author: Jing Cheng MEI
// <mei@junon>
#include <BRepOffsetAPI_FindContigousEdges.ixx>
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepOffsetAPI_FindContigousEdges::BRepOffsetAPI_FindContigousEdges(const Standard_Real tolerance,
const Standard_Boolean option)
{
mySewing = new BRepBuilderAPI_Sewing;
Init(tolerance, option);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepOffsetAPI_FindContigousEdges::Init(const Standard_Real tolerance,
const Standard_Boolean option)
{
mySewing->Init(tolerance, option, Standard_False,Standard_True);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void BRepOffsetAPI_FindContigousEdges::Add(const TopoDS_Shape& aShape)
{
mySewing->Add(aShape);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepOffsetAPI_FindContigousEdges::Perform()
{
mySewing->Perform();
}
//=======================================================================
//function : NbContigousEdges
//purpose :
//=======================================================================
Standard_Integer BRepOffsetAPI_FindContigousEdges::NbContigousEdges() const
{
return mySewing->NbContigousEdges();
}
//=======================================================================
//function : ContigousEdge
//purpose :
//=======================================================================
const TopoDS_Edge& BRepOffsetAPI_FindContigousEdges::ContigousEdge(const Standard_Integer index) const
{
Standard_OutOfRange_Raise_if(index < 0 || index > NbContigousEdges(), "BRepOffsetAPI_FindContigousEdges::ContigousEdge");
return mySewing->ContigousEdge(index);
}
//=======================================================================
//function : ContigousEdgeCouple
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_FindContigousEdges::ContigousEdgeCouple(const Standard_Integer index) const
{
Standard_OutOfRange_Raise_if(index < 0 || index > NbContigousEdges(), "BRepOffsetAPI_FindContigousEdges::ContigousEdgeCouple");
return mySewing->ContigousEdgeCouple(index);
}
//=======================================================================
//function : SectionToBoundary
//purpose :
//=======================================================================
const TopoDS_Edge& BRepOffsetAPI_FindContigousEdges::SectionToBoundary(const TopoDS_Edge& section) const
{
Standard_NoSuchObject_Raise_if(!mySewing->IsSectionBound(section), "BRepOffsetAPI_FindContigousEdges::SectionToBoundary");
return mySewing->SectionToBoundary(section);
}
//=======================================================================
//function : NbDegeneratedShapes
//purpose :
//=======================================================================
Standard_Integer BRepOffsetAPI_FindContigousEdges::NbDegeneratedShapes() const
{
return mySewing->NbDegeneratedShapes();
}
//=======================================================================
//function : DegeneratedShape
//purpose :
//=======================================================================
const TopoDS_Shape& BRepOffsetAPI_FindContigousEdges::DegeneratedShape(const Standard_Integer index) const
{
Standard_OutOfRange_Raise_if(index < 0 || index > NbDegeneratedShapes(), "BRepOffsetAPI_FindContigousEdges::DegereratedShape");
return mySewing->DegeneratedShape(index);
}
//=======================================================================
//function : IsDegenerated
//purpose :
//=======================================================================
Standard_Boolean BRepOffsetAPI_FindContigousEdges::IsDegenerated(const TopoDS_Shape& aShape) const
{
return mySewing->IsDegenerated(aShape);
}
//=======================================================================
//function : IsModified
//purpose :
//=======================================================================
Standard_Boolean BRepOffsetAPI_FindContigousEdges::IsModified(const TopoDS_Shape& aShape) const
{
return mySewing->IsModified(aShape);
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopoDS_Shape& BRepOffsetAPI_FindContigousEdges::Modified(const TopoDS_Shape& aShape) const
{
Standard_NoSuchObject_Raise_if(!IsModified(aShape),"BRepOffsetAPI_FindContigousEdges::Modified");
return mySewing->Modified(aShape);
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void BRepOffsetAPI_FindContigousEdges::Dump() const
{
mySewing->Dump();
}

View File

@@ -0,0 +1,119 @@
-- File: BRepOffsetAPI_MakeDraft.cdl
-- Created: Wed Jan 13 12:03:48 1999
-- Author: Philippe MANGIN
-- <pmn@sgi29>
---Copyright: Matra Datavision 1999
class MakeDraft from BRepOffsetAPI inherits MakeShape from BRepBuilderAPI
---Purpose: Build a draft surface along a wire
-- The wire can be defined by
-- - a wire
-- - a face (the forward wire)
-- - a shell (the free bounds)
-- The Draft geometry is defined by
-- A wire, a direction and angle between the line section
-- and the dircection
-- The Draft can be limited by
-- a length of the segment to sweep
-- a surface
-- a shape
uses
Shape from TopoDS,
Shell from TopoDS,
Dir from gp,
ListOfShape from TopTools,
TransitionMode from BRepBuilderAPI,
Draft from BRepFill,
Surface from Geom
raises
NotDone,
NoSuchObject
is
Create(Shape : Shape from TopoDS;
Dir : Dir from gp;
Angle : Real)
---Purpose: Constructs the draft surface object defined by the shape
-- Shape, the direction Dir, and the angle Angle.
-- Shape must be a TopoDS_Wire, Topo_DS_Face or
-- TopoDS_Shell with free boundaries.
-- Exceptions
-- Standard_NotDone if Shape is not a TopoDS_Wire,
-- Topo_DS_Face or TopoDS_Shell with free boundaries.
returns MakeDraft from BRepOffsetAPI;
SetOptions(me : in out;
Style : TransitionMode from BRepBuilderAPI = BRepBuilderAPI_RightCorner;
AngleMin : Real = 0.01;
AngleMax : Real = 3.0)
---Purpose: Sets the options of this draft tool.
-- If a transition has to be performed, it can be defined by
-- the mode Style as RightCorner or RoundCorner,
-- RightCorner being a corner defined by a sharp angle,
-- and RoundCorner being a rounded corner.
-- AngleMin is an angular tolerance used to detect
-- whether a transition has to be performed or not.
-- AngleMax sets the maximum value within which a
-- RightCorner transition can be performed.
-- AngleMin and AngleMax are expressed in radians.
is static;
SetDraft(me: in out; IsInternal : Boolean = Standard_False)
---Purpose: Sets the direction of the draft for this object.
-- If IsInternal is true, the draft is internal to the argument
-- Shape used in the constructor.
is static;
Perform(me : in out;
LengthMax : Real)
---Purpose: Performs the draft using the length LengthMax as the
-- maximum length for the corner edge between two draft faces.
is static;
Perform(me : in out;
Surface : Surface from Geom;
KeepInsideSurface : Boolean = Standard_True)
---Purpose: Performs the draft up to the surface Surface.
-- If KeepInsideSurface is true, the part of Surface inside
-- the draft is kept in the result.
is static;
Perform(me : in out;
StopShape : Shape from TopoDS;
KeepOutSide : Boolean = Standard_True)
---Purpose: Performs the draft up to the shape StopShape.
-- If KeepOutSide is true, the part of StopShape which is
-- outside the Draft is kept in the result.
is static;
Shell(me)
---Purpose: Returns the shell resulting from performance of the
-- draft along the wire.
returns Shell from TopoDS
raises NotDone;
-- Error(me) returns MakeDraftError from BRepBuilderAPI
-- ---Level: Public
-- is static;
Generated (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes generated from the
-- shape <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined;
fields
myDraft : Draft from BRepFill;
end MakeDraft;

View File

@@ -0,0 +1,64 @@
#include <BRepOffsetAPI_MakeDraft.ixx>
BRepOffsetAPI_MakeDraft::BRepOffsetAPI_MakeDraft(const TopoDS_Shape& Shape,
const gp_Dir& Dir,
const Standard_Real Angle)
: myDraft( Shape, Dir, Angle)
{
NotDone();
}
void BRepOffsetAPI_MakeDraft::SetOptions(const BRepBuilderAPI_TransitionMode Style,
const Standard_Real AngleMin,
const Standard_Real AngleMax)
{
BRepFill_TransitionStyle style = BRepFill_Right;
if (Style == BRepBuilderAPI_RoundCorner) style = BRepFill_Round;
myDraft.SetOptions( style, AngleMin, AngleMax);
}
void BRepOffsetAPI_MakeDraft::SetDraft(const Standard_Boolean IsInternal)
{
myDraft.SetDraft(IsInternal);
}
void BRepOffsetAPI_MakeDraft::Perform(const Standard_Real LengthMax)
{
myDraft.Perform( LengthMax);
if (myDraft.IsDone()) {
Done();
myShape = myDraft.Shape();
}
}
void BRepOffsetAPI_MakeDraft::Perform(const Handle(Geom_Surface)& Surface,
const Standard_Boolean KeepInsideSurface)
{
myDraft.Perform(Surface, KeepInsideSurface);
if (myDraft.IsDone()) {
Done();
myShape = myDraft.Shape();
}
}
void BRepOffsetAPI_MakeDraft::Perform(const TopoDS_Shape& StopShape,
const Standard_Boolean KeepOutSide)
{
myDraft.Perform( StopShape, KeepOutSide);
if (myDraft.IsDone()) {
Done();
myShape = myDraft.Shape();
}
}
TopoDS_Shell BRepOffsetAPI_MakeDraft::Shell() const
{
return myDraft.Shell();
}
const TopTools_ListOfShape& BRepOffsetAPI_MakeDraft::Generated(const TopoDS_Shape& S)
{
return myDraft.Generated( S );
}

View File

@@ -0,0 +1,121 @@
-- File: BRepOffsetAPI_MakeEvolved.cdl
-- Created: Mon Sep 18 13:24:14 1995
-- Author: Bruno DUMORTIER
-- <dub@fuegox>
---Copyright: Matra Datavision 1995
class MakeEvolved from BRepOffsetAPI inherits MakeShape from BRepBuilderAPI
---Purpose: Describes functions to build evolved shapes.
-- An evolved shape is built from a planar spine (face or
-- wire) and a profile (wire). The evolved shape is the
-- unlooped sweep (pipe) of the profile along the spine.
-- Self-intersections are removed.
-- A MakeEvolved object provides a framework for:
-- - defining the construction of an evolved shape,
-- - implementing the construction algorithm, and
-- - consulting the result.
-- Computes an Evolved by
-- 1 - sweeping a profil along a spine.
-- 2 - removing the self-intersections.
--
-- The profile is defined in a Referential R. The position of
-- the profile at the current point of the spine is given by
-- confusing R and the local referential given by ( D0, D1
-- and the normal of the Spine)
--
-- If the Boolean <AxeProf> is true, R is O,X,Y,Z
-- else R is defined as the local refential at the nearest
-- point of the profil to the spine.
--
-- if <Solid> is TRUE the Shape result is completed to be a
-- solid or a compound of solids.
uses
Evolved from BRepFill,
ListOfShape from TopTools,
Shape from TopoDS,
Face from TopoDS,
Wire from TopoDS,
JoinType from GeomAbs
is
Create returns MakeEvolved from BRepOffsetAPI;
Create( Spine : Wire from TopoDS;
Profil : Wire from TopoDS;
Join : JoinType from GeomAbs = GeomAbs_Arc;
AxeProf : Boolean from Standard = Standard_True;
Solid : Boolean from Standard = Standard_False;
ProfOnSpine: Boolean from Standard = Standard_False;
Tol : Real from Standard = 0.0000001)
---Purpose:
---Level: Public
returns MakeEvolved from BRepOffsetAPI;
Create( Spine : Face from TopoDS;
Profil : Wire from TopoDS;
Join : JoinType from GeomAbs = GeomAbs_Arc;
AxeProf : Boolean from Standard = Standard_True;
Solid : Boolean from Standard = Standard_False;
ProfOnSpine: Boolean from Standard = Standard_False;
Tol : Real from Standard = 0.0000001)
---Purpose: These constructors construct an evolved shape by sweeping the profile
-- Profile along the spine Spine.
-- The profile is defined in a coordinate system R.
-- The coordinate system is determined by AxeProf:
-- - if AxeProf is true, R is the global coordinate system,
-- - if AxeProf is false, R is computed so that:
-- - its origin is given by the point on the spine which is
-- closest to the profile,
-- - its "X Axis" is given by the tangent to the spine at this point, and
-- - its "Z Axis" is the normal to the plane which contains the spine.
-- The position of the profile at the current point of the
-- spine is given by making R coincident with the local
-- coordinate system given by the current point, the
-- tangent vector and the normal to the spine.
-- Join defines the type of pipe generated by the salient
-- vertices of the spine. The default type is GeomAbs_Arc
-- where the vertices generate revolved pipes about the
-- axis passing along the vertex and the normal to the
-- plane of the spine. At present, this is the only
-- construction type implemented.
returns MakeEvolved from BRepOffsetAPI;
Evolved(me) returns Evolved from BRepFill
---C++: return const &
---Level: Advanced
is static;
Build(me : in out)
is redefined;
---Purpose: Builds the resulting shape (redefined from MakeShape).
---Level: Public
GeneratedShapes (me ;
SpineShape : Shape from TopoDS;
ProfShape : Shape from TopoDS)
---Purpose: Returns the shapes created from a subshape
-- <SpineShape> of the spine and a subshape
-- <ProfShape> on the profile.
---C++ : return const &
returns ListOfShape from TopTools
is static;
Top (me) returns Shape from TopoDS
---Purpose: Return the face Top if <Solid> is True in the constructor.
---C++ : return const &
is static;
Bottom (me) returns Shape from TopoDS
---Purpose: Return the face Bottom if <Solid> is True in the constructor.
---C++ : return const &
is static;
fields
myEvolved : Evolved from BRepFill;
end MakeEvolved;

View File

@@ -0,0 +1,133 @@
// File: BRepOffsetAPI_MakeEvolved.cxx
// Created: Mon Sep 18 14:27:09 1995
// Author: Bruno DUMORTIER
// <dub@fuegox>
#include <BRepOffsetAPI_MakeEvolved.ixx>
#include <gp_Ax3.hxx>
#include <BRepFill.hxx>
//=======================================================================
//function : BRepOffsetAPI_MakeEvolved
//purpose :
//=======================================================================
BRepOffsetAPI_MakeEvolved::BRepOffsetAPI_MakeEvolved()
{
}
//=======================================================================
//function : BRepOffsetAPI_MakeEvolved
//purpose :
//=======================================================================
BRepOffsetAPI_MakeEvolved::BRepOffsetAPI_MakeEvolved(const TopoDS_Wire& Spine,
const TopoDS_Wire& Profil,
const GeomAbs_JoinType Join,
const Standard_Boolean AxeProf,
const Standard_Boolean Solid,
const Standard_Boolean ProfOnSpine,
const Standard_Real Tol)
{
gp_Ax3 Axis(gp_Pnt(0.,0.,0.),
gp_Dir(0.,0.,1.),
gp_Dir(1.,0.,0.));
if ( !AxeProf) {
Standard_Boolean POS;
BRepFill::Axe(Spine,Profil,Axis,POS,Tol);
if (ProfOnSpine && !POS) return;
}
myEvolved.Perform(Spine,Profil,Axis,Join,Solid);
Build();
Done();
}
//=======================================================================
//function : BRepOffsetAPI_MakeEvolved
//purpose :
//=======================================================================
BRepOffsetAPI_MakeEvolved::BRepOffsetAPI_MakeEvolved(const TopoDS_Face& Spine,
const TopoDS_Wire& Profil,
const GeomAbs_JoinType Join,
const Standard_Boolean AxeProf,
const Standard_Boolean Solid,
const Standard_Boolean ProfOnSpine,
const Standard_Real Tol)
{
gp_Ax3 Axis(gp_Pnt(0.,0.,0.),
gp_Dir(0.,0.,1.),
gp_Dir(1.,0.,0.));
if ( !AxeProf) {
Standard_Boolean POS;
BRepFill::Axe(Spine,Profil,Axis,POS,Tol);
if (ProfOnSpine && !POS) return;
}
myEvolved.Perform(Spine,Profil,Axis,Join,Solid);
Build();
}
//=======================================================================
//function : BRepFill_Evolved&
//purpose :
//=======================================================================
const BRepFill_Evolved& BRepOffsetAPI_MakeEvolved::Evolved() const
{
return myEvolved;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void BRepOffsetAPI_MakeEvolved::Build()
{
myShape = myEvolved.Shape();
if (myEvolved.IsDone()) Done();
}
//=======================================================================
//function : Top
//purpose :
//=======================================================================
const TopoDS_Shape& BRepOffsetAPI_MakeEvolved::Top() const
{
return myEvolved.Top();
}
//=======================================================================
//function : Bottom
//purpose :
//=======================================================================
const TopoDS_Shape& BRepOffsetAPI_MakeEvolved::Bottom() const
{
return myEvolved.Bottom();
}
//=======================================================================
//function : GeneratedShapes
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_MakeEvolved::GeneratedShapes (
const TopoDS_Shape& SpineShape,
const TopoDS_Shape& ProfShape )
const
{
return myEvolved.GeneratedShapes(SpineShape,ProfShape);
}

View File

@@ -0,0 +1,233 @@
-- File: BRepOffsetAPI_MakeFilling.cdl
-- Created: Wed Aug 26 09:31:31 1998
-- Author: Julia GERASIMOVA
-- <jgv@clubox.nnov.matra-dtv.fr>
---Copyright: Matra Datavision 1998
class MakeFilling from BRepOffsetAPI inherits MakeShape from BRepBuilderAPI
---Purpose: N-Side Filling
-- This algorithm avoids to build a face from:
-- * a set of edges defining the bounds of the face and some
-- constraints the surface of the face has to satisfy
-- * a set of edges and points defining some constraints
-- the support surface has to satisfy
-- * an initial surface to deform for satisfying the constraints
-- * a set of parameters to control the constraints.
--
-- The support surface of the face is computed by deformation
-- of the initial surface in order to satisfy the given constraints.
-- The set of bounding edges defines the wire of the face.
--
-- If no initial surface is given, the algorithm computes it
-- automatically.
-- If the set of edges is not connected (Free constraint)
-- missing edges are automatically computed.
--
-- Limitations:
-- * If some constraints are not compatible
-- The algorithm does not take them into account.
-- So the constraints will not be satisfyed in an area containing
-- the incompatibilitries.
-- * The constraints defining the bound of the face have to be
-- entered in order to have a continuous wire.
--
-- Other Applications:
-- * Deformation of a face to satisfy internal constraints
-- * Deformation of a face to improve Gi continuity with
-- connected faces
---Level: Advanced
uses
Shape from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Pnt from gp,
Shape from GeomAbs,
Filling from BRepFill
raises
NotDone,
OutOfRange,
ConstructionError
is
Create( Degree : Integer from Standard = 3;
NbPtsOnCur : Integer from Standard = 15;
NbIter : Integer from Standard = 2;
Anisotropie : Boolean from Standard = Standard_False;
Tol2d : Real from Standard = 0.00001;
Tol3d : Real from Standard = 0.0001;
TolAng : Real from Standard = 0.01;
TolCurv : Real from Standard = 0.1;
MaxDeg : Integer from Standard = 8;
MaxSegments : Integer from Standard = 9 )
---Purpose: Constructs a wire filling object defined by
-- - the energy minimizing criterion Degree
-- - the number of points on the curve NbPntsOnCur
-- - the number of iterations NbIter
-- - the Boolean Anisotropie
-- - the 2D tolerance Tol2d
-- - the 3D tolerance Tol3d
-- - the angular tolerance TolAng
-- - the tolerance for curvature TolCur
-- - the highest polynomial degree MaxDeg
-- - the greatest number of segments MaxSeg.
-- If the Boolean Anistropie is true, the algorithm's
-- performance is better in cases where the ratio of the
-- length U and the length V indicate a great difference
-- between the two. In other words, when the surface is, for
-- example, extremely long.
returns MakeFilling from BRepOffsetAPI;
SetConstrParam( me : in out; Tol2d : Real from Standard = 0.00001;
Tol3d : Real from Standard = 0.0001;
TolAng : Real from Standard = 0.01;
TolCurv : Real from Standard = 0.1 );
---Purpose: Sets the values of Tolerances used to control the constraint.
-- Tol2d:
-- Tol3d: it is the maximum distance allowed between the support surface
-- and the constraints
-- TolAng: it is the maximum angle allowed between the normal of the surface
-- and the constraints
-- TolCurv: it is the maximum difference of curvature allowed between
-- the surface and the constraint
SetResolParam( me : in out; Degree : Integer from Standard = 3;
NbPtsOnCur : Integer from Standard = 15;
NbIter : Integer from Standard = 2;
Anisotropie : Boolean from Standard = Standard_False );
---Purpose: Sets the parameters used for resolution.
-- The default values of these parameters have been chosen for a good
-- ratio quality/performance.
-- Degree: it is the order of energy criterion to minimize for computing
-- the deformation of the surface.
-- The default value is 3
-- The recommanded value is i+2 where i is the maximum order of the
-- constraints.
-- NbPtsOnCur: it is the average number of points for discretisation
-- of the edges.
-- NbIter: it is the maximum number of iterations of the process.
-- For each iteration the number of discretisation points is
-- increased.
-- Anisotropie:
SetApproxParam( me : in out; MaxDeg : Integer from Standard = 8;
MaxSegments : Integer from Standard = 9 );
---Purpose: Sets the parameters used to approximate the filling
-- surface. These include:
-- - MaxDeg - the highest degree which the polynomial
-- defining the filling surface can have
-- - MaxSegments - the greatest number of segments
-- which the filling surface can have.
LoadInitSurface( me : in out; Surf : Face from TopoDS );
---Purpose: Loads the initial surface Surf to
-- begin the construction of the surface.
-- This optional function is useful if the surface resulting from
-- construction for the algorithm is likely to be complex.
-- The support surface of the face under construction is computed by a
-- deformation of Surf which satisfies the given constraints.
-- The set of bounding edges defines the wire of the face.
-- If no initial surface is given, the algorithm computes it
-- automatically. If the set of edges is not connected (Free constraint),
-- missing edges are automatically computed.
Add( me : in out; Constr : Edge from TopoDS;
Order : Shape from GeomAbs;
IsBound : Boolean from Standard = Standard_True )
returns Integer from Standard
---Purpose: Adds a new constraint which also defines an edge of the wire
-- of the face
-- Order: Order of the constraint:
-- GeomAbs_C0 : the surface has to pass by 3D representation
-- of the edge
-- GeomAbs_G1 : the surface has to pass by 3D representation
-- of the edge and to respect tangency with the first
-- face of the edge
-- GeomAbs_G2 : the surface has to pass by 3D representation
-- of the edge and to respect tangency and curvature
-- with the first face of the edge.
-- Raises ConstructionError if the edge has no representation on a face and Order is
-- GeomAbs_G1 or GeomAbs_G2.
raises ConstructionError from Standard;
Add( me : in out; Constr : Edge from TopoDS;
Support : Face from TopoDS;
Order : Shape from GeomAbs;
IsBound : Boolean from Standard = Standard_True )
returns Integer from Standard
---Purpose: Adds a new constraint which also defines an edge of the wire
-- of the face
-- Order: Order of the constraint:
-- GeomAbs_C0 : the surface has to pass by 3D representation
-- of the edge
-- GeomAbs_G1 : the surface has to pass by 3D representation
-- of the edge and to respect tangency with the
-- given face
-- GeomAbs_G2 : the surface has to pass by 3D representation
-- of the edge and to respect tangency and curvature
-- with the given face.
-- Raises ConstructionError if the edge has no 2d representation on the given face
raises ConstructionError from Standard;
Add( me : in out; Support : Face from TopoDS;
Order : Shape from GeomAbs )
returns Integer from Standard;
---Purpose: Adds a free constraint on a face. The corresponding edge has to
-- be automatically recomputed. It is always a bound.
Add( me : in out; Point : Pnt from gp )
returns Integer from Standard;
---Purpose: Adds a punctual constraint.
Add( me : in out; U, V : Real from Standard;
Support : Face from TopoDS;
Order : Shape from GeomAbs )
returns Integer from Standard;
---Purpose: Adds a punctual constraint.
Build( me : in out )
---Purpose: Builds the resulting faces
is redefined;
IsDone(me) returns Boolean from Standard
is redefined;
--- Purpose: Tests whether computation of the filling plate has been completed.
G0Error(me) returns Real from Standard;
--- Purpose: Returns the maximum distance between the result and
-- the constraints. This is set at construction time.
G1Error(me) returns Real from Standard;
---Purpose: Returns the maximum angle between the result and the
-- constraints. This is set at construction time.
G2Error(me) returns Real from Standard;
---Purpose: Returns the maximum angle between the result and the
-- constraints. This is set at construction time.
G0Error( me : in out; Index : Integer from Standard ) returns Real from Standard;
---Purpose: Returns the maximum distance attained between the
-- result and the constraint Index. This is set at construction time.
G1Error( me : in out; Index : Integer from Standard ) returns Real from Standard;
---Purpose: Returns the maximum angle between the result and the
-- constraints. This is set at construction time.
G2Error( me : in out; Index : Integer from Standard ) returns Real from Standard;
---Purpose: Returns the greatest difference in curvature found
-- between the result and the constraint Index.
fields
myFilling : Filling from BRepFill;
end MakeFilling;

View File

@@ -0,0 +1,125 @@
// File: BRepOffsetAPI_MakeFilling.cxx
// Created: Wed Aug 26 12:55:20 1998
// Author: Julia GERASIMOVA
// <jgv@clubox.nnov.matra-dtv.fr>
#include <BRepOffsetAPI_MakeFilling.ixx>
BRepOffsetAPI_MakeFilling::BRepOffsetAPI_MakeFilling( const Standard_Integer Degree,
const Standard_Integer NbPtsOnCur,
const Standard_Integer NbIter,
const Standard_Boolean Anisotropie,
const Standard_Real Tol2d,
const Standard_Real Tol3d,
const Standard_Real TolAng,
const Standard_Real TolCurv,
const Standard_Integer MaxDeg,
const Standard_Integer MaxSegments ) :
myFilling( Degree, NbPtsOnCur, NbIter, Anisotropie, Tol2d, Tol3d, TolAng, TolCurv, MaxDeg, MaxSegments )
{
}
void BRepOffsetAPI_MakeFilling::SetConstrParam( const Standard_Real Tol2d,
const Standard_Real Tol3d,
const Standard_Real TolAng,
const Standard_Real TolCurv )
{
myFilling.SetConstrParam( Tol2d, Tol3d, TolAng, TolCurv );
}
void BRepOffsetAPI_MakeFilling::SetResolParam( const Standard_Integer Degree,
const Standard_Integer NbPtsOnCur,
const Standard_Integer NbIter,
const Standard_Boolean Anisotropie )
{
myFilling.SetResolParam( Degree, NbPtsOnCur, NbIter, Anisotropie );
}
void BRepOffsetAPI_MakeFilling::SetApproxParam( const Standard_Integer MaxDeg,
const Standard_Integer MaxSegments )
{
myFilling.SetApproxParam( MaxDeg, MaxSegments );
}
void BRepOffsetAPI_MakeFilling::LoadInitSurface( const TopoDS_Face& Surf )
{
myFilling.LoadInitSurface( Surf );
}
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
const GeomAbs_Shape Order,
const Standard_Boolean IsBound )
{
return myFilling.Add( Constr, Order, IsBound );
}
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
const TopoDS_Face& Support,
const GeomAbs_Shape Order,
const Standard_Boolean IsBound )
{
return myFilling.Add( Constr, Support, Order, IsBound );
}
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Face& Support,
const GeomAbs_Shape Order )
{
return myFilling.Add( Support, Order );
}
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const gp_Pnt& Point )
{
return myFilling.Add( Point );
}
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const Standard_Real U,
const Standard_Real V,
const TopoDS_Face& Support,
const GeomAbs_Shape Order )
{
return myFilling.Add( U, V, Support, Order );
}
void BRepOffsetAPI_MakeFilling::Build()
{
myFilling.Build();
myShape = myFilling.Face();
}
Standard_Boolean BRepOffsetAPI_MakeFilling::IsDone() const
{
return myFilling.IsDone();
}
Standard_Real BRepOffsetAPI_MakeFilling::G0Error() const
{
return myFilling.G0Error();
}
Standard_Real BRepOffsetAPI_MakeFilling::G1Error() const
{
return myFilling.G1Error();
}
Standard_Real BRepOffsetAPI_MakeFilling::G2Error() const
{
return myFilling.G2Error();
}
Standard_Real BRepOffsetAPI_MakeFilling::G0Error( const Standard_Integer Index )
{
return myFilling.G0Error( Index );
}
Standard_Real BRepOffsetAPI_MakeFilling::G1Error( const Standard_Integer Index )
{
return myFilling.G1Error( Index );
}
Standard_Real BRepOffsetAPI_MakeFilling::G2Error( const Standard_Integer Index )
{
return myFilling.G2Error( Index );
}

View File

@@ -0,0 +1,98 @@
-- File: BRepOffsetAPI_MakeOffset.cdl
-- Created: Mon Sep 18 13:40:56 1995
-- Author: Bruno DUMORTIER
-- <dub@fuegox>
---Copyright: Matra Datavision 1995
class MakeOffset from BRepOffsetAPI inherits MakeShape from BRepBuilderAPI
---Purpose: Describes algorithms for offsetting wires from a set of
-- wires contained in a planar face.
-- A MakeOffset object provides a framework for:
-- - defining the construction of an offset,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Shape from TopoDS,
Wire from TopoDS,
Face from TopoDS,
ListOfShape from TopTools,
OffsetWire from BRepFill,
ListOfOffsetWire from BRepFill,
JoinType from GeomAbs
raises
ConstructionError from Standard
is
Create returns MakeOffset from BRepOffsetAPI;
---Purpose: Constructs an algorithm for creating an empty offset
Create( Spine : Face from TopoDS;
Join : JoinType from GeomAbs = GeomAbs_Arc)
returns MakeOffset from BRepOffsetAPI;
---Purpose: Constructs an algorithm for creating an algorithm
-- to build parallels to the spine Spine
Init( me : in out;
Spine : Face from TopoDS;
Join : JoinType from GeomAbs = GeomAbs_Arc)
---Purpose: Initializes the algorithm to construct parallels to the spine Spine.
-- Join defines the type of parallel generated by the
-- salient vertices of the spine. The default type is
-- GeomAbs_Arc where the vertices generate sections
-- of a circle. At present, this is the only construction type implemented.
is static;
Create( Spine : Wire from TopoDS;
Join : JoinType from GeomAbs = GeomAbs_Arc)
returns MakeOffset from BRepOffsetAPI;
Init( me : in out;
Join : JoinType from GeomAbs = GeomAbs_Arc)
---Purpose: Initialize the evaluation of Offseting.
is static;
AddWire (me : in out;
Spine : Wire from TopoDS)
---Purpose: Initializes the algorithm to construct parallels to the wire Spine.
is static;
Perform (me : in out;
Offset : Real from Standard;
Alt : Real from Standard = 0.0)
---Purpose: Computes a parallel to the spine at distance Offset and
-- at an altitude Alt from the plane of the spine in relation
-- to the normal to the spine.
-- Exceptions: Standard_ConstructionError if the offset is not built.
raises
ConstructionError from Standard
is static;
Build(me : in out)
is redefined;
---Purpose: Builds the resulting shape (redefined from MakeShape).
---Level: Public
Generated (me: in out; S : Shape from TopoDS)
---Purpose: returns a list of the created shapes
-- from the shape <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined;
fields
myIsInitialized : Boolean from Standard;
myLastIsLeft : Boolean from Standard;
myJoin : JoinType from GeomAbs;
myFace : Face from TopoDS;
myWires : ListOfShape from TopTools;
myLeft : ListOfOffsetWire from BRepFill;
myRight : ListOfOffsetWire from BRepFill;
end MakeOffset;

View File

@@ -0,0 +1,331 @@
// File: BRepOffsetAPI_MakeOffset.cxx
// Created: Mon Sep 18 14:16:15 1995
// Author: Bruno DUMORTIER
// <dub@fuegox>
#include <BRepOffsetAPI_MakeOffset.ixx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAlgo_FaceRestrictor.hxx>
#include <Extrema_ExtPS.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepFill_OffsetWire.hxx>
#include <BRepFill_ListIteratorOfListOfOffsetWire.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Wire.hxx>
#include <StdFail_NotDone.hxx>
//=======================================================================
//function : BRepOffsetAPI_MakeOffset
//purpose :
//=======================================================================
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset()
:myIsInitialized( Standard_False)
{
}
//=======================================================================
//function : BRepOffsetAPI_MakeOffset
//purpose :
//=======================================================================
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine,
const GeomAbs_JoinType Join)
{
Init(Spine, Join);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
const GeomAbs_JoinType Join)
{
myFace = Spine;
myIsInitialized = Standard_True;
myJoin = Join;
TopExp_Explorer exp;
for (exp.Init(myFace,TopAbs_WIRE); exp.More();exp.Next()) {
myWires.Append(exp.Current());
}
}
//=======================================================================
//function : BRepOffsetAPI_MakeOffset
//purpose :
//=======================================================================
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
const GeomAbs_JoinType Join)
{
myWires.Append(Spine);
myIsInitialized = Standard_True;
myJoin = Join;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepOffsetAPI_MakeOffset::Init(const GeomAbs_JoinType Join)
{
myJoin = Join;
}
//=======================================================================
//function : BRepOffsetAPI_MakeOffset
//purpose :
//=======================================================================
void BRepOffsetAPI_MakeOffset::AddWire(const TopoDS_Wire& Spine)
{
myIsInitialized = Standard_True;
myWires.Append(Spine);
}
//=======================================================================
//function : BuildDomain
//purpose :
//=======================================================================
static void BuildDomains(TopoDS_Face& myFace,
TopTools_ListOfShape& WorkWires,
BRepFill_ListOfOffsetWire& myAlgos,
GeomAbs_JoinType myJoin,
Standard_Boolean isPositive)
{
BRepAlgo_FaceRestrictor FR;
TopoDS_Vertex VF,VL;
TopTools_ListOfShape LOW;
BRep_Builder B;
if (myFace.IsNull()) {
myFace = BRepBuilderAPI_MakeFace(TopoDS::Wire(WorkWires.First()),Standard_True);
if (myFace.IsNull())
StdFail_NotDone::Raise ("BRepOffsetAPI_MakeOffset : the wire is not planar");
}
// Modified by Sergey KHROMOV - Thu Apr 26 16:04:43 2001 Begin
TopExp_Explorer anExp(myFace, TopAbs_WIRE);
TopoDS_Shape aWire1 = WorkWires.First();
TopoDS_Shape aWire2;
if (anExp.More()) {
aWire2 = anExp.Current();
if ((aWire1.Orientation() == aWire2.Orientation() && isPositive) ||
(aWire1.Orientation() == TopAbs::Complement(aWire2.Orientation()) && !isPositive)) {
TopTools_ListOfShape LWires;
TopTools_ListIteratorOfListOfShape itl;
for (itl.Initialize(WorkWires); itl.More(); itl.Next()) {
const TopoDS_Shape& W = itl.Value();
LWires.Append(W.Reversed());
}
WorkWires = LWires;
}
}
// Modified by Sergey KHROMOV - Thu Apr 26 16:04:44 2001 End
FR.Init(myFace,Standard_True);
//====================================================
// Construction des faces limites par les wires fermes.
//====================================================
TopTools_ListIteratorOfListOfShape itl(WorkWires);
for (; itl.More(); itl.Next()) {
TopoDS_Wire& W = TopoDS::Wire(itl.Value());
if (W.Closed()){
FR.Add(W);
continue;
}
TopExp::Vertices (W,VF,VL);
if (VF.IsSame(VL)) {
FR.Add(W);
}
else {
LOW.Append(W);
}
}
FR.Perform();
if (!FR.IsDone()) {
StdFail_NotDone::Raise ("BRepOffsetAPI_MakeOffset : Build Domains");
}
TopTools_ListOfShape Faces;
for (; FR.More(); FR.Next()) {
Faces.Append(FR.Current());
}
//===========================================
// Pas de wire ferme => un seul domaine
//===========================================
if (Faces.IsEmpty()) {
TopoDS_Shape aLocalShape = myFace.EmptyCopied();
TopoDS_Face F = TopoDS::Face(aLocalShape);
// TopoDS_Face F = TopoDS::Face(myFace.EmptyCopied());
TopTools_ListIteratorOfListOfShape itW(LOW);
for ( ; itW.More(); itW.Next()) {
B.Add(F,itW.Value());
}
BRepFill_OffsetWire Algo(F, myJoin);
myAlgos.Append(Algo);
return;
}
//====================================================
// Classification des wires ouverts.
//====================================================
// for (TopTools_ListIteratorOfListOfShape itF(Faces); itF.More(); itF.Next()) {
TopTools_ListIteratorOfListOfShape itF;
for (itF.Initialize(Faces) ; itF.More(); itF.Next()) {
TopoDS_Face& F = TopoDS::Face(itF.Value());
BRepAdaptor_Surface S(F,0);
Standard_Real Tol = BRep_Tool::Tolerance(F);
BRepTopAdaptor_FClass2d CL(F,Precision::Confusion());
TopTools_ListIteratorOfListOfShape itW(LOW);
while (itW.More()) {
TopoDS_Wire& W = TopoDS::Wire(itW.Value());
//=======================================================
// Choix d un point sur le wire. + projection sur la face.
//=======================================================
TopExp_Explorer exp(W,TopAbs_VERTEX);
TopoDS_Vertex V = TopoDS::Vertex(exp.Current());
gp_Pnt2d PV;
gp_Pnt P3d = BRep_Tool::Pnt(V);
Extrema_ExtPS ExtPS (P3d,S,Tol,Tol);
Standard_Real Dist2Min = Precision::Infinite();
Standard_Real Found = Standard_False;
for (Standard_Integer ie = 1; ie <= ExtPS.NbExt(); ie++) {
Standard_Real X,Y;
if (ExtPS.SquareDistance(ie) < Dist2Min) {
Dist2Min = ExtPS.SquareDistance(ie);
Found = Standard_True;
ExtPS.Point(ie).Parameter(X,Y);
PV.SetCoord(X,Y);
}
}
if ( Found && (CL.Perform(PV) == TopAbs_IN)) {
// On a trouve la face qui contient le wire on l enleve de la liste
B.Add(F,W);
LOW.Remove(itW);
}
else {
itW.Next();
}
}
}
//========================================
// Creation des algos sur chaque domaine.
//========================================
for (itF.Initialize(Faces); itF.More(); itF.Next()) {
BRepFill_OffsetWire Algo(TopoDS::Face(itF.Value()), myJoin);
myAlgos.Append(Algo);
}
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
const Standard_Real Alt)
{
StdFail_NotDone_Raise_if ( !myIsInitialized,
"BRepOffsetAPI_MakeOffset : Perform without Init");
Standard_Integer i = 1;
BRepFill_ListIteratorOfListOfOffsetWire itOW;
TopoDS_Compound Res;
BRep_Builder B;
B.MakeCompound (Res);
myLastIsLeft = (Offset <= 0);
if (Offset <= 0.) {
if (myLeft.IsEmpty()) {
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 Begin
BuildDomains(myFace,myWires,myLeft,myJoin, Standard_False);
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 End
}
for (itOW.Initialize(myLeft); itOW.More(); itOW.Next()) {
BRepFill_OffsetWire& Algo = itOW.Value();
Algo.Perform(Abs(Offset),Alt);
if (Algo.IsDone() && !Algo.Shape().IsNull()) {
B.Add(Res,Algo.Shape());
if (i == 1) myShape = Algo.Shape();
i++;
}
}
}
else {
if (myRight.IsEmpty()) {
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:28 2001 Begin
BuildDomains(myFace,myWires,myRight,myJoin, Standard_True);
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:35 2001 End
}
for (itOW.Initialize(myRight); itOW.More(); itOW.Next()) {
BRepFill_OffsetWire& Algo = itOW.Value();
Algo.Perform(Offset,Alt);
if (Algo.IsDone() && !Algo.Shape().IsNull()) {
B.Add(Res,Algo.Shape());
if (i == 1) myShape = Algo.Shape();
i++;
}
}
}
if (i > 2) myShape = Res;
Done();
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepOffsetAPI_MakeOffset::Build()
{
Done();
}
//=======================================================================
//function : ShapesFromShape
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_MakeOffset::Generated
(const TopoDS_Shape& S)
{
myGenerated.Clear();
BRepFill_ListIteratorOfListOfOffsetWire itOW;
BRepFill_ListOfOffsetWire* Algos;
Algos= &myLeft;
if (!myLastIsLeft) {
Algos = &myRight;
}
for (itOW.Initialize(*Algos); itOW.More(); itOW.Next()) {
BRepFill_OffsetWire& OW = itOW.Value();
TopTools_ListOfShape L;
L = OW.GeneratedShapes(S.Oriented(TopAbs_FORWARD));
myGenerated.Append(L);
L = OW.GeneratedShapes(S.Oriented(TopAbs_REVERSED));
myGenerated.Append(L);
}
return myGenerated;
}

View File

@@ -0,0 +1,140 @@
-- File: BRepOffsetAPI_MakeOffsetShape.cdl
-- Created: Tue Feb 13 10:45:39 1996
-- Author: Yves FRICAUD
-- <yfr@stylox>
---Copyright: Matra Datavision 1996
-- Modified by skv - Tue Mar 15 16:17:37 2005
-- Add methods for supporting history.
class MakeOffsetShape from BRepOffsetAPI inherits MakeShape from BRepBuilderAPI
---Purpose: Describes functions to build a shell out of a shape. The
-- result is an unlooped shape parallel to the source shape.
-- A MakeOffsetShape object provides a framework for:
-- - defining the construction of a shell
-- - implementing the construction algorithm
-- - consulting the result.
uses
MakeOffset from BRepOffset,
Mode from BRepOffset,
Shape from TopoDS,
Face from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
ListOfShape from TopTools,
JoinType from GeomAbs
is
Create returns MakeOffsetShape from BRepOffsetAPI;
Create ( S : Shape from TopoDS;
Offset : Real from Standard;
Tol : Real from Standard;
Mode : Mode from BRepOffset = BRepOffset_Skin;
Intersection : Boolean from Standard = Standard_False;
SelfInter : Boolean from Standard = Standard_False;
Join : JoinType from GeomAbs = GeomAbs_Arc)
---Purpose: Constructs a shape parallel to the shape S, where
-- - S may be a face, a shell, a solid or a compound of these shape kinds;
-- - Offset is the offset value. The offset shape is constructed:
-- - outside S, if Offset is positive,
-- - inside S, if Offset is negative;
-- - Tol defines the coincidence tolerance criterion for generated shapes;
-- - Mode defines the construction type of parallels
-- applied to the free edges of shape S; currently, only one
-- construction type is implemented, namely the one where the free
-- edges do not generate parallels; this corresponds to the default
-- value BRepOffset_Skin;
-- - Intersection specifies how the algorithm must work in
-- order to limit the parallels to two adjacent shapes:
-- - if Intersection is false (default value), the intersection
-- is calculated with the parallels to the two adjacent shapes,
-- - if Intersection is true, the intersection is calculated by
-- taking all generated parallels into account; this computation method is
-- more general as it avoids some self-intersections generated in the
-- offset shape from features of small dimensions on shape S, however this
-- method has not been completely implemented and therefore is not
-- recommended for use;
-- - SelfInter tells the algorithm whether a computation
-- to eliminate self-intersections must be applied to the resulting
-- shape; however, as this functionality is not yet
-- implemented, it is recommended to use the default value (false);
-- - Join defines how to fill the holes that may appear between
-- parallels to the two adjacent faces. It may take values
-- GeomAbs_Arc or GeomAbs_Intersection:
-- - if Join is equal to GeomAbs_Arc, then pipes are generated
-- between two free edges of two adjacent parallels,
-- and spheres are generated on "images" of vertices;
-- it is the default value,
-- - if Join is equal to GeomAbs_Intersection, then the parallels to the
-- two adjacent faces are enlarged and intersected,
-- so that there are no free edges on parallels to faces.
-- Warnings
-- 1. All the faces of the shape S should be based on the surfaces
-- with continuity at least C1.
-- 2. The offset value should be sufficiently small to avoid
-- self-intersections in resulting shape. Otherwise these
-- self-intersections may appear inside an offset face if its
-- initial surface is not plane or sphere or cylinder, also some
-- non-adjacent offset faces may intersect each other. Also, some
-- offset surfaces may "turn inside out".
-- 3. The algorithm may fail if the shape S contains vertices where
-- more than 3 edges converge.
-- 4. Since 3d-offset algorithm involves intersection of surfaces,
-- it is under limitations of surface intersection algorithm.
-- 5. A result cannot be generated if the underlying geometry of S is
-- BSpline with continuity C0.
-- Exceptions
-- Geom_UndefinedDerivative if the underlying
-- geometry of S is BSpline with continuity C0.
returns MakeOffsetShape from BRepOffsetAPI;
MakeOffset (me) returns MakeOffset from BRepOffset
---C++: return const &
---Level: Advanced
is virtual;
Build (me : in out)
---Purpose: Builds the resulting shape (redefined from MakeShape).
---Level: Public
is redefined;
Generated (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes generated from the
-- shape <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined virtual;
-- Modified by skv - Tue Mar 15 16:17:37 2005 Begin
-- Add methods for supporting history.
GeneratedEdge (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of edges generated from the shape <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools;
-- Query offset join type.
GetJoinType(me)
---Purpose: Returns offset join type.
returns JoinType from GeomAbs
is static;
-- Modified by skv - Tue Mar 15 16:17:37 2005 End
fields
myOffsetShape : MakeOffset from BRepOffset is protected;
end MakeOffsetShape;

View File

@@ -0,0 +1,125 @@
// File: BRepOffsetAPI_MakeOffsetShape.cxx
// Created: Tue Feb 13 14:21:59 1996
// Author: Yves FRICAUD
// <yfr@stylox>
// Modified by skv - Tue Mar 15 16:20:43 2005
// Add methods for supporting history.
#include <BRepOffsetAPI_MakeOffsetShape.ixx>
#include <BRepOffset_MakeOffset.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Standard_ConstructionError.hxx>
//=======================================================================
//function : BRepOffsetAPI_MakeOffsetShape
//purpose :
//=======================================================================
BRepOffsetAPI_MakeOffsetShape::BRepOffsetAPI_MakeOffsetShape()
{
}
//=======================================================================
//function : BRepOffsetAPI_MakeOffsetShape
//purpose :
//=======================================================================
BRepOffsetAPI_MakeOffsetShape::BRepOffsetAPI_MakeOffsetShape
(const TopoDS_Shape& S,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Mode Mode,
const Standard_Boolean Intersection,
const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join)
{
myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,Join);
Build();
}
//=======================================================================
//function :MakeOffset
//purpose :
//=======================================================================
const BRepOffset_MakeOffset& BRepOffsetAPI_MakeOffsetShape::MakeOffset() const
{
return myOffsetShape;
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepOffsetAPI_MakeOffsetShape::Build()
{
if (!IsDone()) {
myOffsetShape.MakeOffsetShape();
if (!myOffsetShape.IsDone()) return;
myShape = myOffsetShape.Shape();
Done();
}
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::Generated (const TopoDS_Shape& S)
{
myGenerated.Clear();
if (!myOffsetShape.ClosingFaces().Contains(S)) {
myOffsetShape.OffsetFacesFromShapes ().LastImage (S, myGenerated);
if (!myOffsetShape.ClosingFaces().IsEmpty()) {
// Reverse les Shape generes dans le cas des solides minces.
// Utile seulement pour les faces mais sans incidence sur les autres.
TopTools_ListIteratorOfListOfShape it(myGenerated);
for (; it.More(); it.Next())
it.Value().Reverse();
}
}
return myGenerated;
}
// Modified by skv - Tue Mar 15 16:20:43 2005 Begin
//=======================================================================
//function : GeneratedEdge
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::GeneratedEdge (const TopoDS_Shape& S)
{
myGenerated.Clear();
myOffsetShape.OffsetEdgesFromShapes ().LastImage (S, myGenerated);
if (!myGenerated.IsEmpty()) {
if (S.IsSame(myGenerated.First()))
myGenerated.RemoveFirst();
}
return myGenerated;
}
//=======================================================================
//function : GetJoinType
//purpose : Query offset join type.
//=======================================================================
GeomAbs_JoinType BRepOffsetAPI_MakeOffsetShape::GetJoinType() const
{
return myOffsetShape.GetJoinType();
}
// Modified by skv - Tue Mar 15 16:20:43 2005 End

View File

@@ -0,0 +1,78 @@
-- File: BRepOffsetAPI_MakePipe.cdl
-- Created: Tue Jul 12 10:19:39 1994
-- Author: Bruno DUMORTIER
-- <dub@fuegox>
---Copyright: Matra Datavision 1994
class MakePipe from BRepOffsetAPI inherits MakeSweep from BRepPrimAPI
---Purpose: Describes functions to build pipes.
-- A pipe is built a basis shape (called the profile) along
-- a wire (called the spine) by sweeping.
-- The profile must not contain solids.
-- A MakePipe object provides a framework for:
-- - defining the construction of a pipe,
-- - implementing the construction algorithm, and
-- - consulting the result.
-- Warning
-- The MakePipe class implements pipe constructions
-- with G1 continuous spines only.
uses
Pipe from BRepFill,
Wire from TopoDS,
Shape from TopoDS,
Edge from TopoDS,
ListOfShape from TopTools
is
Create( Spine : Wire from TopoDS;
Profile : Shape from TopoDS )
---Purpose: Constructs a pipe by sweeping the shape Profile along
-- the wire Spine.The angle made by the spine with the profile is
-- maintained along the length of the pipe.
-- Warning
-- Spine must be G1 continuous; that is, on the connection
-- vertex of two edges of the wire, the tangent vectors on
-- the left and on the right must have the same direction,
-- though not necessarily the same magnitude.
-- Exceptions
-- Standard_DomainError if the profile is a solid or a
-- composite solid.
returns MakePipe from BRepOffsetAPI;
Pipe(me) returns Pipe from BRepFill
---C++: return const &
---Level: Advanced
is static;
Build(me : in out)
is redefined;
---Purpose: Builds the resulting shape (redefined from MakeShape).
---Level: Public
FirstShape (me : in out)
---Purpose: Returns the TopoDS Shape of the bottom of the prism.
returns Shape from TopoDS;
LastShape (me : in out)
---Purpose: Returns the TopoDS Shape of the top of the prism.
returns Shape from TopoDS;
Generated (me: in out; SSpine, SProfile : Shape from TopoDS)
---Level: Public
returns Shape from TopoDS;
fields
myPipe : Pipe from BRepFill;
end MakePipe;

View File

@@ -0,0 +1,91 @@
// File: BRepOffsetAPI_MakePipe.cxx
// Created: Tue Jul 12 10:33:07 1994
// Author: Bruno DUMORTIER
// <dub@fuegox>
#include <BRepOffsetAPI_MakePipe.ixx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS.hxx>
#include <TopAbs_ShapeEnum.hxx>
//=======================================================================
//function : BRepOffsetAPI_MakePipe
//purpose :
//=======================================================================
BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine ,
const TopoDS_Shape& Profile)
: myPipe(Spine, Profile)
{
Build();
}
//=======================================================================
//function : Pipe
//purpose :
//=======================================================================
const BRepFill_Pipe& BRepOffsetAPI_MakePipe::Pipe() const
{
return myPipe;
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipe::Build()
{
myShape = myPipe.Shape();
Done();
}
//=======================================================================
//function : FirstShape
//purpose :
//=======================================================================
TopoDS_Shape BRepOffsetAPI_MakePipe::FirstShape()
{
return myPipe.FirstShape();
}
//=======================================================================
//function : LastShape
//purpose :
//=======================================================================
TopoDS_Shape BRepOffsetAPI_MakePipe::LastShape()
{
return myPipe.LastShape();
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
TopoDS_Shape BRepOffsetAPI_MakePipe::Generated (const TopoDS_Shape& SSpine,
const TopoDS_Shape& SProfile)
{
if (SProfile.ShapeType () == TopAbs_EDGE) {
return myPipe.Face (TopoDS::Edge (SSpine), TopoDS::Edge (SProfile));
}
else if (SProfile.ShapeType () == TopAbs_VERTEX) {
return myPipe.Edge (TopoDS::Edge (SSpine), TopoDS::Vertex (SProfile));
}
//POP pour NT
TopoDS_Shape bid;
return bid;
}

View File

@@ -0,0 +1,314 @@
-- File: BRepOffsetAPI_MakePipeShell.cdl
-- Created: Wed Apr 8 11:52:57 1998
-- Author: Philippe MANGIN
-- <pmn@sgi29>
---Copyright: Matra Datavision 1998
class MakePipeShell from BRepOffsetAPI inherits MakeSweep from BRepPrimAPI
---Purpose: This class provides for a framework to construct a shell
-- or a solid along a spine consisting in a wire.
-- To produce a solid, the initial wire must be closed.
-- Two approaches are used:
-- - definition by section
-- - by a section and a scaling law
-- - by addition of successive intermediary sections
-- - definition by sweep mode.
-- - pseudo-Frenet
-- - constant
-- - binormal constant
-- - normal defined by a surface support
-- - normal defined by a guiding contour.
-- The two global approaches can also be combined.
-- You can also close the surface later in order to form a solid.
-- Warning: In this version some limitation exist
-- -- We can add only 1 Section (else Standard_NotImplemented is raised
-- -- Mode with auxilary spine is incompatible with hometetic laws
-- -- Mode with auxilary spine and keep contact produce only CO surface.
-- -- Transition treatement is implemented only with the option <BRepBuilderAPI_Transformed>
-- Normaly all these limitations have to be deleted in mext version.
uses
Dir from gp,
Ax2 from gp,
Function from Law,
ListOfShape from TopTools,
Shape from TopoDS,
Wire from TopoDS,
Vertex from TopoDS,
TransitionMode from BRepBuilderAPI,
PipeError from BRepBuilderAPI,
PipeShell from BRepFill
raises
DomainError from Standard,
NotDone from StdFail
is
Create( Spine : Wire from TopoDS)
--- Purpose: Constructs the shell-generating framework defined by the wire Spine.
returns MakePipeShell from BRepOffsetAPI;
---Purpose: Sets an sweep's mode
-- If no mode are setted, the mode use in MakePipe is used
---See Also: GeomFill_IsCorrectedFrenet
SetMode(me : in out; IsFrenet : Boolean = Standard_False);
---Purpose: Sets a Frenet or a CorrectedFrenet trihedron
-- to perform the sweeping
-- If IsFrenet is false, a corrected Frenet trihedron is used.
SetMode(me : in out; Axe : Ax2 from gp);
---Purpose: Sets a fixed trihedron to perform the sweeping
-- all sections will be parallel.
SetMode(me : in out; BiNormal : Dir from gp);
---Purpose: Sets a fixed BiNormal direction to perform the --
-- sweeping. Angular relations beetween the
-- section(s) and <BiNormal> will be constant
SetMode(me : in out; SpineSupport : Shape from TopoDS)
---Purpose: Sets support to the spine to define the BiNormal of
-- the trihedron, like the normal to the surfaces.
-- Warning: To be effective, Each edge of the <spine> must
-- have an representaion on one face of<SpineSupport>
returns Boolean;
SetMode(me : in out;
AuxiliarySpine : Wire from TopoDS;
CurvilinearEquivalence : Boolean;
KeepContact : Boolean = Standard_False );
---Purpose: Sets an auxiliary spine to define the Normal
-- For each Point of the Spine P, an Point Q is evalued
-- on <AuxiliarySpine>
-- If <CurvilinearEquivalence>
-- Q split <AuxiliarySpine> with the same length ratio
-- than P split <Spline>.
-- Else the plan define by P and the tangent to the <Spine>
-- intersect <AuxiliarySpine> in Q.
-- If <KeepContact> the Normal is defined to assume like the sweeped
-- section is in contact to the <AuxiliarySpine>
-- Else the Normal is defined by the vector PQ.
---Level: Public
-- =================================
-- Methodes to define section(s)
-- =================================
---Purpose: Give section to sweep.
-- Possibilities are :
-- - Give one or sevral section
-- - Give one profile and an homotetic law.
-- - Automatic compute of correspondance beetween spine, and section
-- on the sweeped shape
-- - correspondance beetween spine, and section on the sweeped shape
-- defined by a vertex of the spine
-- Option is :
-- -"WithContact" : The section is translated to be in
-- contact with the spine
-- -"WithCorrection" The section is rotated to have a Normal --
-- parallel to the trihedron's normal and have tangent
-- perpendicular to the trihedron's tangent.
Add(me:in out;
Profile : Shape from TopoDS;
WithContact : Boolean = Standard_False;
WithCorrection : Boolean = Standard_False );
---Purpose: Adds the section Profile to this framework. First and last
-- sections may be punctual, so the shape Profile may be
-- both wire and vertex. Correspondent point on spine is
-- computed automatically.
-- If WithContact is true, the section is translated to be in
-- contact with the spine.
-- If WithCorrection is true, the section is rotated to be
-- orthogonal to the spine?s tangent in the correspondent
-- point. This option has no sense if the section is punctual
-- (Profile is of type TopoDS_Vertex).
Add(me:in out;
Profile : Shape from TopoDS;
Location : Vertex from TopoDS;
WithContact : Boolean = Standard_False;
WithCorrection : Boolean = Standard_False)
---Purpose: Adds the section Profile to this framework.
-- Correspondent point on the spine is given by Location.
-- Warning:
-- To be effective, it is not recommended to combine methods Add and SetLaw.
raises DomainError;
SetLaw(me :in out;
Profile : Shape from TopoDS;
L : Function from Law;
WithContact : Boolean = Standard_False;
WithCorrection : Boolean = Standard_False);
---Purpose: Sets the evolution law defined by the wire Profile with
-- its position (Location, WithContact, WithCorrection
-- are the same options as in methods Add) and a
-- homotetic law defined by the function L.
-- Warning:
-- To be effective, it is not recommended to combine methods Add and SetLaw.
SetLaw(me :in out;
Profile : Shape from TopoDS;
L : Function from Law;
Location : Vertex from TopoDS;
WithContact : Boolean = Standard_False;
WithCorrection : Boolean = Standard_False);
---Purpose: Sets the evolution law defined by the wire Profile with
-- its position (Location, WithContact, WithCorrection
-- are the same options as in methods Add) and a
-- homotetic law defined by the function L.
-- Warning:
-- To be effective, it is not recommended to combine methods Add and SetLaw.
Delete(me : in out; Profile : Shape) ;
---Purpose: Removes the section Profile from this framework.
-- ========================================
-- Methodes to perform and read shape
-- ========================================
IsReady(me)
---Purpose: Returns true if this tool object is ready to build the
-- shape, i.e. has a definition for the wire section Profile.
returns Boolean;
GetStatus(me)
---Purpose: Get a status, when Simulate or Build failed. It can be
-- BRepBuilderAPI_PipeDone,
-- BRepBuilderAPI_PipeNotDone,
-- BRepBuilderAPI_PlaneNotIntersectGuide,
-- BRepBuilderAPI_ImpossibleContact.
returns PipeError from BRepBuilderAPI;
SetTolerance(me : in out;
Tol3d : Real = 1.0e-4;
BoundTol : Real = 1.0e-4;
TolAngular : Real = 1.0e-2);
---Purpose: Sets the following tolerance values
-- - 3D tolerance Tol3d
-- - boundary tolerance BoundTol
-- - angular tolerance TolAngular.
SetTransitionMode(me : in out;
Mode :TransitionMode from BRepBuilderAPI = BRepBuilderAPI_Transformed)
---Purpose: Sets the transition mode to manage discontinuities on
-- the swept shape caused by fractures on the spine. The
-- transition mode can be BRepBuilderAPI_Transformed
-- (default value), BRepBuilderAPI_RightCorner,
-- BRepBuilderAPI_RoundCorner:
-- - RepBuilderAPI_Transformed:
-- discontinuities are treated by
-- modification of the sweeping mode. The
-- pipe is "transformed" at the fractures of
-- the spine. This mode assumes building a
-- self-intersected shell.
-- - BRepBuilderAPI_RightCorner:
-- discontinuities are treated like right
-- corner. Two pieces of the pipe
-- corresponding to two adjacent
-- segments of the spine are extended
-- and intersected at a fracture of the spine.
-- - BRepBuilderAPI_RoundCorner:
-- discontinuities are treated like round
-- corner. The corner is treated as rotation
-- of the profile around an axis which
-- passes through the point of the spine?s
-- fracture. This axis is based on cross
-- product of directions tangent to the
-- adjacent segments of the spine at their common point.
-- Warnings
-- The mode BRepBuilderAPI_RightCorner provides a
-- valid result if intersection of two pieces of the pipe
-- (corresponding to two adjacent segments of the spine)
-- in the neighborhood of the spine?s fracture is
-- connected and planar. This condition can be violated if
-- the spine is non-linear in some neighborhood of the
-- fracture or if the profile was set with a scaling law.
-- The last mode, BRepBuilderAPI_RoundCorner, will
-- assuredly provide a good result only if a profile was set
-- with option WithCorrection = True, i.e. it is strictly
-- orthogonal to the spine.
is static;
Simulate(me : in out;
NumberOfSection : Integer;
Result : out ListOfShape from TopTools)
---Purpose: Simulates the resulting shape by calculating its
-- cross-sections. The spine is devided by this
-- cross-sections into (NumberOfSection - 1) equal
-- parts, the number of cross-sections is
-- NumberOfSection. The cross-sections are wires and
-- they are returned in the list Result.
-- This gives a rapid preview of the resulting shape,
-- which will be obtained using the settings you have provided.
-- Raises NotDone if <me> it is not Ready
raises NotDone;
Build(me : in out)
---Purpose: Builds the resulting shape (redefined from MakeShape).
---Level: Public
raises NotDone -- If <me> it is not Ready
is redefined;
MakeSolid(me : in out)
---Purpose: Transforms the sweeping Shell in Solid.
-- If a propfile is not closed returns False
returns Boolean
raises NotDone;
FirstShape (me : in out)
---Purpose: Returns the TopoDS Shape of the bottom of the sweep.
returns Shape from TopoDS
is redefined;
LastShape (me : in out)
---Purpose: Returns the TopoDS Shape of the top of the sweep.
returns Shape from TopoDS
is redefined;
Generated (me: in out; S : Shape from TopoDS)
---Purpose: Returns a list of new shapes generated from the shape
-- S by the shell-generating algorithm.
-- This function is redefined from BRepOffsetAPI_MakeShape::Generated.
-- S can be an edge of the given Spine (see Constructor),
-- it can be an edge or a boundary vertex of a shape
-- returned by the method FirstShape(), it can also be a
-- Profile (see method Add()) closest to the beginning or
-- the end of the Spine.
-- If S is an edge of the given Spine, then method
-- Generated() returns a list of generated faces and a list
-- of edges from a free boundary (if it exists) of the
-- resulting shell.
-- If S is an edge of the start shape (see FirstShape()),
-- method Generated() returns a list of faces generated
-- along the whole spine from the given edge.
-- If S is a boundary vertex of the start shape (see
-- FirstShape()), method Generated() returns a list of
-- edges from the free boundary of the resulting shell,
-- generated along the whole spine.
-- If S is a Profile closest to the beginning of the Spine,
-- method Generated() returns the start shape, that can
-- also be obtained by method FirstShape().
-- If S is a Profile closest to the end of the Spine, method
-- Generated() returns the end shape, that can also be
-- obtained by method LastShape().
---C++: return const &
returns ListOfShape from TopTools
is redefined;
fields
myPipe : PipeShell from BRepFill;
end MakePipeShell;

View File

@@ -0,0 +1,258 @@
// File: BRepOffsetAPI_MakePipeShell.cxx
// Created: Wed Apr 8 19:11:16 1998
// Author: Philippe MANGIN
// <pmn@sgi29>
#include <BRepOffsetAPI_MakePipeShell.ixx>
#include <GeomFill_PipeError.hxx>
#include <Standard_NotImplemented.hxx>
#include <StdFail_NotDone.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
BRepOffsetAPI_MakePipeShell::BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine)
{
myPipe = new (BRepFill_PipeShell) (Spine);
SetTolerance();
SetTransitionMode();
NotDone();
}
//=======================================================================
//function : SetMode
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::SetMode(const Standard_Boolean IsFrenet)
{
myPipe->Set(IsFrenet);
}
//=======================================================================
//function : SetMode
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Ax2& Axe)
{
myPipe->Set(Axe);
}
//=======================================================================
//function : SetMode
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::SetMode(const gp_Dir& BiNormal)
{
myPipe->Set(BiNormal);
}
//=======================================================================
//function : SetMode
//purpose :
//=======================================================================
Standard_Boolean BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Shape& SpineSupport)
{
return myPipe->Set(SpineSupport);
}
//=======================================================================
//function : SetMode
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Wire& AuxiliarySpine,
const Standard_Boolean CurvilinearEquivalence,
const Standard_Boolean KeepContact)
{
myPipe->Set(AuxiliarySpine, CurvilinearEquivalence, KeepContact);
}
//=======================================================================
//function :Add
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile,
const Standard_Boolean WithContact,
const Standard_Boolean WithCorrection)
{
myPipe->Add(Profile, WithContact, WithCorrection);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::Add(const TopoDS_Shape& Profile,
const TopoDS_Vertex& Location,
const Standard_Boolean WithContact,
const Standard_Boolean WithCorrection)
{
myPipe->Add(Profile, Location, WithContact, WithCorrection);
}
//=======================================================================
//function : SetLaw
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile,
const Handle(Law_Function)& L,
const Standard_Boolean WithContact,
const Standard_Boolean WithCorrection)
{
myPipe->SetLaw(Profile, L, WithContact, WithCorrection);
}
//=======================================================================
//function : SetLaw
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::SetLaw(const TopoDS_Shape& Profile,
const Handle(Law_Function)& L,
const TopoDS_Vertex& Location,
const Standard_Boolean WithContact,
const Standard_Boolean WithCorrection)
{
myPipe->SetLaw(Profile, L, Location, WithContact, WithCorrection);
}
//=======================================================================
//function : Delete
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile)
{
myPipe->Delete(Profile);
}
//=======================================================================
//function : IsReady
//purpose :
//=======================================================================
Standard_Boolean BRepOffsetAPI_MakePipeShell::IsReady() const
{
return myPipe->IsReady();
}
//=======================================================================
//function : GetStatus
//purpose :
//=======================================================================
BRepBuilderAPI_PipeError BRepOffsetAPI_MakePipeShell::GetStatus() const
{
BRepBuilderAPI_PipeError Status;
GeomFill_PipeError stat;
stat = myPipe->GetStatus();
switch (stat) {
case GeomFill_PipeOk :
{
Status = BRepBuilderAPI_PipeDone;
break;
}
case GeomFill_PlaneNotIntersectGuide :
{
Status = BRepBuilderAPI_PlaneNotIntersectGuide;
break;
}
case GeomFill_ImpossibleContact :
{
Status = BRepBuilderAPI_ImpossibleContact;
break;
}
default :
Status = BRepBuilderAPI_PipeNotDone;
}
return Status;
}
//=======================================================================
//function : SetTransitionMode
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::SetTolerance(const Standard_Real Tol3d,
const Standard_Real BoundTol,
const Standard_Real TolAngular)
{
myPipe->SetTolerance(Tol3d, BoundTol, TolAngular);
}
//=======================================================================
//function : SetTransitionMode
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::SetTransitionMode(const BRepBuilderAPI_TransitionMode Mode)
{
myPipe->SetTransition( (BRepFill_TransitionStyle)Mode );
}
//=======================================================================
//function :Simulate
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::Simulate(const Standard_Integer N,
TopTools_ListOfShape& R)
{
myPipe->Simulate(N, R);
}
//=======================================================================
//function :Build()
//purpose :
//=======================================================================
void BRepOffsetAPI_MakePipeShell::Build()
{
Standard_Boolean Ok;
Ok = myPipe->Build();
if (Ok) {
myShape = myPipe->Shape();
Done();
}
else NotDone();
}
//=======================================================================
//function : MakeSolid
//purpose :
//=======================================================================
Standard_Boolean BRepOffsetAPI_MakePipeShell::MakeSolid()
{
if (!IsDone()) StdFail_NotDone::Raise("BRepOffsetAPI_MakePipeShell::MakeSolid");
Standard_Boolean Ok;
Ok = myPipe->MakeSolid();
if (Ok) myShape = myPipe->Shape();
return Ok;
}
//=======================================================================
//function :FirstShape()
//purpose :
//=======================================================================
TopoDS_Shape BRepOffsetAPI_MakePipeShell::FirstShape()
{
return myPipe->FirstShape();
}
//=======================================================================
//function : LastShape()
//purpose :
//=======================================================================
TopoDS_Shape BRepOffsetAPI_MakePipeShell::LastShape()
{
return myPipe->LastShape();
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape&
BRepOffsetAPI_MakePipeShell::Generated(const TopoDS_Shape& S)
{
myPipe->Generated(S, myGenerated);
return myGenerated;
}

View File

@@ -0,0 +1,103 @@
-- File: BRepOffsetAPI_MakeThickSolid.cdl
-- Created: Tue Feb 13 11:00:32 1996
-- Author: Yves FRICAUD
-- <yfr@stylox>
---Copyright: Matra Datavision 1996
class MakeThickSolid from BRepOffsetAPI inherits MakeOffsetShape from BRepOffsetAPI
---Purpose: Describes functions to build hollowed solids.
-- A hollowed solid is built from an initial solid and a set of
-- faces on this solid, which are to be removed. The
-- remaining faces of the solid become the walls of the
-- hollowed solid, their thickness defined at the time of construction.
-- the solid is built from an initial
-- solid <S> and a set of faces {Fi} from <S>,
-- builds a solid composed by two shells closed by
-- the {Fi}. First shell <SS> is composed by all
-- the faces of <S> expected {Fi}. Second shell is
-- the offset shell of <SS>.
-- A MakeThickSolid object provides a framework for:
-- - defining the cross-section of a hollowed solid,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
MakeOffset from BRepOffset,
Mode from BRepOffset,
Shape from TopoDS,
Face from TopoDS,
ListOfShape from TopTools,
JoinType from GeomAbs
is
Create returns MakeThickSolid from BRepOffsetAPI;
Create ( S : Shape from TopoDS;
ClosingFaces : ListOfShape from TopTools;
Offset : Real from Standard;
Tol : Real from Standard ;
Mode : Mode from BRepOffset = BRepOffset_Skin;
Intersection : Boolean from Standard = Standard_False;
SelfInter : Boolean from Standard = Standard_False;
Join : JoinType from GeomAbs = GeomAbs_Arc)
---Purpose: Constructs a hollowed solid from
-- the solid S by removing the set of faces ClosingFaces from S, where:
-- Offset defines the thickness of the walls. Its sign indicates
-- which side of the surface of the solid the hollowed shape is built on;
-- - Tol defines the tolerance criterion for coincidence in generated shapes;
-- - Mode defines the construction type of parallels applied to free
-- edges of shape S. Currently, only one construction type is
-- implemented, namely the one where the free edges do not generate
-- parallels; this corresponds to the default value BRepOffset_Skin;
-- Intersection specifies how the algorithm must work in order to
-- limit the parallels to two adjacent shapes:
-- - if Intersection is false (default value), the intersection
-- is calculated with the parallels to the two adjacent shapes,
-- - if Intersection is true, the intersection is calculated by
-- taking account of all parallels generated; this computation
-- method is more general as it avoids self-intersections
-- generated in the offset shape from features of small dimensions
-- on shape S, however this method has not been completely
-- implemented and therefore is not recommended for use;
-- - SelfInter tells the algorithm whether a computation to
-- eliminate self-intersections needs to be applied to the
-- resulting shape. However, as this functionality is not yet
-- implemented, you should use the default value (false);
-- - Join defines how to fill the holes that may appear between
-- parallels to the two adjacent faces. It may take values
-- GeomAbs_Arc or GeomAbs_Intersection:
-- - if Join is equal to GeomAbs_Arc, then pipes are generated
-- between two free edges of two adjacent parallels,
-- and spheres are generated on "images" of vertices;
-- it is the default value,
-- - if Join is equal to GeomAbs_Intersection,
-- then the parallels to the two adjacent faces are
-- enlarged and intersected, so that there are no free
-- edges on parallels to faces.
-- Warnings
-- Since the algorithm of MakeThickSolid is based on
-- MakeOffsetShape algorithm, the warnings are the same as for
-- MakeOffsetShape.
returns MakeThickSolid from BRepOffsetAPI;
Build (me : in out)
is redefined;
---Purpose: Builds the resulting shape (redefined from MakeOffsetShape).
---Level: Public
Modified (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes modified from the shape
-- <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined virtual;
end MakeThickSolid;

View File

@@ -0,0 +1,85 @@
// File: BRepOffsetAPI_MakeThickSolid.cxx
// Created: Tue Feb 13 14:27:56 1996
// Author: Yves FRICAUD
// <yfr@stylox>
#include <BRepOffsetAPI_MakeThickSolid.ixx>
#include <BRepOffset_MakeOffset.hxx>
#include <Standard_ConstructionError.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : BRepOffsetAPI_MakeThickSolid
//purpose :
//=======================================================================
BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid()
{
}
//=======================================================================
//function : BRepOffsetAPI_MakeThickSolid
//purpose :
//=======================================================================
BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid
(const TopoDS_Shape& S,
const TopTools_ListOfShape& ClosingFaces,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Mode Mode,
const Standard_Boolean Intersection,
const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join)
{
myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,Join);
TopTools_ListIteratorOfListOfShape it(ClosingFaces);
for (; it.More(); it.Next()) {
myOffsetShape.AddFace(TopoDS::Face(it.Value()));
}
Build();
}
//=======================================================================
//function : virtual
//purpose :
//=======================================================================
void BRepOffsetAPI_MakeThickSolid::Build()
{
if (!IsDone()) {
myOffsetShape.MakeThickSolid();
if (!myOffsetShape.IsDone()) return;
myShape = myOffsetShape.Shape();
Done();
}
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepOffsetAPI_MakeThickSolid::Modified (const TopoDS_Shape& F)
{
myGenerated.Clear();
if (myOffsetShape.OffsetFacesFromShapes().HasImage(F)) {
if (myOffsetShape.ClosingFaces().Contains(F)) {
myOffsetShape.OffsetFacesFromShapes().LastImage (F, myGenerated);
// Les face du resultat sont orientees comme dans la piece initiale.
//si offset a l interieur.
TopTools_ListIteratorOfListOfShape it(myGenerated);
for (; it.More(); it.Next())
it.Value().Reverse();
}
}
return myGenerated;
}

View File

@@ -0,0 +1,159 @@
-- File: BRepOffsetAPI_NormalProjection.cdl
-- Created: Mon Oct 13 16:14:20 1997
-- Author: Roman BORISOV
-- <rbv@velox.nnov.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class NormalProjection from BRepOffsetAPI inherits MakeShape from BRepBuilderAPI
---Purpose: A framework to define projection onto a shape
-- according to the normal from each point to be projected.
-- The target shape is a face, and the source shape is an edge or a wire.
-- The target face is considered to be a 2D surface.
uses Shape from TopoDS,
Edge from TopoDS,
Shape from GeomAbs,
NormalProjection from BRepAlgo,
ListOfShape from TopTools
raises ConstructionError from Standard,
NoSuchObject from Standard,
NotDone from StdFail
is
Create
---Purpose: Constructs an empty framework to define projection on
-- a shape according to the normal from each point to be
-- projected to the shape.
returns NormalProjection;
Create(S: Shape from TopoDS)
returns NormalProjection;
---Purpose: Constructs a framework to define projection onto the
-- basis shape S according to the normal from each point
-- to be projected from the shape added to this framework by Add.
-- Default parameters of the algorithm: Tol3D = 1.e-04, Tol2D =sqr(tol3d)
-- , InternalContinuity = GeomAbs_C2, MaxDegree = 14, MaxSeg = 16.
Init(me: in out; S: Shape from TopoDS)
---Purpose: Initializes the empty constructor framework with the shape S.
is static;
Add(me: in out; ToProj: Shape from TopoDS)
---Purpose: Adds the shape ToProj to the framework for calculation
-- of the projection by Compute3d.
-- ToProj is an edge or a wire and will be projected onto the basis shape.
-- Exceptions
-- Standard_ConstructionError if ToProj is not added.
raises ConstructionError from Standard
is static;
SetParams(me : in out; Tol3D, Tol2D : Real from Standard;
InternalContinuity : Shape from GeomAbs;
MaxDegree , MaxSeg : Integer from Standard)
---Purpose: Sets the parameters used for computation
-- Tol3 is the requiered tolerance between the 3d projected
-- curve and its 2d representation
-- InternalContinuity is the order of constraints
-- used for approximation
-- MaxDeg and MaxSeg are the maximum degree and the maximum
-- number of segment for BSpline resulting of an approximation.
is static;
SetMaxDistance(me: in out; MaxDist: Real from Standard)
---Purpose: Sets the maximum distance between target shape and
-- shape to project. If this condition is not satisfied then corresponding
-- part of solution is discarded.
-- if MaxDist < 0 then this method does not affect the algorithm
is static;
SetLimit(me : in out; FaceBoundaries: Boolean from Standard = Standard_True)
---Purpose: Manage limitation of projected edges.
--By default edges are limited by face boundaries,
--else they are limited by supporting surface boundaries.
is static;
Compute3d(me: in out; With3d: Boolean from Standard = Standard_True)
---Purpose: Returns true if a 3D curve is computed. If not, false is
-- returned and an initial 3D curve is kept to build the resulting edges.
is static;
Build(me: in out)
is redefined;
---Purpose: Builds the result of the projection as a compound of
-- wires. Tries to build oriented wires.
IsDone(me)
---Purpose:
returns Boolean from Standard
is redefined static;
---Purpose: Returns true if the object was correctly built by the shape
-- construction algorithm.
-- If at the construction time of the shape, the algorithm
-- cannot be completed, or the original data is corrupted,
-- IsDone returns false and therefore protects the use of
-- functions to access the result of the construction
-- (typically the Shape function).
Projection(me)
---Purpose: Performs the projection.
-- The construction of the result is performed by Build.
-- Exceptions
-- StdFail_NotDone if the projection was not performed.
returns Shape from TopoDS
---C++: return const&
raises NotDone from StdFail
is static;
Couple(me; E: Edge from TopoDS)
---Purpose: Returns the initial face corresponding to the projected edge E.
-- Exceptions
-- StdFail_NotDone if no face was found.
-- Standard_NoSuchObject if if a face corresponding to
-- E has already been found.
returns Shape from TopoDS
---C++: return const&
raises NotDone from StdFail,
NoSuchObject from Standard
is static;
Generated (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes generated from the
-- shape <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined;
Ancestor(me; E: Edge from TopoDS)
---Purpose: Returns the initial edge corresponding to the edge E
-- resulting from the computation of the projection.
-- Exceptions
-- StdFail_NotDone if no edge was found.
-- Standard_NoSuchObject if an edge corresponding to
-- E has already been found.
returns Shape from TopoDS
---C++: return const&
raises NotDone from StdFail,
NoSuchObject from Standard
is static;
BuildWire(me; Liste : out ListOfShape from TopTools)
returns Boolean from Standard
is static;
--- Purpose : build the result as a list of wire if possible in --
-- a first returns a wire only if there is only a wire.
fields
myNormalProjector : NormalProjection from BRepAlgo;
end NormalProjection;

View File

@@ -0,0 +1,87 @@
// File: BRepOffsetAPI_OrthogonalProjection.cxx
// Created: Mon Oct 13 16:36:58 1997
// Author: Roman BORISOV
// <rbv@velox.nnov.matra-dtv.fr>
#include <BRepOffsetAPI_NormalProjection.ixx>
BRepOffsetAPI_NormalProjection::BRepOffsetAPI_NormalProjection()
{
}
BRepOffsetAPI_NormalProjection::BRepOffsetAPI_NormalProjection(const TopoDS_Shape& S)
{
myNormalProjector.Init(S);
}
void BRepOffsetAPI_NormalProjection::Init(const TopoDS_Shape& S)
{
myNormalProjector.Init(S);
}
void BRepOffsetAPI_NormalProjection::Add(const TopoDS_Shape& ToProj)
{
myNormalProjector.Add(ToProj);
}
void BRepOffsetAPI_NormalProjection::SetParams(const Standard_Real Tol3D,const Standard_Real Tol2D,const GeomAbs_Shape InternalContinuity,const Standard_Integer MaxDegree,const Standard_Integer MaxSeg)
{
myNormalProjector.SetParams(Tol3D, Tol2D, InternalContinuity, MaxDegree, MaxSeg);
}
void BRepOffsetAPI_NormalProjection::SetMaxDistance(const Standard_Real MaxDist)
{
myNormalProjector.SetMaxDistance(MaxDist);
}
void BRepOffsetAPI_NormalProjection::SetLimit(const Standard_Boolean FaceBounds)
{
myNormalProjector.SetLimit(FaceBounds);
}
void BRepOffsetAPI_NormalProjection::Compute3d(const Standard_Boolean With3d)
{
myNormalProjector.Compute3d(With3d);
}
void BRepOffsetAPI_NormalProjection::Build()
{
myNormalProjector.Build();
myShape = myNormalProjector.Projection();
Done();
}
Standard_Boolean BRepOffsetAPI_NormalProjection::IsDone() const
{
return myNormalProjector.IsDone();
}
const TopoDS_Shape& BRepOffsetAPI_NormalProjection::Couple(const TopoDS_Edge& E) const
{
return myNormalProjector.Couple(E);
}
const TopTools_ListOfShape& BRepOffsetAPI_NormalProjection::Generated(const TopoDS_Shape& S)
{
return myNormalProjector.Generated(S);
}
const TopoDS_Shape& BRepOffsetAPI_NormalProjection::Projection() const
{
return myNormalProjector.Projection();
}
const TopoDS_Shape& BRepOffsetAPI_NormalProjection::Ancestor(const TopoDS_Edge& E) const
{
return myNormalProjector.Ancestor(E);
}
//=======================================================================
//function : BuildWire
//purpose :
//=======================================================================
Standard_Boolean BRepOffsetAPI_NormalProjection::BuildWire(TopTools_ListOfShape& ListOfWire) const
{
return myNormalProjector.BuildWire(ListOfWire);
}

View File

@@ -0,0 +1,209 @@
-- File: BRepOffsetAPI_ThruSections.cdl
-- Created: Mon Jul 17 16:24:52 1995
-- Author: Jing Cheng MEI
-- <mei@junon>
-- Modified: Mon Jan 12 10:46:37 1998
-- Author: Joelle CHAUVET
-- <jct@sgi64>
-- new method ArrangeWires
-- Modified: Mon Jan 19 10:11:49 1998
-- Author: Joelle CHAUVET
-- <jct@sgi64>
-- new methods CreateKPart and DetectKPart
-- Modified: Mon Feb 23 09:28:33 1998
-- Author: Joelle CHAUVET
-- <jct@sgi64>
-- modification of ArrangeWires
-- for sections with different number of elements
-- Modified: Mon Apr 6 16:24:40 1998
-- Author: Joelle CHAUVET
-- <jct@sgi64>
-- CreateKPart and DetectKPart moved in BRepFill
-- Modified: Wed Jul 1 14:33:22 1998
-- Author: Jing-Cheng MEI
-- <mei@pinochiox>
-- Add history
-- CreateKPart and DetectKPart moved in BRepFill
---Copyright: Matra Datavision 1995
class ThruSections from BRepOffsetAPI inherits MakeShape from BRepBuilderAPI
---Purpose: Describes functions to build a loft. This is a shell or a
-- solid passing through a set of sections in a given
-- sequence. Usually sections are wires, but the first and
-- the last sections may be vertices (punctual sections).
uses
Wire from TopoDS,
Vertex from TopoDS,
SequenceOfShape from TopTools,
Face from TopoDS,
Shape from TopoDS,
DataMapOfShapeShape from TopTools,
Array1OfShape from TopTools,
BSplineSurface from Geom,
--
Shape from GeomAbs,
ParametrizationType from Approx
raises DomainError from Standard
is
Create(isSolid : Boolean from Standard = Standard_False;
ruled : Boolean from Standard = Standard_False;
pres3d : Real =1.0e-06)
returns ThruSections from BRepOffsetAPI;
---Purpose: Initializes an algorithm for building a shell or a solid
-- passing through a set of sections, where:
-- - isSolid is set to true if the construction algorithm is
-- required to build a solid or to false if it is required to build
-- a shell (the default value),
-- - ruled is set to true if the faces generated between
-- the edges of two consecutive wires are ruled surfaces or to
-- false (the default value) if they are smoothed out by approximation,
-- - pres3d defines the precision criterion used by the
-- approximation algorithm; the default value is 1.0e-6.
-- Use AddWire and AddVertex to define the
-- successive sections of the shell or solid to be built.
Init(me: in out; isSolid : Boolean from Standard = Standard_False;
ruled : Boolean from Standard = Standard_False;
pres3d : Real =1.0e-06);
---Purpose: Initializes this algorithm for building a shell or a solid
-- passing through a set of sections, where:
-- - isSolid is set to true if this construction algorithm is
-- required to build a solid or to false if it is required to
-- build a shell. false is the default value;
-- - ruled is set to true if the faces generated between the
-- edges of two consecutive wires are ruled surfaces or
-- to false (the default value) if they are smoothed out by approximation,
-- - pres3d defines the precision criterion used by the
-- approximation algorithm; the default value is 1.0e-6.
-- Use AddWire and AddVertex to define the successive
-- sections of the shell or solid to be built.
AddWire(me: in out; wire: Wire from TopoDS);
---Purpose: Adds the wire wire to the set of
-- sections through which the shell or solid is built.
-- Use the Build function to construct the shape.
AddVertex(me: in out; aVertex: Vertex from TopoDS);
---Purpose: Adds the vertex Vertex (punctual section) to the set of sections
-- through which the shell or solid is built. A vertex may be added to the
-- set of sections only as first or last section. At least one wire
-- must be added to the set of sections by the method AddWire.
-- Use the Build function to construct the shape.
CheckCompatibility(me: in out;
check : Boolean from Standard = Standard_True);
SetSmoothing(me: in out; UseSmoothing : Boolean from Standard)
---Purpose: Define the approximation algorithm
is static;
SetParType(me: in out; ParType : ParametrizationType from Approx)
---Purpose: Define the type of parametrization used in the approximation
is static;
SetContinuity(me: in out; C : Shape from GeomAbs)
---Purpose: Define the Continuity used in the approximation
is static;
SetCriteriumWeight(me : in out;
W1, W2, W3 : Real)
---Purpose: define the Weights associed to the criterium used in
-- the optimization.
--
raises DomainError -- if Wi <= 0
is static;
SetMaxDegree(me : in out; MaxDeg : Integer from Standard)
---Purpose: Define the maximal U degree of result surface
is static;
ParType(me)
---Purpose: returns the type of parametrization used in the approximation
returns ParametrizationType from Approx
is static;
Continuity(me)
---Purpose: returns the Continuity used in the approximation
returns Shape from GeomAbs
is static;
MaxDegree(me)
---Purpose: returns the maximal U degree of result surface
returns Integer from Standard
is static;
UseSmoothing(me)
---Purpose: Define the approximation algorithm
returns Boolean from Standard
is static;
CriteriumWeight(me ; W1, W2, W3 : out Real)
---Purpose: returns the Weights associed to the criterium used in
-- the optimization.
is static;
Build(me: in out)
is redefined;
CreateRuled(me: in out)
is private;
CreateSmoothed(me: in out)
is private;
FirstShape (me)
---Purpose: Returns the TopoDS Shape of the bottom of the loft if solid
returns Shape from TopoDS;
---C++ : return const &
LastShape (me)
---Purpose: Returns the TopoDS Shape of the top of the loft if solid
returns Shape from TopoDS;
---C++ : return const &
GeneratedFace (me; Edge : Shape from TopoDS)
---Purpose: if Ruled
-- Returns the Face generated by each edge
-- except the last wire
-- if smoothed
-- Returns the Face generated by each edge of the first wire
returns Shape from TopoDS;
TotalSurf(me; shapes: Array1OfShape from TopTools;
NbSect: Integer from Standard;
NbEdges: Integer from Standard;
w1Point: Boolean from Standard;
w2Point: Boolean from Standard;
vClosed: Boolean from Standard)
returns BSplineSurface from Geom
is private;
fields
myWires : SequenceOfShape from TopTools;
myIsSolid : Boolean from Standard;
myIsRuled : Boolean from Standard;
myWCheck : Boolean from Standard;
myPres3d : Real from Standard;
myFirst : Face from TopoDS;
myLast : Face from TopoDS;
myGenerated : DataMapOfShapeShape from TopTools;
-- Approximation parameters
myContinuity: Shape from GeomAbs;
myParamType : ParametrizationType from Approx;
myDegMax : Integer from Standard;
myCritWeights : Real[3];
myUseSmoothing : Boolean from Standard;
end ThruSections;

File diff suppressed because it is too large Load Diff