mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
72
src/BRepSweep/BRepSweep.cdl
Executable file
72
src/BRepSweep/BRepSweep.cdl
Executable file
@@ -0,0 +1,72 @@
|
||||
-- File: BRepSweep.cdl
|
||||
-- Created: Tue Jan 12 15:19:24 1993
|
||||
-- Author: Philippe DAUTRY
|
||||
-- <fid@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
package BRepSweep
|
||||
|
||||
---Purpose: This package implements the package Sweep for the BRep
|
||||
-- structure.
|
||||
|
||||
uses
|
||||
|
||||
Standard,
|
||||
Quantity,
|
||||
TCollection,
|
||||
TColStd,
|
||||
gp,
|
||||
Geom,
|
||||
TopAbs,
|
||||
TopLoc,
|
||||
TopTools,
|
||||
TopoDS,
|
||||
TopExp,
|
||||
BRep,
|
||||
Sweep
|
||||
|
||||
is
|
||||
|
||||
class Builder;
|
||||
---Purpose: Implements the Builder required for Sweep.
|
||||
|
||||
class Tool;
|
||||
---Purpose: Provides an indexation of the subShapes of a Shape
|
||||
-- from TopoDS.
|
||||
|
||||
class Iterator;
|
||||
---Purpose: Iterator on the subShapes of a shape.
|
||||
|
||||
|
||||
deferred class NumLinearRegularSweep
|
||||
instantiates LinearRegularSweep from Sweep(
|
||||
Shape from TopoDS, -- Resulting topological objects.
|
||||
Shape from TopoDS, -- Generating Shape.
|
||||
NumShape from Sweep, -- Directing Wire.
|
||||
Builder from BRepSweep,
|
||||
Tool from BRepSweep, -- GenTool
|
||||
NumShapeTool from Sweep, -- DirTool
|
||||
Iterator from BRepSweep, -- Resulting objects Iterator
|
||||
Iterator from BRepSweep, -- GenIterator
|
||||
NumShapeIterator from Sweep); -- DirSubEdgeIterator
|
||||
|
||||
deferred class Trsf;
|
||||
--- This class is inherited from LinearRegularSweep to implement
|
||||
-- the simple swept primitives built moving a Shape with a Trsf.
|
||||
|
||||
class Translation;
|
||||
--- This class is inherited from Trsf to implement the translation
|
||||
-- sweep.
|
||||
|
||||
class Rotation;
|
||||
--- This class is inherited from Trsf to implement the rotation
|
||||
-- sweep.
|
||||
|
||||
class Prism;
|
||||
--- This class provides simple methods to build prism.
|
||||
|
||||
class Revol;
|
||||
--- This class provides simple methods to build Revol.
|
||||
|
||||
end BRepSweep;
|
75
src/BRepSweep/BRepSweep_Builder.cdl
Executable file
75
src/BRepSweep/BRepSweep_Builder.cdl
Executable file
@@ -0,0 +1,75 @@
|
||||
-- File: BRepSweep_Builder.cdl
|
||||
-- Created: Thu Jan 14 17:36:55 1993
|
||||
-- Author: Philippe DAUTRY
|
||||
-- <fid@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class Builder from BRepSweep
|
||||
|
||||
---Purpose: implements the abstract Builder with the BRep Builder
|
||||
|
||||
uses
|
||||
Builder from BRep,
|
||||
|
||||
Shape from TopoDS,
|
||||
Shell from TopoDS,
|
||||
Face from TopoDS,
|
||||
Wire from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Vertex from TopoDS,
|
||||
|
||||
Orientation from TopAbs
|
||||
|
||||
is
|
||||
|
||||
Create(aBuilder : Builder from BRep) returns Builder from BRepSweep;
|
||||
---Purpose: Creates a Builder.
|
||||
|
||||
Builder(me) returns Builder from BRep
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
-- implements the Builder methods
|
||||
|
||||
MakeCompound (me; aCompound : out Shape from TopoDS)
|
||||
---Purpose: Returns an empty Compound.
|
||||
is static;
|
||||
|
||||
MakeCompSolid (me; aCompSolid : out Shape from TopoDS)
|
||||
---Purpose: Returns an empty CompSolid.
|
||||
is static;
|
||||
|
||||
MakeSolid (me; aSolid : out Shape from TopoDS)
|
||||
---Purpose: Returns an empty Solid.
|
||||
is static;
|
||||
|
||||
MakeShell (me; aShell : out Shape from TopoDS)
|
||||
---Purpose: Returns an empty Shell.
|
||||
is static;
|
||||
|
||||
MakeWire (me; aWire : out Shape from TopoDS)
|
||||
---Purpose: Returns an empty Wire.
|
||||
is static;
|
||||
|
||||
|
||||
Add(me; aShape1 : in out Shape from TopoDS;
|
||||
aShape2 : in Shape from TopoDS;
|
||||
Orient : in Orientation from TopAbs)
|
||||
---Purpose: Adds the Shape 1 in the Shape 2, set to
|
||||
-- <Orient> orientation.
|
||||
is static;
|
||||
|
||||
Add(me; aShape1 : in out Shape from TopoDS;
|
||||
aShape2 : in Shape from TopoDS)
|
||||
---Purpose: Adds the Shape 1 in the Shape 2.
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myBuilder : Builder from BRep;
|
||||
|
||||
end Builder;
|
||||
|
101
src/BRepSweep/BRepSweep_Builder.cxx
Executable file
101
src/BRepSweep/BRepSweep_Builder.cxx
Executable file
@@ -0,0 +1,101 @@
|
||||
// File: BRepSweep_Builder.cxx
|
||||
// Created: Thu Feb 4 15:22:43 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
|
||||
#include <BRepSweep_Builder.ixx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Builder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Builder::BRepSweep_Builder(const BRep_Builder& aBuilder) :
|
||||
myBuilder(aBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeCompound
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Builder::MakeCompound(TopoDS_Shape& aCompound)const
|
||||
{
|
||||
myBuilder.MakeCompound(TopoDS::Compound(aCompound));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeCompSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Builder::MakeCompSolid(TopoDS_Shape& aCompSolid)const
|
||||
{
|
||||
myBuilder.MakeCompSolid(TopoDS::CompSolid(aCompSolid));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Builder::MakeSolid(TopoDS_Shape& aSolid)const
|
||||
{
|
||||
myBuilder.MakeSolid(TopoDS::Solid(aSolid));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeShell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Builder::MakeShell(TopoDS_Shape& aShell)const
|
||||
{
|
||||
myBuilder.MakeShell(TopoDS::Shell(aShell));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Builder::MakeWire(TopoDS_Shape& aWire)const
|
||||
{
|
||||
myBuilder.MakeWire(TopoDS::Wire(aWire));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Builder::Add(TopoDS_Shape& aShape1,
|
||||
const TopoDS_Shape& aShape2,
|
||||
const TopAbs_Orientation Orient)const
|
||||
{
|
||||
TopoDS_Shape aComp = aShape2;
|
||||
aComp.Orientation(Orient);
|
||||
myBuilder.Add(aShape1,aComp);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Builder::Add(TopoDS_Shape& aShape1,
|
||||
const TopoDS_Shape& aShape2)const
|
||||
{
|
||||
myBuilder.Add(aShape1,aShape2);
|
||||
}
|
||||
|
||||
|
16
src/BRepSweep/BRepSweep_Builder.lxx
Executable file
16
src/BRepSweep/BRepSweep_Builder.lxx
Executable file
@@ -0,0 +1,16 @@
|
||||
// File: BRepSweep_Builder.lxx
|
||||
// Created: Thu Feb 4 15:23:41 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
//=======================================================================
|
||||
//function : Builder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const BRep_Builder& BRepSweep_Builder::Builder()const
|
||||
{
|
||||
return myBuilder;
|
||||
}
|
||||
|
||||
|
67
src/BRepSweep/BRepSweep_Iterator.cdl
Executable file
67
src/BRepSweep/BRepSweep_Iterator.cdl
Executable file
@@ -0,0 +1,67 @@
|
||||
-- File: BRepSweep_Iterator.cdl
|
||||
-- Created: Tue Jun 8 17:54:06 1993
|
||||
-- Author: Laurent BOURESCHE
|
||||
-- <lbo@phobox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class Iterator from BRepSweep
|
||||
|
||||
---Purpose: This class provides iteration services required by
|
||||
-- the Generating Line (TopoDS Shape) of a BRepSweep.
|
||||
-- This tool is used to iterate on the direct
|
||||
-- sub-shapes of a Shape.
|
||||
--
|
||||
|
||||
uses
|
||||
|
||||
Iterator from TopoDS,
|
||||
Shape from TopoDS,
|
||||
Orientation from TopAbs
|
||||
|
||||
raises
|
||||
|
||||
NoMoreObject from Standard,
|
||||
NoSuchObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create;
|
||||
|
||||
Init(me : in out; aShape: Shape from TopoDS)
|
||||
---Purpose: Resest the Iterator on sub-shapes of <aShape>.
|
||||
is static;
|
||||
|
||||
More(me) returns Boolean
|
||||
---Purpose: Returns True if there is a current sub-shape.
|
||||
--
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Next(me : in out)
|
||||
---Purpose: Moves to the next sub-shape.
|
||||
raises
|
||||
NoMoreObject from Standard
|
||||
is static;
|
||||
|
||||
Value(me) returns Shape from TopoDS
|
||||
---Purpose: Returns the current sub-shape.
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Orientation(me) returns Orientation from TopAbs
|
||||
---Purpose: Returns the orientation of the current sub-shape.
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myIterator : Iterator from TopoDS;
|
||||
|
||||
end Iterator from BRepSweep;
|
40
src/BRepSweep/BRepSweep_Iterator.cxx
Executable file
40
src/BRepSweep/BRepSweep_Iterator.cxx
Executable file
@@ -0,0 +1,40 @@
|
||||
// File: BRepSweep_Iterator.cxx
|
||||
// Created: Wed Jun 9 17:54:27 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phobox>
|
||||
|
||||
|
||||
#include <BRepSweep_Iterator.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Iterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Iterator::BRepSweep_Iterator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Iterator::Init(const TopoDS_Shape& aShape)
|
||||
{
|
||||
myIterator.Initialize(aShape);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Iterator::Next()
|
||||
{
|
||||
myIterator.Next();
|
||||
}
|
||||
|
||||
|
40
src/BRepSweep/BRepSweep_Iterator.lxx
Executable file
40
src/BRepSweep/BRepSweep_Iterator.lxx
Executable file
@@ -0,0 +1,40 @@
|
||||
// File: BRepSweep_Iterator.lxx
|
||||
// Created: Wed Jun 9 18:07:23 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phobox>
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : More
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepSweep_Iterator::More()const
|
||||
{
|
||||
return myIterator.More();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TopoDS_Shape& BRepSweep_Iterator::Value()const
|
||||
{
|
||||
return myIterator.Value();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Orientation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline TopAbs_Orientation BRepSweep_Iterator::Orientation()const
|
||||
{
|
||||
return Value().Orientation();
|
||||
}
|
||||
|
||||
|
163
src/BRepSweep/BRepSweep_NumLinearRegularSweep.hxx
Executable file
163
src/BRepSweep/BRepSweep_NumLinearRegularSweep.hxx
Executable file
@@ -0,0 +1,163 @@
|
||||
// File generated by CPPExt (Value)
|
||||
// Copyright (C) 1991,1995 by
|
||||
//
|
||||
// MATRA DATAVISION, FRANCE
|
||||
//
|
||||
// This software is furnished in accordance with the terms and conditions
|
||||
// of the contract and with the inclusion of the above copyright notice.
|
||||
// This software or any other copy thereof may not be provided or otherwise
|
||||
// be made available to any other person. No title to an ownership of the
|
||||
// software is hereby transferred.
|
||||
//
|
||||
// At the termination of the contract, the software and all copies of this
|
||||
// software must be deleted.
|
||||
|
||||
#ifndef _BRepSweep_NumLinearRegularSweep_HeaderFile
|
||||
#define _BRepSweep_NumLinearRegularSweep_HeaderFile
|
||||
|
||||
#ifndef _BRepSweep_Builder_HeaderFile
|
||||
#include <BRepSweep_Builder.hxx>
|
||||
#endif
|
||||
#ifndef _TopoDS_Shape_HeaderFile
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#endif
|
||||
#ifndef _Sweep_NumShape_HeaderFile
|
||||
#include <Sweep_NumShape.hxx>
|
||||
#endif
|
||||
#ifndef _BRepSweep_Tool_HeaderFile
|
||||
#include <BRepSweep_Tool.hxx>
|
||||
#endif
|
||||
#ifndef _Sweep_NumShapeTool_HeaderFile
|
||||
#include <Sweep_NumShapeTool.hxx>
|
||||
#endif
|
||||
#ifndef _BRepSweep_Array2OfShapesOfNumLinearRegularSweep_HeaderFile
|
||||
#include <BRepSweep_Array2OfShapesOfNumLinearRegularSweep.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_Array2OfBoolean_HeaderFile
|
||||
#include <TColStd_Array2OfBoolean.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_BRepSweep_SequenceNodeOfSequenceOfShapesOfNumLinearRegularSweep_HeaderFile
|
||||
#include <Handle_BRepSweep_SequenceNodeOfSequenceOfShapesOfNumLinearRegularSweep.hxx>
|
||||
#endif
|
||||
#ifndef _TopAbs_Orientation_HeaderFile
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Boolean_HeaderFile
|
||||
#include <Standard_Boolean.hxx>
|
||||
#endif
|
||||
class Standard_NoMoreObject;
|
||||
class Standard_NoSuchObject;
|
||||
class Standard_RangeError;
|
||||
class Standard_DomainError;
|
||||
class TopoDS_Shape;
|
||||
class Sweep_NumShape;
|
||||
class BRepSweep_Builder;
|
||||
class BRepSweep_Tool;
|
||||
class Sweep_NumShapeTool;
|
||||
class BRepSweep_Iterator;
|
||||
class Sweep_NumShapeIterator;
|
||||
class BRepSweep_Array2OfShapesOfNumLinearRegularSweep;
|
||||
class BRepSweep_SequenceOfShapesOfNumLinearRegularSweep;
|
||||
class BRepSweep_SequenceNodeOfSequenceOfShapesOfNumLinearRegularSweep;
|
||||
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Macro_HeaderFile
|
||||
#include <Standard_Macro.hxx>
|
||||
#endif
|
||||
|
||||
class BRepSweep_NumLinearRegularSweep {
|
||||
|
||||
public:
|
||||
|
||||
void* operator new(size_t,void* anAddress)
|
||||
{
|
||||
return anAddress;
|
||||
}
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return Standard::Allocate(size);
|
||||
}
|
||||
void operator delete(void *anAddress)
|
||||
{
|
||||
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||
}
|
||||
// Methods PUBLIC
|
||||
//
|
||||
Standard_EXPORT virtual void Delete() ;
|
||||
Standard_EXPORT virtual ~BRepSweep_NumLinearRegularSweep()
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
||||
Standard_EXPORT virtual TopoDS_Shape MakeEmptyVertex(const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirV) = 0;
|
||||
Standard_EXPORT virtual TopoDS_Shape MakeEmptyDirectingEdge(const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirE) = 0;
|
||||
Standard_EXPORT virtual TopoDS_Shape MakeEmptyGeneratingEdge(const TopoDS_Shape& aGenE,const Sweep_NumShape& aDirV) = 0;
|
||||
Standard_EXPORT virtual void SetParameters(const TopoDS_Shape& aNewFace,TopoDS_Shape& aNewVertex,const TopoDS_Shape& aGenF,const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirV) = 0;
|
||||
Standard_EXPORT virtual void SetDirectingParameter(const TopoDS_Shape& aNewEdge,TopoDS_Shape& aNewVertex,const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirE,const Sweep_NumShape& aDirV) = 0;
|
||||
Standard_EXPORT virtual void SetGeneratingParameter(const TopoDS_Shape& aNewEdge,TopoDS_Shape& aNewVertex,const TopoDS_Shape& aGenE,const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirV) = 0;
|
||||
Standard_EXPORT virtual TopoDS_Shape MakeEmptyFace(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) = 0;
|
||||
Standard_EXPORT virtual void SetPCurve(const TopoDS_Shape& aNewFace,TopoDS_Shape& aNewEdge,const TopoDS_Shape& aGenF,const TopoDS_Shape& aGenE,const Sweep_NumShape& aDirV,const TopAbs_Orientation orien) = 0;
|
||||
Standard_EXPORT virtual void SetGeneratingPCurve(const TopoDS_Shape& aNewFace,TopoDS_Shape& aNewEdge,const TopoDS_Shape& aGenE,const Sweep_NumShape& aDirE,const Sweep_NumShape& aDirV,const TopAbs_Orientation orien) = 0;
|
||||
Standard_EXPORT virtual void SetDirectingPCurve(const TopoDS_Shape& aNewFace,TopoDS_Shape& aNewEdge,const TopoDS_Shape& aGenE,const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirE,const TopAbs_Orientation orien) = 0;
|
||||
Standard_EXPORT virtual TopAbs_Orientation DirectSolid(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) = 0;
|
||||
Standard_EXPORT virtual Standard_Boolean GGDShapeIsToAdd(const TopoDS_Shape& aNewShape,const TopoDS_Shape& aNewSubShape,const TopoDS_Shape& aGenS,const TopoDS_Shape& aSubGenS,const Sweep_NumShape& aDirS) const = 0;
|
||||
Standard_EXPORT virtual Standard_Boolean GDDShapeIsToAdd(const TopoDS_Shape& aNewShape,const TopoDS_Shape& aNewSubShape,const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS,const Sweep_NumShape& aSubDirS) const = 0;
|
||||
Standard_EXPORT virtual Standard_Boolean SeparatedWires(const TopoDS_Shape& aNewShape,const TopoDS_Shape& aNewSubShape,const TopoDS_Shape& aGenS,const TopoDS_Shape& aSubGenS,const Sweep_NumShape& aDirS) const = 0;
|
||||
Standard_EXPORT virtual TopoDS_Shape SplitShell(const TopoDS_Shape& aNewShape) const;
|
||||
Standard_EXPORT virtual void SetContinuity(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) = 0;
|
||||
Standard_EXPORT virtual Standard_Boolean HasShape(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) const = 0;
|
||||
Standard_EXPORT TopoDS_Shape Shape(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) ;
|
||||
Standard_EXPORT TopoDS_Shape Shape(const TopoDS_Shape& aGenS) ;
|
||||
Standard_EXPORT TopoDS_Shape Shape() ;
|
||||
Standard_EXPORT TopoDS_Shape FirstShape() ;
|
||||
Standard_EXPORT TopoDS_Shape LastShape() ;
|
||||
Standard_EXPORT TopoDS_Shape FirstShape(const TopoDS_Shape& aGenS) ;
|
||||
Standard_EXPORT TopoDS_Shape LastShape(const TopoDS_Shape& aGenS) ;
|
||||
Standard_EXPORT Standard_Boolean Closed() const;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Methods PROTECTED
|
||||
//
|
||||
Standard_EXPORT BRepSweep_NumLinearRegularSweep(const BRepSweep_Builder& aBuilder,const TopoDS_Shape& aGenShape,const Sweep_NumShape& aDirWire);
|
||||
|
||||
|
||||
// Fields PROTECTED
|
||||
//
|
||||
BRepSweep_Builder myBuilder;
|
||||
TopoDS_Shape myGenShape;
|
||||
Sweep_NumShape myDirWire;
|
||||
BRepSweep_Tool myGenShapeTool;
|
||||
Sweep_NumShapeTool myDirShapeTool;
|
||||
BRepSweep_Array2OfShapesOfNumLinearRegularSweep myShapes;
|
||||
TColStd_Array2OfBoolean myBuiltShapes;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Methods PRIVATE
|
||||
//
|
||||
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// other Inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
106
src/BRepSweep/BRepSweep_Prism.cdl
Executable file
106
src/BRepSweep/BRepSweep_Prism.cdl
Executable file
@@ -0,0 +1,106 @@
|
||||
-- File: BRepSweep_Prism.cdl
|
||||
-- Created: Tue Jun 22 15:23:43 1993
|
||||
-- Author: Laurent BOURESCHE
|
||||
-- <lbo@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Prism from BRepSweep
|
||||
|
||||
---Purpose: Provides natural constructors to build BRepSweep
|
||||
-- translated swept Primitives.
|
||||
|
||||
uses
|
||||
Location from TopLoc,
|
||||
NumShape from Sweep,
|
||||
Translation from BRepSweep,
|
||||
Shape from TopoDS,
|
||||
Vec from gp,
|
||||
Dir from gp
|
||||
|
||||
raises
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
Create (S : Shape from TopoDS;
|
||||
V : Vec from gp;
|
||||
Copy : Boolean from Standard = Standard_False;
|
||||
Canonize: Boolean from Standard = Standard_True)
|
||||
---Purpose: Builds the prism of base S and vector V. If C is true,
|
||||
-- S is copied. If Canonize is true then generated surfaces
|
||||
-- are attempted to be canonized in simple types
|
||||
returns Prism from BRepSweep;
|
||||
|
||||
Create (S : Shape from TopoDS;
|
||||
D : Dir from gp;
|
||||
Inf : Boolean from Standard = Standard_True;
|
||||
Copy : Boolean from Standard = Standard_False;
|
||||
Canonize : Boolean from Standard = Standard_True)
|
||||
---Purpose: Builds a semi-infinite or an infinite prism of base S.
|
||||
-- If Copy is true S is copied. If Inf is true the prism
|
||||
-- is infinite, if Inf is false the prism is infinite in
|
||||
-- the direction D. If Canonize is true then generated surfaces
|
||||
-- are attempted to be canonized in simple types
|
||||
returns Prism from BRepSweep;
|
||||
|
||||
Shape (me : in out)
|
||||
---Purpose: Returns the TopoDS Shape attached to the prism.
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
Shape (me : in out; aGenS : Shape from TopoDS)
|
||||
---Purpose: Returns the TopoDS Shape generated with aGenS
|
||||
-- (subShape of the generating shape).
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
FirstShape (me : in out)
|
||||
---Purpose: Returns the TopoDS Shape of the bottom of the prism.
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
FirstShape (me : in out; aGenS : Shape from TopoDS)
|
||||
---Purpose: Returns the TopoDS Shape of the bottom of the prism.
|
||||
-- generated with aGenS (subShape of the generating
|
||||
-- shape).
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
LastShape (me : in out)
|
||||
---Purpose: Returns the TopoDS Shape of the top of the prism.
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
LastShape (me : in out; aGenS : Shape from TopoDS)
|
||||
---Purpose: Returns the TopoDS Shape of the top of the prism.
|
||||
-- generated with aGenS (subShape of the generating
|
||||
-- shape).
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
Vec(me)
|
||||
---Purpose: Returns the Vector of the Prism, if it is an infinite
|
||||
-- prism the Vec is unitar.
|
||||
returns Vec from gp
|
||||
is static;
|
||||
|
||||
NumShape (me)
|
||||
returns NumShape from Sweep
|
||||
---Purpose: used to build the NumShape of a limited prism.
|
||||
is static private;
|
||||
|
||||
NumShape (me; Inf : Boolean from Standard)
|
||||
returns NumShape from Sweep
|
||||
---Purpose: used to build the NumShape of an infinite prism.
|
||||
is static private;
|
||||
|
||||
Location(me; V : Vec from gp)
|
||||
returns Location from TopLoc
|
||||
---Purpose: used to build the Location.
|
||||
is static private;
|
||||
|
||||
fields
|
||||
|
||||
myTranslation : Translation from BRepSweep;
|
||||
|
||||
end Prism from BRepSweep;
|
171
src/BRepSweep/BRepSweep_Prism.cxx
Executable file
171
src/BRepSweep/BRepSweep_Prism.cxx
Executable file
@@ -0,0 +1,171 @@
|
||||
// File: BRepSweep_Prism.cxx
|
||||
// Created: Fri Jun 25 10:33:47 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
#include <BRepSweep_Prism.ixx>
|
||||
#include <BRepSweep_Translation.hxx>
|
||||
#include <Sweep_NumShape.hxx>
|
||||
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <Precision.hxx>
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Prism
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Prism::BRepSweep_Prism
|
||||
(const TopoDS_Shape& S,
|
||||
const gp_Vec& V,
|
||||
const Standard_Boolean C,
|
||||
const Standard_Boolean Canonize):
|
||||
myTranslation(S,
|
||||
NumShape(),
|
||||
Location(V),
|
||||
V,
|
||||
C,
|
||||
Canonize)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if
|
||||
(V.Magnitude()<=Precision::Confusion(),"BRepSweep_Prism::Constructor");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Prism
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Prism::BRepSweep_Prism
|
||||
(const TopoDS_Shape& S,
|
||||
const gp_Dir& D,
|
||||
const Standard_Boolean Inf,
|
||||
const Standard_Boolean C,
|
||||
const Standard_Boolean Canonize):
|
||||
myTranslation(S,
|
||||
NumShape(Inf),
|
||||
Location(D),
|
||||
D,
|
||||
C,
|
||||
Canonize)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Prism::Shape()
|
||||
{
|
||||
return myTranslation.Shape();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Prism::Shape(const TopoDS_Shape& aGenS)
|
||||
{
|
||||
return myTranslation.Shape(aGenS);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Prism::FirstShape()
|
||||
{
|
||||
return myTranslation.FirstShape();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Prism::FirstShape(const TopoDS_Shape& aGenS)
|
||||
{
|
||||
return myTranslation.FirstShape(aGenS);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LastShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Prism::LastShape()
|
||||
{
|
||||
return myTranslation.LastShape();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LastShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Prism::LastShape(const TopoDS_Shape& aGenS)
|
||||
{
|
||||
return myTranslation.LastShape(aGenS);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Vec
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Vec BRepSweep_Prism::Vec()const
|
||||
{
|
||||
return myTranslation.Vec();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NumShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Sweep_NumShape BRepSweep_Prism::NumShape()const
|
||||
{
|
||||
return Sweep_NumShape(2,TopAbs_EDGE);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NumShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Sweep_NumShape BRepSweep_Prism::NumShape(const Standard_Boolean Inf)const
|
||||
{
|
||||
Sweep_NumShape N;
|
||||
if(Inf){
|
||||
N.Init(0,TopAbs_EDGE,Standard_False,Standard_True,Standard_True);
|
||||
}
|
||||
else{
|
||||
N.Init(1,TopAbs_EDGE,Standard_False,Standard_False,Standard_True);
|
||||
}
|
||||
return N;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Location
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopLoc_Location BRepSweep_Prism::Location(const gp_Vec& V)const
|
||||
{
|
||||
gp_Trsf gpt;
|
||||
gpt.SetTranslation(V);
|
||||
TopLoc_Location L(gpt);
|
||||
return L;
|
||||
}
|
60
src/BRepSweep/BRepSweep_Replace.tcl
Executable file
60
src/BRepSweep/BRepSweep_Replace.tcl
Executable file
@@ -0,0 +1,60 @@
|
||||
|
||||
|
||||
proc BRepSweep_Replace:AdmFileType {} {
|
||||
return "dbadmfile";
|
||||
}
|
||||
|
||||
proc BRepSweep_Replace:OutputDirTypeName {} {
|
||||
return "dbtmpfile";
|
||||
}
|
||||
|
||||
|
||||
proc BRepSweep_Replace:HandleInputFile { ID } {
|
||||
|
||||
scan $ID "%\[^:\]:%\[^:\]:%\[^:\]" unit type name
|
||||
|
||||
switch $name {
|
||||
BRepSweep_NumLinearRegularSweep.hxx {return 1;}
|
||||
default {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc BRepSweep_Replace:Execute { unit args } {
|
||||
|
||||
global tcl_interactive
|
||||
|
||||
set tcl_interactive 1
|
||||
package require Wokutils
|
||||
|
||||
msgprint -i -c "BRepSweep_Replace:Execute" "Copying of BRepSweep includes"
|
||||
|
||||
if { [wokparam -e %Station $unit] != "wnt" } {
|
||||
set copycmd "cp -p "
|
||||
set replstr "/"
|
||||
} {
|
||||
set copycmd "cmd /c copy"
|
||||
set replstr "\\\\\\\\"
|
||||
}
|
||||
|
||||
foreach file $args {
|
||||
scan $file "%\[^:\]:%\[^:\]:%\[^:\]" Unit type name
|
||||
|
||||
regsub ".hxx" $name ".hxx" sourcename
|
||||
|
||||
set source [woklocate -p BRepSweep:source:$sourcename [wokinfo -N $unit]]
|
||||
set vistarget [woklocate -p BRepSweep:pubinclude:$name [wokinfo -N $unit]]
|
||||
set target [wokinfo -p pubinclude:$name $unit]
|
||||
|
||||
regsub -all "/" " $source $target" $replstr TheArgs
|
||||
|
||||
msgprint -i -c "BRepSweep_Replace:Execute" "Copy $source to $target"
|
||||
if { [file exist $target] && [wokparam -e %Station $unit] != "wnt" } {
|
||||
eval exec "chmod u+w $target"
|
||||
}
|
||||
eval exec "$copycmd $TheArgs"
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
112
src/BRepSweep/BRepSweep_Revol.cdl
Executable file
112
src/BRepSweep/BRepSweep_Revol.cdl
Executable file
@@ -0,0 +1,112 @@
|
||||
-- File: BRepSweep_Revol.cdl
|
||||
-- Created: Tue Jun 22 16:59:31 1993
|
||||
-- Author: Laurent BOURESCHE
|
||||
-- <lbo@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Revol from BRepSweep
|
||||
|
||||
---Purpose: Provides natural constructors to build BRepSweep
|
||||
-- rotated swept Primitives.
|
||||
|
||||
uses
|
||||
|
||||
PlaneAngle from Quantity,
|
||||
NumShape from Sweep,
|
||||
Rotation from BRepSweep,
|
||||
Location from TopLoc,
|
||||
Shape from TopoDS,
|
||||
Ax1 from gp
|
||||
|
||||
raises
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
Create (S : Shape from TopoDS;
|
||||
A : Ax1 from gp;
|
||||
D : PlaneAngle from Quantity;
|
||||
C : Boolean from Standard = Standard_False)
|
||||
---Purpose: Builds the Revol of meridian S axis A and angle D. If
|
||||
-- C is true S is copied.
|
||||
returns Revol from BRepSweep;
|
||||
|
||||
Create (S : Shape from TopoDS;
|
||||
A : Ax1 from gp;
|
||||
C : Boolean from Standard = Standard_False)
|
||||
---Purpose: Builds the Revol of meridian S axis A and angle 2*Pi.
|
||||
-- If C is true S is copied.
|
||||
returns Revol from BRepSweep;
|
||||
|
||||
Shape (me :in out)
|
||||
---Purpose: Returns the TopoDS Shape attached to the Revol.
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
|
||||
Shape (me : in out; aGenS : Shape from TopoDS)
|
||||
---Purpose: Returns the TopoDS Shape generated with aGenS
|
||||
-- (subShape of the generating shape).
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
FirstShape (me : in out)
|
||||
---Purpose: Returns the first shape of the revol (coinciding with
|
||||
-- the generating shape).
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
FirstShape (me : in out; aGenS : Shape from TopoDS)
|
||||
---Purpose: Returns the first shape of the revol (coinciding with
|
||||
-- the generating shape).
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
LastShape (me : in out)
|
||||
---Purpose: Returns the TopoDS Shape of the top of the prism.
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
LastShape (me : in out; aGenS : Shape from TopoDS)
|
||||
---Purpose: Returns the TopoDS Shape of the top of the prism.
|
||||
-- generated with aGenS (subShape of the generating
|
||||
-- shape).
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
|
||||
Axe(me)
|
||||
returns Ax1 from gp
|
||||
---Purpose: returns the axis
|
||||
is static;
|
||||
|
||||
Angle(me)
|
||||
returns PlaneAngle from Quantity
|
||||
---Purpose: returns the angle.
|
||||
is static;
|
||||
|
||||
NumShape(me; D : Real from Standard)
|
||||
returns NumShape from Sweep
|
||||
---Purpose: builds the NumShape.
|
||||
is static private;
|
||||
|
||||
Location(me; Ax : Ax1 from gp; D : Real from Standard)
|
||||
returns Location from TopLoc
|
||||
---Purpose: Builds the Location
|
||||
is static private;
|
||||
|
||||
Axe(me; Ax : Ax1 from gp; D : Real from Standard)
|
||||
returns Ax1 from gp
|
||||
---Purpose: Builds the axis
|
||||
is static private;
|
||||
|
||||
Angle(me; D : Real from Standard)
|
||||
returns Real from Standard
|
||||
---Purpose: computes the angle.
|
||||
is static private;
|
||||
|
||||
fields
|
||||
|
||||
myRotation : Rotation from BRepSweep;
|
||||
|
||||
end Revol from BRepSweep;
|
203
src/BRepSweep/BRepSweep_Revol.cxx
Executable file
203
src/BRepSweep/BRepSweep_Revol.cxx
Executable file
@@ -0,0 +1,203 @@
|
||||
// File: BRepSweep_Revol.cxx
|
||||
// Created: Fri Jun 25 10:25:05 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
|
||||
#include <BRepSweep_Revol.ixx>
|
||||
#include <BRepSweep_Rotation.hxx>
|
||||
#include <Sweep_NumShape.hxx>
|
||||
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <Precision.hxx>
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Revol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Revol::BRepSweep_Revol
|
||||
(const TopoDS_Shape& S,
|
||||
const gp_Ax1& Ax,
|
||||
const Standard_Real D,
|
||||
const Standard_Boolean C):
|
||||
myRotation(S.Oriented(TopAbs_FORWARD),
|
||||
NumShape(D),
|
||||
Location(Ax,D),
|
||||
Axe(Ax,D),
|
||||
Angle(D),
|
||||
C)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if
|
||||
(Angle(D)<=Precision::Angular(),"BRepSweep_Revol::Constructor");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Revol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Revol::BRepSweep_Revol
|
||||
(const TopoDS_Shape& S,
|
||||
const gp_Ax1& Ax,
|
||||
const Standard_Boolean C):
|
||||
myRotation(S.Oriented(TopAbs_FORWARD),
|
||||
NumShape(2*PI),
|
||||
Location(Ax,2*PI),
|
||||
Axe(Ax,2*PI),
|
||||
Angle(2*PI),
|
||||
C)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Revol::Shape()
|
||||
{
|
||||
return myRotation.Shape();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Revol::Shape(const TopoDS_Shape& aGenS)
|
||||
{
|
||||
return myRotation.Shape(aGenS);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Revol::FirstShape()
|
||||
{
|
||||
return myRotation.FirstShape();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Revol::FirstShape(const TopoDS_Shape& aGenS)
|
||||
{
|
||||
return myRotation.FirstShape(aGenS);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LastShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Revol::LastShape()
|
||||
{
|
||||
return myRotation.LastShape();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LastShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Revol::LastShape(const TopoDS_Shape& aGenS)
|
||||
{
|
||||
return myRotation.LastShape(aGenS);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NumShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Sweep_NumShape BRepSweep_Revol::NumShape(const Standard_Real D)const
|
||||
{
|
||||
Sweep_NumShape N;
|
||||
if (Abs(Angle(D) - 2*PI)<=Precision::Angular()){
|
||||
N.Init(2,TopAbs_EDGE,Standard_True,
|
||||
Standard_False,Standard_False);
|
||||
}
|
||||
else{
|
||||
N.Init(2,TopAbs_EDGE);
|
||||
}
|
||||
return N;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Location
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopLoc_Location BRepSweep_Revol::Location(const gp_Ax1& Ax,
|
||||
const Standard_Real D)const
|
||||
{
|
||||
gp_Trsf gpt;
|
||||
gpt.SetRotation(Axe(Ax,D),Angle(D));
|
||||
TopLoc_Location L(gpt);
|
||||
return L;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Axe
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Ax1 BRepSweep_Revol::Axe(const gp_Ax1& Ax, const Standard_Real D)const
|
||||
{
|
||||
gp_Ax1 A = Ax;
|
||||
if ( D < 0. ) A.Reverse();
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Angle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepSweep_Revol::Angle(const Standard_Real D)const
|
||||
{
|
||||
Standard_Real d = Abs(D);
|
||||
while(d>(2*PI + Precision::Angular())){
|
||||
d = d - 2*PI;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Angle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepSweep_Revol::Angle()const
|
||||
{
|
||||
return myRotation.Angle();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Axe
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Ax1 BRepSweep_Revol::Axe()const
|
||||
{
|
||||
return myRotation.Axe();
|
||||
}
|
||||
|
||||
|
215
src/BRepSweep/BRepSweep_Rotation.cdl
Executable file
215
src/BRepSweep/BRepSweep_Rotation.cdl
Executable file
@@ -0,0 +1,215 @@
|
||||
-- File: BRepSweep_Rotation.cdl
|
||||
-- Created: Mon Feb 15 17:30:59 1993
|
||||
-- Author: Laurent BOURESCHE
|
||||
-- <lbo@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Rotation from BRepSweep inherits Trsf from BRepSweep
|
||||
|
||||
---Purpose: Provides an algorithm to build object by
|
||||
-- Rotation sweep.
|
||||
|
||||
uses
|
||||
PlaneAngle from Quantity,
|
||||
Ax1 from gp,
|
||||
Location from TopLoc,
|
||||
Shape from TopoDS,
|
||||
NumShape from Sweep,
|
||||
Orientation from TopAbs
|
||||
|
||||
raises
|
||||
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
Create (S : Shape from TopoDS;
|
||||
N : NumShape from Sweep;
|
||||
L : Location from TopLoc;
|
||||
A : Ax1 from gp;
|
||||
D : PlaneAngle from Quantity;
|
||||
C : Boolean from Standard)
|
||||
returns Rotation from BRepSweep
|
||||
---Purpose: Creates a topology by rotating <S> around A with the
|
||||
-- angle D.
|
||||
raises
|
||||
ConstructionError from Standard; -- if <D> is null
|
||||
|
||||
-- """"""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
-- Methods supporting the creation of the geometric part.
|
||||
-- """"""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
MakeEmptyVertex(me : in out;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
---Purpose: Builds the vertex addressed by [aGenV,aDirV], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
MakeEmptyDirectingEdge(me : in out;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep)
|
||||
---Purpose: Builds the edge addressed by [aGenV,aDirE], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
MakeEmptyGeneratingEdge(me : in out;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
---Purpose: Builds the edge addressed by [aGenE,aDirV], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
SetParameters(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenF : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep);
|
||||
---Purpose: Sets the parameters of the new vertex on the new
|
||||
-- face. The new face and new vertex where generated
|
||||
-- from aGenF, aGenV and aDirV .
|
||||
|
||||
SetDirectingParameter(me : in out;
|
||||
aNewEdge : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
aDirV : NumShape from Sweep);
|
||||
---Purpose: Sets the parameter of the new vertex on the new
|
||||
-- edge. The new edge and new vertex where generated
|
||||
-- from aGenV aDirE, and aDirV.
|
||||
|
||||
SetGeneratingParameter(me : in out;
|
||||
aNewEdge : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep);
|
||||
---Purpose: Sets the parameter of the new vertex on the new
|
||||
-- edge. The new edge and new vertex where generated
|
||||
-- from aGenE, aGenV and aDirV .
|
||||
|
||||
MakeEmptyFace(me : in out;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
---Purpose: Builds the face addressed by [aGenS,aDirS], with
|
||||
-- its geometric part, but without subcomponents. The
|
||||
-- couple aGenS, aDirS can be a "generating face and
|
||||
-- a directing vertex" or "a generating edge and a
|
||||
-- directing edge".
|
||||
returns Shape from TopoDS;
|
||||
|
||||
SetPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenF : Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs);
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenF, aGenE and aDirV.
|
||||
|
||||
SetGeneratingPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
aDirV : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs);
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenE, aDirE and aDirV.
|
||||
|
||||
SetDirectingPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs);
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenE, aDirE and aGenV.
|
||||
|
||||
DirectSolid(me : in out;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
returns Orientation from TopAbs;
|
||||
---Purpose: Returns the Orientation of the shell in the solid
|
||||
-- generated by the face aGenS with the edge aDirS.
|
||||
-- It is REVERSED if the surface is swept in the
|
||||
-- direction of the normal.
|
||||
|
||||
GGDShapeIsToAdd (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aSubGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
---Purpose: Returns true if aNewSubShape (addressed by
|
||||
-- aSubGenS and aDirS) must be added in aNewShape
|
||||
-- (addressed by aGenS and aDirS).
|
||||
returns Boolean from Standard;
|
||||
|
||||
GDDShapeIsToAdd (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep;
|
||||
aSubDirS : NumShape from Sweep)
|
||||
---Purpose: Returns true if aNewSubShape (addressed by
|
||||
-- aGenS and aSubDirS) must be added in aNewShape
|
||||
-- (addressed by aGenS and aDirS).
|
||||
returns Boolean from Standard;
|
||||
|
||||
SeparatedWires (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aSubGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
---Purpose: In some particular cases the topology of a
|
||||
-- generated face must be composed of independant
|
||||
-- closed wires, in this case this function returns
|
||||
-- true. The only case in whitch the function may
|
||||
-- return true is a planar face in a closed revol.
|
||||
returns Boolean from Standard;
|
||||
|
||||
SplitShell (me; aNewShape : Shape from TopoDS)
|
||||
returns Shape from TopoDS
|
||||
---Purpose: In some particular cases the topology of a
|
||||
-- generated Shell must be composed of independant
|
||||
-- closed Shells, in this case this function returns
|
||||
-- a Compound of independant Shells.
|
||||
is redefined;
|
||||
|
||||
HasShape(me; aGenS : Shape from TopoDS; aDirS : NumShape from Sweep)
|
||||
---Purpose: Returns true if aDirS and aGenS addresses a
|
||||
-- resulting Shape. In some specific cases the shape
|
||||
-- can be geometrically inexsistant, then this
|
||||
-- function returns false.
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsInvariant (me; aGenS : Shape from TopoDS)
|
||||
---Purpose: Returns true when the geometry of aGenS is not
|
||||
-- modified by the rotation.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Axe(me)
|
||||
returns Ax1 from gp
|
||||
---Purpose: returns the axis
|
||||
is static;
|
||||
|
||||
Angle(me)
|
||||
returns PlaneAngle from Quantity
|
||||
---Purpose: returns the angle.
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myAng : Real from Standard;
|
||||
myAxe : Ax1 from gp;
|
||||
|
||||
end Rotation;
|
840
src/BRepSweep/BRepSweep_Rotation.cxx
Executable file
840
src/BRepSweep/BRepSweep_Rotation.cxx
Executable file
@@ -0,0 +1,840 @@
|
||||
// File: BRepSweep_Rotation.cxx
|
||||
// Created: Mon Feb 15 17:48:39 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
#include <BRepSweep_Rotation.ixx>
|
||||
#include <BRepTools_Quilt.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <Adaptor3d_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
|
||||
static Standard_Real ComputeTolerance(TopoDS_Edge& E,
|
||||
const TopoDS_Face& F,
|
||||
const Handle(Geom2d_Curve)& C)
|
||||
|
||||
{
|
||||
if(BRep_Tool::Degenerated(E)) return BRep_Tool::Tolerance(E);
|
||||
|
||||
Standard_Real first,last;
|
||||
|
||||
Handle(Geom_Surface) surf = BRep_Tool::Surface(F);
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve(E,first,last);
|
||||
|
||||
Standard_Real d2 = 0.;
|
||||
Standard_Integer nn = 23;
|
||||
Standard_Real unsurnn = 1./nn;
|
||||
for(Standard_Integer i = 0; i <= nn; i++){
|
||||
Standard_Real t = unsurnn*i;
|
||||
Standard_Real u = first*(1.-t) + last*t;
|
||||
gp_Pnt Pc3d = c3d->Value(u);
|
||||
gp_Pnt2d UV = C->Value(u);
|
||||
gp_Pnt Pcons = surf->Value(UV.X(),UV.Y());
|
||||
if (Precision::IsInfinite(Pcons.X()) ||
|
||||
Precision::IsInfinite(Pcons.Y()) ||
|
||||
Precision::IsInfinite(Pcons.Z())) {
|
||||
d2=Precision::Infinite();
|
||||
break;
|
||||
}
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
d2 = 1.5*sqrt(d2);
|
||||
if(d2<1.e-7) d2 = 1.e-7;
|
||||
return d2;
|
||||
}
|
||||
|
||||
static void SetThePCurve(const BRep_Builder& B,
|
||||
TopoDS_Edge& E,
|
||||
const TopoDS_Face& F,
|
||||
const TopAbs_Orientation O,
|
||||
const Handle(Geom2d_Curve)& C)
|
||||
{
|
||||
// check if there is already a pcurve
|
||||
Standard_Real f,l;
|
||||
Handle(Geom2d_Curve) OC;
|
||||
TopLoc_Location SL;
|
||||
Handle(Geom_Plane) GP = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(F,SL));
|
||||
if (GP.IsNull())
|
||||
OC = BRep_Tool::CurveOnSurface(E,F,f,l);
|
||||
if (OC.IsNull())
|
||||
B.UpdateEdge(E,C,F,ComputeTolerance(E,F,C));
|
||||
else {
|
||||
if (O == TopAbs_REVERSED)
|
||||
B.UpdateEdge(E,OC,C,F,ComputeTolerance(E,F,C));
|
||||
else
|
||||
B.UpdateEdge(E,C,OC,F,ComputeTolerance(E,F,C));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Rotation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Rotation::BRepSweep_Rotation(const TopoDS_Shape& S,
|
||||
const Sweep_NumShape& N,
|
||||
const TopLoc_Location& L,
|
||||
const gp_Ax1& A,
|
||||
const Standard_Real D,
|
||||
const Standard_Boolean C):
|
||||
BRepSweep_Trsf(BRep_Builder(),S,N,L,C),
|
||||
myAng(D),
|
||||
myAxe(A)
|
||||
|
||||
{
|
||||
Standard_ConstructionError_Raise_if(D < Precision::Angular(),
|
||||
"BRepSweep_Rotation::Constructor");
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEmptyVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Rotation::MakeEmptyVertex
|
||||
(const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape& aDirV)
|
||||
{
|
||||
//appele uniquement en mode de construction avec copie.
|
||||
Standard_ConstructionError_Raise_if
|
||||
(!myCopy,"BRepSweep_Translation::MakeEmptyVertex");
|
||||
gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aGenV));
|
||||
TopoDS_Vertex V;
|
||||
if (aDirV.Index()==2) P.Transform(myLocation.Transformation());
|
||||
////// modified by jgv, 1.10.01, for buc61005 //////
|
||||
//myBuilder.Builder().MakeVertex(V,P,Precision::Confusion());
|
||||
myBuilder.Builder().MakeVertex( V, P, BRep_Tool::Tolerance(TopoDS::Vertex(aGenV)) );
|
||||
////////////////////////////////////////////////////
|
||||
if (aDirV.Index() == 1 &&
|
||||
IsInvariant(aGenV) &&
|
||||
myDirShapeTool.NbShapes() == 3) {
|
||||
myBuiltShapes(myGenShapeTool.Index(aGenV),3) = Standard_True;
|
||||
myShapes(myGenShapeTool.Index(aGenV),3) = V;
|
||||
}
|
||||
return V;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEmptyDirectingEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Rotation::MakeEmptyDirectingEdge
|
||||
(const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape&)
|
||||
{
|
||||
TopoDS_Edge E;
|
||||
gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aGenV));
|
||||
gp_Dir Dirz(myAxe.Direction());
|
||||
gp_Vec V(Dirz);
|
||||
gp_Pnt O(myAxe.Location());
|
||||
O.Translate(V.Dot(gp_Vec(O,P)) * V);
|
||||
if (O.IsEqual(P,Precision::Confusion())) {
|
||||
// make a degenerated edge
|
||||
// temporairement on fout une courbe 3d nulle pour que les
|
||||
// parametres soient enregistres.
|
||||
// myBuilder.Builder().MakeEdge(E);
|
||||
gp_Ax2 Axis(O,Dirz);
|
||||
Handle(Geom_Circle) GC = new Geom_Circle(Axis,0.);
|
||||
myBuilder.Builder().
|
||||
MakeEdge(E,GC,BRep_Tool::Tolerance(TopoDS::Vertex(aGenV)));
|
||||
myBuilder.Builder().Degenerated(E,Standard_True);
|
||||
}
|
||||
else {
|
||||
gp_Ax2 Axis(O,Dirz,gp_Dir(gp_Vec(O,P)));
|
||||
Handle(Geom_Circle) GC = new Geom_Circle(Axis,O.Distance(P));
|
||||
Standard_Real tol = BRep_Tool::Tolerance(TopoDS::Vertex(aGenV));
|
||||
myBuilder.Builder().MakeEdge(E, GC, tol);
|
||||
|
||||
gp_Pnt PLast = GC->Value(myAng);
|
||||
if(PLast.SquareDistance(P) > tol*tol) E.Closed(Standard_False);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return E;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEmptyGeneratingEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Rotation::MakeEmptyGeneratingEdge
|
||||
(const TopoDS_Shape& aGenE,
|
||||
const Sweep_NumShape& aDirV)
|
||||
{
|
||||
//appele dans le cas de construction avec copie, ou exceptionnellement
|
||||
//lorsque le meridien touche myaxe.
|
||||
Standard_Real First,Last;
|
||||
TopLoc_Location Loc;
|
||||
Handle(Geom_Curve) C = Handle(Geom_Curve)::DownCast
|
||||
(BRep_Tool::Curve(TopoDS::Edge(aGenE),Loc,First,Last)->Copy());
|
||||
C->Transform(Loc.Transformation());
|
||||
TopoDS_Edge E;
|
||||
if(aDirV.Index() == 2) C->Transform(myLocation.Transformation());
|
||||
myBuilder.Builder().MakeEdge(E,C,BRep_Tool::Tolerance(TopoDS::Edge(aGenE)));
|
||||
if (aDirV.Index() == 1 &&
|
||||
IsInvariant(aGenE) &&
|
||||
myDirShapeTool.NbShapes() == 3) {
|
||||
myBuiltShapes(myGenShapeTool.Index(aGenE),3) = Standard_True;
|
||||
myShapes(myGenShapeTool.Index(aGenE),3) = E;
|
||||
}
|
||||
return E;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Rotation::SetParameters
|
||||
(const TopoDS_Shape& aNewFace,
|
||||
TopoDS_Shape& aNewVertex,
|
||||
const TopoDS_Shape& aGenF,
|
||||
const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape&)
|
||||
{
|
||||
//Colle le parametre des vertex directement inclus dans les faces
|
||||
//bouchons.
|
||||
gp_Pnt2d pnt2d = BRep_Tool::Parameters(TopoDS::Vertex(aGenV),
|
||||
TopoDS::Face(aGenF));
|
||||
myBuilder.Builder().UpdateVertex
|
||||
(TopoDS::Vertex(aNewVertex),pnt2d.X(),pnt2d.Y(),
|
||||
TopoDS::Face(aNewFace),Precision::PConfusion());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDirectingParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Rotation::SetDirectingParameter
|
||||
(const TopoDS_Shape& aNewEdge,
|
||||
TopoDS_Shape& aNewVertex,
|
||||
const TopoDS_Shape&,
|
||||
const Sweep_NumShape&,
|
||||
const Sweep_NumShape& aDirV)
|
||||
{
|
||||
Standard_Real param = 0;
|
||||
TopAbs_Orientation ori = TopAbs_FORWARD;
|
||||
if (aDirV.Index() == 2) {
|
||||
param = myAng;
|
||||
ori = TopAbs_REVERSED;
|
||||
}
|
||||
TopoDS_Vertex V_wnt = TopoDS::Vertex(aNewVertex);
|
||||
V_wnt.Orientation(ori);
|
||||
myBuilder.Builder().UpdateVertex(V_wnt,
|
||||
param,TopoDS::Edge(aNewEdge),
|
||||
Precision::PConfusion());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetGeneratingParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Rotation::SetGeneratingParameter
|
||||
(const TopoDS_Shape& aNewEdge,
|
||||
TopoDS_Shape& aNewVertex,
|
||||
const TopoDS_Shape& aGenE,
|
||||
const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape&)
|
||||
{
|
||||
TopoDS_Vertex vbid = TopoDS::Vertex(aNewVertex);
|
||||
vbid.Orientation(aGenV.Orientation());
|
||||
myBuilder.Builder().UpdateVertex
|
||||
(vbid,
|
||||
BRep_Tool::Parameter(TopoDS::Vertex(aGenV),TopoDS::Edge(aGenE)),
|
||||
TopoDS::Edge(aNewEdge),Precision::PConfusion());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEmptyFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Rotation::MakeEmptyFace
|
||||
(const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape& aDirS)
|
||||
{
|
||||
Standard_Real toler;
|
||||
TopoDS_Face F;
|
||||
Handle(Geom_Surface) S;
|
||||
if(aGenS.ShapeType()==TopAbs_EDGE){
|
||||
TopLoc_Location L;
|
||||
Standard_Real First,Last;
|
||||
Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(aGenS),L,First,Last);
|
||||
toler = BRep_Tool::Tolerance(TopoDS::Edge(aGenS));
|
||||
gp_Trsf Tr = L.Transformation();
|
||||
C = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||
//// modified by jgv, 9.12.03 ////
|
||||
C = new Geom_TrimmedCurve( C, First, Last );
|
||||
//////////////////////////////////
|
||||
C->Transform(Tr);
|
||||
|
||||
Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve();
|
||||
HC->ChangeCurve().Load(C,First,Last);
|
||||
Adaptor3d_SurfaceOfRevolution AS(HC,myAxe);
|
||||
switch(AS.GetType()){
|
||||
case GeomAbs_Plane :
|
||||
{
|
||||
Handle(Geom_Plane) Pl = new Geom_Plane(AS.Plane());
|
||||
S = Pl;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cylinder :
|
||||
{
|
||||
#ifdef DEB
|
||||
gp_Cylinder c = AS.Cylinder();
|
||||
gp_Ax3 b = AS.Axis();
|
||||
gp_Ax3 a = c.Position();
|
||||
#endif
|
||||
Handle(Geom_CylindricalSurface) Cy =
|
||||
new Geom_CylindricalSurface(AS.Cylinder());
|
||||
S = Cy;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Sphere :
|
||||
{
|
||||
Handle(Geom_SphericalSurface) Sp =
|
||||
new Geom_SphericalSurface(AS.Sphere());
|
||||
S = Sp;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cone :
|
||||
{
|
||||
Handle(Geom_ConicalSurface) Co =
|
||||
new Geom_ConicalSurface(AS.Cone());
|
||||
S = Co;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Torus :
|
||||
{
|
||||
Handle(Geom_ToroidalSurface) To =
|
||||
new Geom_ToroidalSurface(AS.Torus());
|
||||
S = To;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
Handle(Geom_SurfaceOfRevolution) Se =
|
||||
new Geom_SurfaceOfRevolution(C,myAxe);
|
||||
S = Se;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
TopLoc_Location L;
|
||||
S = BRep_Tool::Surface(TopoDS::Face(aGenS),L);
|
||||
toler = BRep_Tool::Tolerance(TopoDS::Face(aGenS));
|
||||
gp_Trsf Tr = L.Transformation();
|
||||
S = Handle(Geom_Surface)::DownCast(S->Copy());
|
||||
S->Transform(Tr);
|
||||
if (aDirS.Index()==2) S->Transform(myLocation.Transformation());
|
||||
}
|
||||
myBuilder.Builder().MakeFace(F,S,toler);
|
||||
return F;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Rotation::SetPCurve
|
||||
(const TopoDS_Shape& aNewFace,
|
||||
TopoDS_Shape& aNewEdge,
|
||||
const TopoDS_Shape& aGenF,
|
||||
const TopoDS_Shape& aGenE,
|
||||
const Sweep_NumShape&,
|
||||
const TopAbs_Orientation orien)
|
||||
{
|
||||
//Met sur edges des faces bouchons des pcurves identiques a celles
|
||||
//des edges de la face generatrice.
|
||||
Standard_Real First,Last;
|
||||
SetThePCurve(myBuilder.Builder(),
|
||||
TopoDS::Edge(aNewEdge),
|
||||
TopoDS::Face(aNewFace),
|
||||
orien,
|
||||
BRep_Tool::CurveOnSurface
|
||||
(TopoDS::Edge(aGenE),TopoDS::Face(aGenF),First,Last));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetGeneratingPCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Rotation::SetGeneratingPCurve
|
||||
(const TopoDS_Shape& aNewFace,
|
||||
TopoDS_Shape& aNewEdge,
|
||||
const TopoDS_Shape&,
|
||||
const Sweep_NumShape&,
|
||||
const Sweep_NumShape& aDirV,
|
||||
const TopAbs_Orientation orien)
|
||||
{
|
||||
TopLoc_Location Loc;
|
||||
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewFace),Loc));
|
||||
Standard_Real First,Last;
|
||||
Standard_Real u,v;
|
||||
gp_Pnt point;
|
||||
gp_Pnt2d pnt2d;
|
||||
gp_Dir2d dir2d;
|
||||
gp_Lin2d L;
|
||||
if (AS.GetType()==GeomAbs_Plane){
|
||||
gp_Pln pln = AS.Plane();
|
||||
gp_Ax3 ax3 = pln.Position();
|
||||
Handle(Geom_Line) GL = Handle(Geom_Line)::DownCast
|
||||
(BRep_Tool::Curve(TopoDS::Edge(aNewEdge),Loc,First,Last));
|
||||
gp_Lin gl = GL->Lin();
|
||||
gl.Transform(Loc.Transformation());
|
||||
point = gl.Location();
|
||||
gp_Dir dir = gl.Direction();
|
||||
ElSLib::PlaneParameters(ax3,point,u,v);
|
||||
pnt2d.SetCoord(u,v);
|
||||
dir2d.SetCoord(dir.Dot(ax3.XDirection()),dir.Dot(ax3.YDirection()));
|
||||
L.SetLocation(pnt2d);
|
||||
L.SetDirection(dir2d);
|
||||
}
|
||||
else if (AS.GetType()==GeomAbs_Torus){
|
||||
gp_Torus tor = AS.Torus();
|
||||
BRepAdaptor_Curve BC(TopoDS::Edge(aNewEdge));
|
||||
Standard_Real U = BC.FirstParameter();
|
||||
point = BC.Value(U);
|
||||
if (point.Distance(tor.Location()) < Precision::Confusion()) {
|
||||
v = PI;
|
||||
// modified by NIZHNY-EAP Wed Mar 1 17:49:29 2000 ___BEGIN___
|
||||
u = 0.;
|
||||
}
|
||||
else {
|
||||
ElSLib::TorusParameters(tor.Position(),tor.MajorRadius(),
|
||||
tor.MinorRadius(),point,u,v);
|
||||
}
|
||||
// u = 0.;
|
||||
v = ElCLib::InPeriod(v,0.,2*PI);
|
||||
if((2*PI - v) <= Precision::PConfusion()) v -= 2*PI;
|
||||
if (aDirV.Index() == 2) {
|
||||
Standard_Real uLeft = u-myAng;
|
||||
ElCLib::AdjustPeriodic(-PI,PI,Precision::PConfusion(),uLeft,u);
|
||||
}
|
||||
else {
|
||||
Standard_Real uRight = u+myAng;
|
||||
ElCLib::AdjustPeriodic(-PI,PI,Precision::PConfusion(),u,uRight);
|
||||
}
|
||||
// modified by NIZHNY-EAP Wed Mar 1 17:49:32 2000 ___END___
|
||||
pnt2d.SetCoord(u,v-U);
|
||||
L.SetLocation(pnt2d);
|
||||
L.SetDirection(gp::DY2d());
|
||||
}
|
||||
else if (AS.GetType()==GeomAbs_Sphere){
|
||||
gp_Sphere sph = AS.Sphere();
|
||||
BRepAdaptor_Curve BC(TopoDS::Edge(aNewEdge));
|
||||
Standard_Real U = BC.FirstParameter();
|
||||
point = BC.Value(U);
|
||||
ElSLib::SphereParameters(sph.Position(),sph.Radius(),point,u,v);
|
||||
u = 0.;
|
||||
if (aDirV.Index() == 2) u = myAng;
|
||||
pnt2d.SetCoord(u,v-U);
|
||||
L.SetLocation(pnt2d);
|
||||
L.SetDirection(gp::DY2d());
|
||||
}
|
||||
else{
|
||||
Standard_Real u = 0;
|
||||
if (aDirV.Index() == 2) u = myAng;
|
||||
L.SetLocation(gp_Pnt2d(u,0));
|
||||
L.SetDirection(gp::DY2d());
|
||||
}
|
||||
Handle(Geom2d_Line) GL = new Geom2d_Line(L);
|
||||
SetThePCurve(myBuilder.Builder(),
|
||||
TopoDS::Edge(aNewEdge),
|
||||
TopoDS::Face(aNewFace),
|
||||
orien,
|
||||
GL);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDirectingPCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Rotation::SetDirectingPCurve
|
||||
(const TopoDS_Shape& aNewFace,
|
||||
TopoDS_Shape& aNewEdge,
|
||||
const TopoDS_Shape& aGenE,
|
||||
const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape&,
|
||||
const TopAbs_Orientation orien)
|
||||
{
|
||||
TopLoc_Location Loc;
|
||||
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewFace),Loc));
|
||||
Standard_Real
|
||||
par = BRep_Tool::Parameter(TopoDS::Vertex(aGenV),TopoDS::Edge(aGenE));
|
||||
gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(aGenV));
|
||||
gp_Pnt2d p22d;
|
||||
Standard_Real u,v;
|
||||
Handle(Geom2d_Curve) thePCurve;
|
||||
|
||||
switch(AS.GetType()){
|
||||
|
||||
case GeomAbs_Plane :
|
||||
{
|
||||
gp_Pln pln = AS.Plane();
|
||||
gp_Ax3 ax3 = pln.Position();
|
||||
gp_Pnt p1 = pln.Location();
|
||||
Standard_Real R = p1.Distance(p2);
|
||||
ElSLib::PlaneParameters(ax3,p2,u,v);
|
||||
gp_Dir2d dx2d(u,v);
|
||||
gp_Ax22d axe(gp::Origin2d(),dx2d,gp::DY2d());
|
||||
gp_Circ2d C(axe,R);
|
||||
Handle(Geom2d_Circle) GC = new Geom2d_Circle(C);
|
||||
thePCurve = GC;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone :
|
||||
{
|
||||
gp_Cone cone = AS.Cone();
|
||||
ElSLib::ConeParameters(cone.Position(),cone.RefRadius(),
|
||||
cone.SemiAngle(),p2,u,v);
|
||||
p22d.SetCoord(0.,v);
|
||||
gp_Lin2d L(p22d,gp::DX2d());
|
||||
Handle(Geom2d_Line) GL = new Geom2d_Line(L);
|
||||
thePCurve = GL;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere :
|
||||
{
|
||||
gp_Sphere sph = AS.Sphere();
|
||||
ElSLib::SphereParameters(sph.Position(),sph.Radius(),p2,u,v);
|
||||
p22d.SetCoord(0.,v);
|
||||
gp_Lin2d L(p22d,gp::DX2d());
|
||||
Handle(Geom2d_Line) GL = new Geom2d_Line(L);
|
||||
thePCurve = GL;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Torus :
|
||||
{
|
||||
gp_Pnt p1;
|
||||
Standard_Real u1,u2,v1,v2;
|
||||
gp_Torus tor = AS.Torus();
|
||||
BRepAdaptor_Curve BC(TopoDS::Edge(aGenE));
|
||||
p1 = BC.Value(BC.FirstParameter());
|
||||
if (p1.Distance(tor.Location()) < Precision::Confusion()){
|
||||
v1 = PI;
|
||||
// modified by NIZHNY-EAP Thu Mar 2 09:43:26 2000 ___BEGIN___
|
||||
u1 = 0.;
|
||||
// modified by NIZHNY-EAP Thu Mar 2 15:28:59 2000 ___END___
|
||||
}
|
||||
else {
|
||||
ElSLib::TorusParameters(tor.Position(),tor.MajorRadius(),
|
||||
tor.MinorRadius(),p1,u1,v1);
|
||||
}
|
||||
p2 = BC.Value(BC.LastParameter());
|
||||
if (p2.Distance(tor.Location()) < Precision::Confusion()){
|
||||
v2 = PI;
|
||||
}
|
||||
else {
|
||||
ElSLib::TorusParameters(tor.Position(),tor.MajorRadius(),
|
||||
tor.MinorRadius(),p2,u2,v2);
|
||||
}
|
||||
ElCLib::AdjustPeriodic(0.,2*PI,Precision::PConfusion(),v1,v2);
|
||||
// modified by NIZHNY-EAP Thu Mar 2 15:29:04 2000 ___BEGIN___
|
||||
u2 = u1 + myAng;
|
||||
ElCLib::AdjustPeriodic(-PI,PI,Precision::PConfusion(),u1,u2);
|
||||
if (aGenV.Orientation()==TopAbs_FORWARD){
|
||||
p22d.SetCoord(u1,v1);
|
||||
}
|
||||
else {
|
||||
p22d.SetCoord(u1,v2);
|
||||
// modified by NIZHNY-EAP Thu Mar 2 09:43:32 2000 ___END___
|
||||
}
|
||||
gp_Lin2d L(p22d,gp::DX2d());
|
||||
Handle(Geom2d_Line) GL = new Geom2d_Line(L);
|
||||
thePCurve = GL;
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
{
|
||||
p22d.SetCoord(0.,par);
|
||||
gp_Lin2d L(p22d,gp::DX2d());
|
||||
Handle(Geom2d_Line) GL = new Geom2d_Line(L);
|
||||
thePCurve = GL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
SetThePCurve(myBuilder.Builder(),
|
||||
TopoDS::Edge(aNewEdge),
|
||||
TopoDS::Face(aNewFace),
|
||||
orien,
|
||||
thePCurve);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DirectSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopAbs_Orientation BRepSweep_Rotation::DirectSolid
|
||||
(const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape&)
|
||||
{
|
||||
// compare the face normal and the direction
|
||||
BRepAdaptor_Surface surf(TopoDS::Face(aGenS));
|
||||
gp_Pnt P;
|
||||
gp_Vec du,dv;
|
||||
surf.D1((surf.FirstUParameter() + surf.LastUParameter()) / 2.,
|
||||
(surf.FirstVParameter() + surf.LastVParameter()) / 2.,
|
||||
P,du,dv);
|
||||
|
||||
gp_Vec V(myAxe.Location(),P);
|
||||
V.Cross(myAxe.Direction());
|
||||
Standard_Real x = V.DotCross(du,dv);
|
||||
TopAbs_Orientation orient = (x > 0) ? TopAbs_FORWARD : TopAbs_REVERSED;
|
||||
return orient;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GGDShapeIsToAdd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Rotation::GGDShapeIsToAdd
|
||||
(const TopoDS_Shape& aNewShape,
|
||||
const TopoDS_Shape& aNewSubShape,
|
||||
const TopoDS_Shape& aGenS,
|
||||
const TopoDS_Shape& aSubGenS,
|
||||
const Sweep_NumShape& aDirS )const
|
||||
{
|
||||
if (aNewShape.ShapeType()==TopAbs_FACE &&
|
||||
aNewSubShape.ShapeType()==TopAbs_EDGE &&
|
||||
aGenS.ShapeType()==TopAbs_EDGE &&
|
||||
aSubGenS.ShapeType()==TopAbs_VERTEX &&
|
||||
aDirS.Type()==TopAbs_EDGE){
|
||||
TopLoc_Location Loc;
|
||||
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewShape),Loc));
|
||||
if (AS.GetType()==GeomAbs_Plane){
|
||||
return (!IsInvariant(aSubGenS));
|
||||
}
|
||||
else{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GDDShapeIsToAdd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Rotation::GDDShapeIsToAdd
|
||||
(const TopoDS_Shape& aNewShape,
|
||||
const TopoDS_Shape& aNewSubShape,
|
||||
const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape& aDirS,
|
||||
const Sweep_NumShape& aSubDirS )const
|
||||
{
|
||||
if ( aNewShape.ShapeType() == TopAbs_SOLID &&
|
||||
aNewSubShape.ShapeType() == TopAbs_FACE &&
|
||||
aGenS.ShapeType() == TopAbs_FACE &&
|
||||
aDirS.Type() == TopAbs_EDGE &&
|
||||
aSubDirS.Type() == TopAbs_VERTEX ){
|
||||
return ( Abs(myAng - 2 * PI) > Precision::Angular() );
|
||||
}
|
||||
else if ( aNewShape.ShapeType() == TopAbs_FACE &&
|
||||
aNewSubShape.ShapeType() == TopAbs_EDGE &&
|
||||
aGenS.ShapeType() == TopAbs_EDGE &&
|
||||
aDirS.Type() == TopAbs_EDGE &&
|
||||
aSubDirS.Type() == TopAbs_VERTEX ){
|
||||
TopLoc_Location Loc;
|
||||
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewShape),Loc));
|
||||
if (AS.GetType()==GeomAbs_Plane){
|
||||
return ( Abs(myAng - 2 * PI) > Precision::Angular() );
|
||||
}
|
||||
else {
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SeparatedWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Rotation::SeparatedWires
|
||||
(const TopoDS_Shape& aNewShape,
|
||||
const TopoDS_Shape& aNewSubShape,
|
||||
const TopoDS_Shape& aGenS,
|
||||
const TopoDS_Shape& aSubGenS,
|
||||
const Sweep_NumShape& aDirS )const
|
||||
{
|
||||
if (aNewShape.ShapeType()==TopAbs_FACE &&
|
||||
aNewSubShape.ShapeType()==TopAbs_EDGE &&
|
||||
aGenS.ShapeType()==TopAbs_EDGE &&
|
||||
aSubGenS.ShapeType()==TopAbs_VERTEX &&
|
||||
aDirS.Type()==TopAbs_EDGE){
|
||||
TopLoc_Location Loc;
|
||||
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewShape),Loc));
|
||||
if (AS.GetType()==GeomAbs_Plane){
|
||||
return (Abs(myAng-2*PI) <= Precision::Angular());
|
||||
}
|
||||
else{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SplitShell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Rotation::SplitShell(const TopoDS_Shape& aNewShape)const
|
||||
{
|
||||
BRepTools_Quilt Q;
|
||||
Q.Add(aNewShape);
|
||||
return Q.Shells();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Rotation::HasShape
|
||||
(const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape& aDirS)const
|
||||
{
|
||||
if(aDirS.Type()==TopAbs_EDGE&&
|
||||
aGenS.ShapeType()==TopAbs_EDGE){
|
||||
return !IsInvariant(aGenS);
|
||||
}
|
||||
else{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsInvariant
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Rotation::IsInvariant
|
||||
(const TopoDS_Shape& aGenS)const
|
||||
{
|
||||
if(aGenS.ShapeType()==TopAbs_EDGE){
|
||||
TopLoc_Location Loc;
|
||||
Standard_Real First,Last;
|
||||
Handle(Geom_Curve)
|
||||
C = BRep_Tool::Curve(TopoDS::Edge(aGenS),Loc,First,Last);
|
||||
Handle(Standard_Type) TheType = C->DynamicType();
|
||||
if ( TheType == STANDARD_TYPE(Geom_Line)) {
|
||||
TopoDS_Vertex V1, V2;
|
||||
TopExp::Vertices(TopoDS::Edge(aGenS), V1, V2);
|
||||
return ( IsInvariant(V1) && IsInvariant(V2));
|
||||
}
|
||||
else{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else if(aGenS.ShapeType()==TopAbs_VERTEX){
|
||||
gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aGenS));
|
||||
gp_Lin Lin (myAxe.Location(), myAxe.Direction());
|
||||
return ( Lin.Distance(P) <= BRep_Tool::Tolerance(TopoDS::Vertex(aGenS)));
|
||||
}
|
||||
else
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Angle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BRepSweep_Rotation::Angle()const
|
||||
{
|
||||
return myAng;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Axe
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Ax1 BRepSweep_Rotation::Axe()const
|
||||
{
|
||||
return myAxe;
|
||||
}
|
||||
|
66
src/BRepSweep/BRepSweep_Tool.cdl
Executable file
66
src/BRepSweep/BRepSweep_Tool.cdl
Executable file
@@ -0,0 +1,66 @@
|
||||
-- File: BRepSweep_Tool.cdl
|
||||
-- Created: Tue Jun 8 17:01:08 1993
|
||||
-- Author: Laurent BOURESCHE
|
||||
-- <lbo@phobox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Tool from BRepSweep -- as Tool from Sweep
|
||||
|
||||
---Purpose: Provides the indexation and type analysis services
|
||||
-- required by the TopoDS generating Shape of BRepSweep.
|
||||
--
|
||||
|
||||
uses
|
||||
|
||||
Shape from TopoDS,
|
||||
IndexedMapOfShape from TopTools,
|
||||
ShapeEnum from TopAbs,
|
||||
Orientation from TopAbs
|
||||
|
||||
raises
|
||||
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(aShape: Shape from TopoDS);
|
||||
---Purpose: Initialize the tool with <aShape>. The IndexTool
|
||||
-- must prepare an indexation for all the subshapes
|
||||
-- of this shape.
|
||||
|
||||
NbShapes(me) returns Integer
|
||||
---Purpose: Returns the number of subshapes in the shape.
|
||||
is static;
|
||||
|
||||
Index(me; aShape : Shape from TopoDS) returns Integer
|
||||
---Purpose: Returns the index of <aShape>.
|
||||
is static;
|
||||
|
||||
Shape(me; anIndex : Integer from Standard) returns Shape from TopoDS
|
||||
---Purpose: Returns the Shape at Index anIdex.
|
||||
is static;
|
||||
|
||||
Type(me; aShape : Shape from TopoDS) returns ShapeEnum from TopAbs
|
||||
---Purpose: Returns the type of <aShape>.
|
||||
is static;
|
||||
|
||||
Orientation (me; aShape : Shape from TopoDS)
|
||||
returns Orientation from TopAbs
|
||||
---Purpose: Returns the Orientation of <aShape>.
|
||||
is static;
|
||||
|
||||
SetOrientation (me;
|
||||
aShape : in out Shape from TopoDS;
|
||||
Or : Orientation from TopAbs)
|
||||
---Purpose: Set the Orientation of <aShape> with Or.
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myMap : IndexedMapOfShape from TopTools;
|
||||
|
||||
end Tool from BRepSweep;
|
||||
|
||||
|
||||
|
87
src/BRepSweep/BRepSweep_Tool.cxx
Executable file
87
src/BRepSweep/BRepSweep_Tool.cxx
Executable file
@@ -0,0 +1,87 @@
|
||||
// File: BRepSweep_Tool.cxx
|
||||
// Created: Wed Jun 9 18:18:22 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phobox>
|
||||
|
||||
|
||||
#include <BRepSweep_Tool.ixx>
|
||||
#include <TopExp.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Tool
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Tool::BRepSweep_Tool(const TopoDS_Shape& aShape)
|
||||
{
|
||||
TopExp::MapShapes(aShape,myMap);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BRepSweep_Tool::NbShapes()const
|
||||
{
|
||||
return myMap.Extent();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Index
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BRepSweep_Tool::Index(const TopoDS_Shape& aShape)const
|
||||
{
|
||||
if(!myMap.Contains(aShape)) return 0;
|
||||
return myMap.FindIndex(aShape);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Tool::Shape(const Standard_Integer anIndex)const
|
||||
{
|
||||
return myMap.FindKey(anIndex);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopAbs_ShapeEnum BRepSweep_Tool::Type(const TopoDS_Shape& aShape)const
|
||||
{
|
||||
return aShape.ShapeType();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Orientation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopAbs_Orientation BRepSweep_Tool::Orientation
|
||||
(const TopoDS_Shape& aShape)const
|
||||
{
|
||||
return aShape.Orientation();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetOrientation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Tool::SetOrientation (TopoDS_Shape& aShape,
|
||||
const TopAbs_Orientation Or)const
|
||||
{
|
||||
aShape.Orientation(Or);
|
||||
}
|
209
src/BRepSweep/BRepSweep_Translation.cdl
Executable file
209
src/BRepSweep/BRepSweep_Translation.cdl
Executable file
@@ -0,0 +1,209 @@
|
||||
-- File: BRepSweep_Translation.cdl
|
||||
-- Created: Wed Feb 3 19:33:34 1993
|
||||
-- Author: Laurent BOURESCHE
|
||||
-- <lbo@phylox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Translation from BRepSweep inherits Trsf from BRepSweep
|
||||
|
||||
---Purpose: Provides an algorithm to build object by
|
||||
-- translation sweep.
|
||||
|
||||
uses
|
||||
Vec from gp,
|
||||
Location from TopLoc,
|
||||
Shape from TopoDS,
|
||||
NumShape from Sweep,
|
||||
Orientation from TopAbs
|
||||
|
||||
raises
|
||||
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
Create (S : Shape from TopoDS;
|
||||
N : NumShape from Sweep;
|
||||
L : Location from TopLoc;
|
||||
V : Vec from gp;
|
||||
C : Boolean from Standard;
|
||||
Canonize: Boolean from Standard = Standard_True)
|
||||
returns Translation from BRepSweep
|
||||
---Purpose: Creates a topology by translating <S> with the
|
||||
-- vector <V>. If C is true S Sucomponents are
|
||||
-- copied. If Canonize is true then generated surfaces
|
||||
-- are attempted to be canonized in simple types
|
||||
raises
|
||||
ConstructionError from Standard; -- if <V> is null
|
||||
|
||||
Delete(me:out) is redefined;
|
||||
---C++: alias "Standard_EXPORT virtual ~BRepSweep_Translation(){Delete() ; }"
|
||||
|
||||
-- """"""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
-- Methods supporting the creation of the geometric part.
|
||||
-- """"""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
|
||||
MakeEmptyVertex(me : in out;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
---Purpose: Builds the vertex addressed by [aGenV,aDirV], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
MakeEmptyDirectingEdge(me : in out;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep)
|
||||
---Purpose: Builds the edge addressed by [aGenV,aDirE], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
MakeEmptyGeneratingEdge(me : in out;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
---Purpose: Builds the edge addressed by [aGenE,aDirV], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
SetParameters(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenF : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep);
|
||||
---Purpose: Sets the parameters of the new vertex on the new
|
||||
-- face. The new face and new vertex where generated
|
||||
-- from aGenF, aGenV and aDirV .
|
||||
|
||||
SetDirectingParameter(me : in out;
|
||||
aNewEdge : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
aDirV : NumShape from Sweep);
|
||||
---Purpose: Sets the parameter of the new vertex on the new
|
||||
-- edge. The new edge and new vertex where generated
|
||||
-- from aGenV aDirE, and aDirV.
|
||||
|
||||
SetGeneratingParameter(me : in out;
|
||||
aNewEdge : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep);
|
||||
---Purpose: Sets the parameter of the new vertex on the new
|
||||
-- edge. The new edge and new vertex where generated
|
||||
-- from aGenE, aGenV and aDirV .
|
||||
|
||||
MakeEmptyFace(me : in out;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
---Purpose: Builds the face addressed by [aGenS,aDirS], with
|
||||
-- its geometric part, but without subcomponents. The
|
||||
-- couple aGenS, aDirS can be a "generating face and
|
||||
-- a directing vertex" or "a generating edge and a
|
||||
-- directing edge".
|
||||
returns Shape from TopoDS;
|
||||
|
||||
SetPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenF : Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs);
|
||||
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenF, aGenE and aDirV.
|
||||
|
||||
SetGeneratingPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
aDirV : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs);
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenE, aDirE and aDirV.
|
||||
|
||||
SetDirectingPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs);
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenE, aDirE and aGenV.
|
||||
|
||||
DirectSolid(me : in out;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
returns Orientation from TopAbs;
|
||||
---Purpose: Returns the Orientation of the shell in the solid
|
||||
-- generated by the face aGenS with the edge aDirS.
|
||||
-- It is REVERSED if the surface is swept in the
|
||||
-- direction of the normal.
|
||||
|
||||
GGDShapeIsToAdd (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aSubGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
---Purpose: Returns true if aNewSubShape (addressed by
|
||||
-- aSubGenS and aDirS) must be added in aNewShape
|
||||
-- (addressed by aGenS and aDirS).
|
||||
returns Boolean from Standard;
|
||||
|
||||
GDDShapeIsToAdd (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep;
|
||||
aSubDirS : NumShape from Sweep)
|
||||
---Purpose: Returns true if aNewSubShape (addressed by
|
||||
-- aGenS and aSubDirS) must be added in aNewShape
|
||||
-- (addressed by aGenS and aDirS).
|
||||
returns Boolean from Standard;
|
||||
|
||||
SeparatedWires (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aSubGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
---Purpose: In some particular cases the topology of a
|
||||
-- generated face must be composed of independant
|
||||
-- closed wires, in this case this function returns
|
||||
-- true.
|
||||
-- Here it always returns false.
|
||||
returns Boolean from Standard;
|
||||
|
||||
HasShape(me; aGenS : Shape from TopoDS; aDirS : NumShape from Sweep)
|
||||
---Purpose: Returns true if aDirS and aGenS addresses a
|
||||
-- resulting Shape. In some specific cases the shape
|
||||
-- can be geometrically inexsistant, then this
|
||||
-- function returns false.
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsInvariant (me; aGenS : Shape from TopoDS)
|
||||
---Purpose: Returns always false because here the
|
||||
-- transformation is a translation.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Vec(me)
|
||||
---Purpose: Returns the Vector of the Prism, if it is an infinite
|
||||
-- prism the Vec is unitar.
|
||||
returns Vec from gp
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myVec : Vec from gp;
|
||||
myCanonize : Boolean from Standard;
|
||||
|
||||
end Translation;
|
555
src/BRepSweep/BRepSweep_Translation.cxx
Executable file
555
src/BRepSweep/BRepSweep_Translation.cxx
Executable file
@@ -0,0 +1,555 @@
|
||||
// File: BRepSweep_Translation.cxx
|
||||
// Created: Thu Feb 4 16:09:37 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
#include <BRepSweep_Translation.ixx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <Adaptor3d_SurfaceOfLinearExtrusion.hxx>
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRep_TEdge.hxx>
|
||||
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
|
||||
#include <BRep_CurveRepresentation.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
static void SetThePCurve(const BRep_Builder& B,
|
||||
TopoDS_Edge& E,
|
||||
const TopoDS_Face& F,
|
||||
const TopAbs_Orientation O,
|
||||
const Handle(Geom2d_Curve)& C)
|
||||
{
|
||||
// check if there is already a pcurve on non planar faces
|
||||
Standard_Real f,l;
|
||||
Handle(Geom2d_Curve) OC;
|
||||
TopLoc_Location SL;
|
||||
Handle(Geom_Plane) GP = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(F,SL));
|
||||
if (GP.IsNull())
|
||||
OC = BRep_Tool::CurveOnSurface(E,F,f,l);
|
||||
if (OC.IsNull())
|
||||
B.UpdateEdge(E,C,F,Precision::Confusion());
|
||||
else {
|
||||
if (O == TopAbs_REVERSED)
|
||||
B.UpdateEdge(E,OC,C,F,Precision::Confusion());
|
||||
else
|
||||
B.UpdateEdge(E,C,OC,F,Precision::Confusion());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepSweep_Translation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepSweep_Translation::BRepSweep_Translation(const TopoDS_Shape& S,
|
||||
const Sweep_NumShape& N,
|
||||
const TopLoc_Location& L,
|
||||
const gp_Vec& V,
|
||||
const Standard_Boolean C,
|
||||
const Standard_Boolean Canonize) :
|
||||
BRepSweep_Trsf(BRep_Builder(),S,N,L,C),
|
||||
myVec(V),
|
||||
myCanonize(Canonize)
|
||||
{
|
||||
|
||||
Standard_ConstructionError_Raise_if
|
||||
(V.Magnitude()<Precision::Confusion(),
|
||||
"BRepSweep_Translation::Constructor");
|
||||
Init();
|
||||
}
|
||||
|
||||
void BRepSweep_Translation::Delete()
|
||||
{}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEmptyVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Translation::MakeEmptyVertex
|
||||
(const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape& aDirV)
|
||||
{
|
||||
//Only called when the option of construction is with copy.
|
||||
Standard_ConstructionError_Raise_if
|
||||
(!myCopy,"BRepSweep_Translation::MakeEmptyVertex");
|
||||
gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aGenV));
|
||||
if (aDirV.Index()==2) P.Transform(myLocation.Transformation());
|
||||
TopoDS_Vertex V;
|
||||
////// modified by jgv, 5.10.01, for buc61008 //////
|
||||
//myBuilder.Builder().MakeVertex(V,P,Precision::Confusion());
|
||||
myBuilder.Builder().MakeVertex( V, P, BRep_Tool::Tolerance(TopoDS::Vertex(aGenV)) );
|
||||
////////////////////////////////////////////////////
|
||||
return V;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEmptyDirectingEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Translation::MakeEmptyDirectingEdge
|
||||
(const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape&)
|
||||
{
|
||||
gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aGenV));
|
||||
gp_Lin L(P,myVec);
|
||||
Handle(Geom_Line) GL = new Geom_Line(L);
|
||||
TopoDS_Edge E;
|
||||
myBuilder.Builder().MakeEdge
|
||||
(E,GL,BRep_Tool::Tolerance(TopoDS::Vertex(aGenV)));
|
||||
return E;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEmptyGeneratingEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Translation::MakeEmptyGeneratingEdge
|
||||
(const TopoDS_Shape& aGenE,
|
||||
const Sweep_NumShape& aDirV)
|
||||
{
|
||||
//Appele uniquement dans le cas de construction avec copie.
|
||||
Standard_ConstructionError_Raise_if
|
||||
(!myCopy,"BRepSweep_Translation::MakeEmptyVertex");
|
||||
TopLoc_Location L;
|
||||
Standard_Real First,Last;
|
||||
Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(aGenE),L,First,Last);
|
||||
C = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||
C->Transform(L.Transformation());
|
||||
if (aDirV.Index() == 2) C->Transform(myLocation.Transformation());
|
||||
TopoDS_Edge newE;
|
||||
myBuilder.Builder().MakeEdge
|
||||
(newE,C,BRep_Tool::Tolerance(TopoDS::Edge(aGenE)));
|
||||
return newE;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Translation::SetParameters
|
||||
(const TopoDS_Shape& aNewFace,
|
||||
TopoDS_Shape& aNewVertex,
|
||||
const TopoDS_Shape& aGenF,
|
||||
const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape&)
|
||||
{
|
||||
//Colle le parametre des vertex directement inclus dans les faces
|
||||
//bouchons.
|
||||
gp_Pnt2d pnt2d = BRep_Tool::Parameters(TopoDS::Vertex(aGenV),
|
||||
TopoDS::Face(aGenF));
|
||||
myBuilder.Builder().UpdateVertex
|
||||
(TopoDS::Vertex(aNewVertex),pnt2d.X(),pnt2d.Y(),
|
||||
TopoDS::Face(aNewFace),Precision::PConfusion());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDirectingParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Translation::SetDirectingParameter
|
||||
(const TopoDS_Shape& aNewEdge,
|
||||
TopoDS_Shape& aNewVertex,
|
||||
const TopoDS_Shape&,
|
||||
const Sweep_NumShape&,
|
||||
const Sweep_NumShape& aDirV)
|
||||
{
|
||||
Standard_Real param = 0;
|
||||
if (aDirV.Index() == 2) param = myVec.Magnitude();
|
||||
myBuilder.Builder().UpdateVertex(TopoDS::Vertex(aNewVertex),
|
||||
param,TopoDS::Edge(aNewEdge),
|
||||
Precision::PConfusion());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetGeneratingParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Translation::SetGeneratingParameter
|
||||
(const TopoDS_Shape& aNewEdge,
|
||||
TopoDS_Shape& aNewVertex,
|
||||
const TopoDS_Shape& aGenE,
|
||||
const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape&)
|
||||
{
|
||||
TopoDS_Vertex vbid = TopoDS::Vertex(aNewVertex);
|
||||
vbid.Orientation(aGenV.Orientation());
|
||||
myBuilder.Builder().UpdateVertex
|
||||
(vbid,
|
||||
BRep_Tool::Parameter(TopoDS::Vertex(aGenV),TopoDS::Edge(aGenE)),
|
||||
TopoDS::Edge(aNewEdge),Precision::PConfusion());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEmptyFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepSweep_Translation::MakeEmptyFace
|
||||
(const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape& aDirS)
|
||||
{
|
||||
Standard_Real toler;
|
||||
TopoDS_Face F;
|
||||
Handle(Geom_Surface) S;
|
||||
if (myDirShapeTool.Type(aDirS)==TopAbs_EDGE){
|
||||
TopLoc_Location L;
|
||||
Standard_Real First,Last;
|
||||
Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(aGenS),L,First,Last);
|
||||
toler = BRep_Tool::Tolerance(TopoDS::Edge(aGenS));
|
||||
gp_Trsf Tr = L.Transformation();
|
||||
C = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||
//les surfaces extrudees sont inverses par rapport a la topologie, donc
|
||||
//on reverse.
|
||||
C->Transform(Tr);
|
||||
gp_Dir D(myVec);
|
||||
D.Reverse();
|
||||
|
||||
if (myCanonize) {
|
||||
Handle(GeomAdaptor_HCurve) HC = new GeomAdaptor_HCurve(C,First,Last);
|
||||
Adaptor3d_SurfaceOfLinearExtrusion AS(HC,D);
|
||||
switch(AS.GetType()){
|
||||
|
||||
case GeomAbs_Plane :
|
||||
S = new Geom_Plane(AS.Plane());
|
||||
break;
|
||||
case GeomAbs_Cylinder :
|
||||
S = new Geom_CylindricalSurface(AS.Cylinder());
|
||||
break;
|
||||
default:
|
||||
S = new Geom_SurfaceOfLinearExtrusion(C,D);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
S = new Geom_SurfaceOfLinearExtrusion(C,D);
|
||||
}
|
||||
}
|
||||
else {
|
||||
TopLoc_Location L;
|
||||
S = BRep_Tool::Surface(TopoDS::Face(aGenS),L);
|
||||
toler = BRep_Tool::Tolerance(TopoDS::Face(aGenS));
|
||||
gp_Trsf Tr = L.Transformation();
|
||||
S = Handle(Geom_Surface)::DownCast(S->Copy());
|
||||
S->Transform(Tr);
|
||||
if (aDirS.Index()==2) S->Translate(myVec);
|
||||
}
|
||||
myBuilder.Builder().MakeFace(F,S,toler);
|
||||
return F;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Translation::SetPCurve
|
||||
(const TopoDS_Shape& aNewFace,
|
||||
TopoDS_Shape& aNewEdge,
|
||||
const TopoDS_Shape& aGenF,
|
||||
const TopoDS_Shape& aGenE,
|
||||
const Sweep_NumShape&,
|
||||
const TopAbs_Orientation)
|
||||
{
|
||||
//Met sur edges des faces bouchons des pcurves identiques a celles
|
||||
//des edges de la face generatrice.
|
||||
Standard_Real First,Last;
|
||||
myBuilder.Builder().UpdateEdge
|
||||
(TopoDS::Edge(aNewEdge),
|
||||
BRep_Tool::CurveOnSurface
|
||||
(TopoDS::Edge(aGenE),TopoDS::Face(aGenF),First,Last),
|
||||
TopoDS::Face(aNewFace),Precision::PConfusion());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetGeneratingPCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Translation::SetGeneratingPCurve
|
||||
(const TopoDS_Shape& aNewFace,
|
||||
TopoDS_Shape& aNewEdge,
|
||||
const TopoDS_Shape& ,
|
||||
const Sweep_NumShape&,
|
||||
const Sweep_NumShape& aDirV,
|
||||
const TopAbs_Orientation orien)
|
||||
{
|
||||
TopLoc_Location Loc;
|
||||
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewFace),Loc));
|
||||
// Standard_Real First,Last;
|
||||
gp_Lin2d L;
|
||||
TopoDS_Edge aNewOrientedEdge = TopoDS::Edge(aNewEdge);
|
||||
aNewOrientedEdge.Orientation(orien);
|
||||
|
||||
if (AS.GetType()==GeomAbs_Plane){
|
||||
/* on ne fait rien JAG
|
||||
gp_Pln pln = AS.Plane();
|
||||
gp_Ax3 ax3 = pln.Position();
|
||||
|
||||
// JYL : l'ecriture suivante est bugatoire sur une arete construite avec une
|
||||
// courbe 3d trimmee. :
|
||||
//
|
||||
// Handle(Geom_Line)
|
||||
// GL = Handle(Geom_Line)::DownCast(BRep_Tool::Curve(TopoDS::Edge(aGenE),
|
||||
// Loc,First,Last));
|
||||
// gp_Lin gl = GL->Lin();
|
||||
// gl.Transform(Loc.Transformation());
|
||||
//
|
||||
// correction :
|
||||
const TopoDS_Edge& EE = TopoDS::Edge(aGenE);
|
||||
BRepAdaptor_Curve BRAC(EE);
|
||||
gp_Lin gl = BRAC.Line();
|
||||
|
||||
if(aDirV.Index()==2) gl.Translate(myVec);
|
||||
gp_Pnt pnt = gl.Location();
|
||||
gp_Dir dir = gl.Direction();
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(ax3,pnt,u,v);
|
||||
gp_Pnt2d pnt2d(u,v);
|
||||
gp_Dir2d dir2d(dir.Dot(ax3.XDirection()),dir.Dot(ax3.YDirection()));
|
||||
L.SetLocation(pnt2d);
|
||||
L.SetDirection(dir2d);
|
||||
*/
|
||||
}
|
||||
else{
|
||||
Standard_Real v = 0;
|
||||
if (aDirV.Index() == 2) v = -myVec.Magnitude();
|
||||
L.SetLocation(gp_Pnt2d(0,v));
|
||||
L.SetDirection(gp_Dir2d(1,0));
|
||||
// }
|
||||
Handle(Geom2d_Line) GL = new Geom2d_Line(L);
|
||||
SetThePCurve(myBuilder.Builder(),
|
||||
TopoDS::Edge(aNewEdge),
|
||||
TopoDS::Face(aNewFace),
|
||||
orien,
|
||||
GL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDirectingPCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Translation::SetDirectingPCurve
|
||||
(const TopoDS_Shape& aNewFace,
|
||||
TopoDS_Shape& aNewEdge,
|
||||
const TopoDS_Shape& aGenE,
|
||||
const TopoDS_Shape& aGenV,
|
||||
const Sweep_NumShape&,
|
||||
const TopAbs_Orientation orien)
|
||||
{
|
||||
TopLoc_Location Loc;
|
||||
GeomAdaptor_Surface AS(BRep_Tool::Surface(TopoDS::Face(aNewFace),Loc));
|
||||
gp_Lin2d L;
|
||||
if(AS.GetType()!=GeomAbs_Plane){
|
||||
L.SetLocation(gp_Pnt2d(BRep_Tool::Parameter(TopoDS::Vertex(aGenV),
|
||||
TopoDS::Edge(aGenE)),0));
|
||||
L.SetDirection(gp_Dir2d(0,-1));
|
||||
/* JAG
|
||||
}
|
||||
else{
|
||||
|
||||
gp_Pln pln = AS.Plane();
|
||||
gp_Ax3 ax3 = pln.Position();
|
||||
gp_Pnt pv = BRep_Tool::Pnt(TopoDS::Vertex(aGenV));
|
||||
gp_Dir dir(myVec);
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(ax3,pv,u,v);
|
||||
gp_Pnt2d pnt2d(u,v);
|
||||
gp_Dir2d dir2d(dir.Dot(ax3.XDirection()),dir.Dot(ax3.YDirection()));
|
||||
L.SetLocation(pnt2d);
|
||||
L.SetDirection(dir2d);
|
||||
|
||||
}
|
||||
*/
|
||||
Handle(Geom2d_Line) GL = new Geom2d_Line(L);
|
||||
SetThePCurve(myBuilder.Builder(),
|
||||
TopoDS::Edge(aNewEdge),
|
||||
TopoDS::Face(aNewFace),
|
||||
orien,GL);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DirectSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopAbs_Orientation BRepSweep_Translation::DirectSolid
|
||||
(const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape&)
|
||||
{
|
||||
// compare the face normal and the direction
|
||||
BRepAdaptor_Surface surf(TopoDS::Face(aGenS));
|
||||
gp_Pnt P;
|
||||
gp_Vec du,dv;
|
||||
surf.D1((surf.FirstUParameter() + surf.LastUParameter()) / 2.,
|
||||
(surf.FirstVParameter() + surf.LastVParameter()) / 2.,
|
||||
P,du,dv);
|
||||
|
||||
Standard_Real x = myVec.DotCross(du,dv);
|
||||
TopAbs_Orientation orient = (x > 0) ? TopAbs_REVERSED : TopAbs_FORWARD;
|
||||
return orient;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GGDShapeIsToAdd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Translation::GGDShapeIsToAdd
|
||||
(const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const Sweep_NumShape& )const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GDDShapeIsToAdd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Translation::GDDShapeIsToAdd
|
||||
(const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const Sweep_NumShape& ,
|
||||
const Sweep_NumShape& )const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SeparatedWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Translation::SeparatedWires
|
||||
(const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const TopoDS_Shape& ,
|
||||
const Sweep_NumShape& )const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Translation::HasShape
|
||||
(const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape& aDirS)const
|
||||
{
|
||||
if(myDirShapeTool.Type(aDirS) == TopAbs_EDGE) {
|
||||
|
||||
if(myGenShapeTool.Type(aGenS) == TopAbs_EDGE) {
|
||||
TopoDS_Edge E = TopoDS::Edge(aGenS);
|
||||
|
||||
// check if the edge is degenerated
|
||||
if(BRep_Tool::Degenerated(E)) {
|
||||
return Standard_False;
|
||||
}
|
||||
// check if the edge is a sewing edge
|
||||
|
||||
// modified by NIZHNY-EAP Fri Dec 24 11:13:09 1999 ___BEGIN___
|
||||
// const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
|
||||
|
||||
// BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
|
||||
// BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
|
||||
|
||||
// while (itcr.More()) {
|
||||
// const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||
// if (cr->IsCurveOnSurface() &&
|
||||
// cr->IsCurveOnClosedSurface() ) {
|
||||
// cout<<"sewing edge"<<endl;
|
||||
// return Standard_False;
|
||||
// }
|
||||
// itcr.Next();
|
||||
// }
|
||||
TopExp_Explorer FaceExp(myGenShape, TopAbs_FACE);
|
||||
for (;FaceExp.More(); FaceExp.Next()) {
|
||||
TopoDS_Face F = TopoDS::Face(FaceExp.Current());
|
||||
if (BRepTools::IsReallyClosed(E, F))
|
||||
return Standard_False;
|
||||
}
|
||||
// modified by NIZHNY-EAP Fri Dec 24 11:13:21 1999 ___END___
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsInvariant
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepSweep_Translation::IsInvariant
|
||||
(const TopoDS_Shape& )const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Vec
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Vec BRepSweep_Translation::Vec()const
|
||||
{
|
||||
return myVec;
|
||||
}
|
||||
|
||||
|
241
src/BRepSweep/BRepSweep_Trsf.cdl
Executable file
241
src/BRepSweep/BRepSweep_Trsf.cdl
Executable file
@@ -0,0 +1,241 @@
|
||||
-- File: BRepSweep_Trsf.cdl
|
||||
-- Created: Tue Jun 8 15:43:21 1993
|
||||
-- Author: Laurent BOURESCHE
|
||||
-- <lbo@phobox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
deferred class Trsf from BRepSweep inherits NumLinearRegularSweep
|
||||
from BRepSweep
|
||||
|
||||
---Purpose: This class is inherited from NumLinearRegularSweep
|
||||
-- to implement the simple swept primitives built
|
||||
-- moving a Shape with a Trsf. It often is possible
|
||||
-- to build the constructed subshapes by a simple
|
||||
-- move of the generating subshapes (shared topology
|
||||
-- and geometry). So two ways of construction are
|
||||
-- proposed :
|
||||
--
|
||||
--
|
||||
-- - sharing basis elements (the generatrice can be
|
||||
-- modified , for exemples PCurves can be added on
|
||||
-- faces);
|
||||
--
|
||||
-- - copying everything.
|
||||
|
||||
|
||||
uses
|
||||
|
||||
Builder from BRep,
|
||||
Shape from TopoDS,
|
||||
NumShape from Sweep,
|
||||
Location from TopLoc,
|
||||
Orientation from TopAbs
|
||||
|
||||
is
|
||||
|
||||
Delete(me:out) is redefined;
|
||||
---C++: alias "Standard_EXPORT virtual ~BRepSweep_Trsf(){Delete() ; }"
|
||||
|
||||
Initialize(aBuilder : Builder from BRep;
|
||||
aGenShape : Shape from TopoDS;
|
||||
aDirWire : NumShape from Sweep;
|
||||
aLocation : Location from TopLoc;
|
||||
aCopy : Boolean from Standard);
|
||||
---Purpose: Initialize the Trsf BrepSweep, if aCopy is true
|
||||
-- the basis elements are shared as often as
|
||||
-- possible, else everything is copied.
|
||||
--
|
||||
|
||||
Init(me : in out)
|
||||
---Purpose: ends the construction of the swept primitive
|
||||
-- calling the virtual geometric functions that can't
|
||||
-- be called in the initialize.
|
||||
is static;
|
||||
|
||||
Process (me : in out;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
returns Boolean from Standard
|
||||
---Purpose: function called to analize the way of construction
|
||||
-- of the shapes generated by aGenS and aDirV.
|
||||
is static;
|
||||
|
||||
-- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
-- Deferred Methods supporting the creation of the geometric part.
|
||||
-- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
MakeEmptyVertex(me : in out;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
returns Shape from TopoDS
|
||||
---Purpose: Builds the vertex addressed by [aGenV,aDirV], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
is deferred;
|
||||
|
||||
MakeEmptyDirectingEdge(me : in out;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep)
|
||||
returns Shape from TopoDS
|
||||
---Purpose: Builds the edge addressed by [aGenV,aDirE], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
is deferred;
|
||||
|
||||
MakeEmptyGeneratingEdge(me : in out;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
returns Shape from TopoDS
|
||||
---Purpose: Builds the edge addressed by [aGenE,aDirV], with its
|
||||
-- geometric part, but without subcomponents.
|
||||
is deferred;
|
||||
|
||||
SetParameters(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenF : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
---Purpose: Sets the parameters of the new vertex on the new
|
||||
-- face. The new face and new vertex where generated
|
||||
-- from aGenF, aGenV and aDirV .
|
||||
is deferred;
|
||||
|
||||
SetDirectingParameter(me : in out;
|
||||
aNewEdge : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
aDirV : NumShape from Sweep)
|
||||
---Purpose: Sets the parameter of the new vertex on the new
|
||||
-- edge. The new edge and new vertex where generated
|
||||
-- from aGenV aDirE, and aDirV.
|
||||
is deferred;
|
||||
|
||||
SetGeneratingParameter(me : in out;
|
||||
aNewEdge : Shape from TopoDS;
|
||||
aNewVertex : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep)
|
||||
---Purpose: Sets the parameter of the new vertex on the new
|
||||
-- edge. The new edge and new vertex where generated
|
||||
-- from aGenE, aGenV and aDirV .
|
||||
is deferred;
|
||||
|
||||
MakeEmptyFace(me : in out;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
returns Shape from TopoDS
|
||||
---Purpose: Builds the face addressed by [aGenS,aDirS], with
|
||||
-- its geometric part, but without subcomponents. The
|
||||
-- couple aGenS, aDirS can be a "generating face and
|
||||
-- a directing vertex" or "a generating edge and a
|
||||
-- directing edge".
|
||||
is deferred;
|
||||
|
||||
SetPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenF : Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirV : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs)
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenF, aGenE and aDirV.
|
||||
is deferred;
|
||||
|
||||
SetGeneratingPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
aDirV : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs)
|
||||
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenE, aDirE and aDirV.
|
||||
is deferred;
|
||||
|
||||
SetDirectingPCurve(me : in out;
|
||||
aNewFace : Shape from TopoDS;
|
||||
aNewEdge : in out Shape from TopoDS;
|
||||
aGenE : Shape from TopoDS;
|
||||
aGenV : Shape from TopoDS;
|
||||
aDirE : NumShape from Sweep;
|
||||
orien : Orientation from TopAbs)
|
||||
|
||||
---Purpose: Sets the PCurve for a new edge on a new face. The
|
||||
-- new edge and the new face were generated using
|
||||
-- aGenE, aDirE and aGenV.
|
||||
is deferred;
|
||||
|
||||
GGDShapeIsToAdd (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aSubGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Returns true if aNewSubShape (addressed by
|
||||
-- aSubGenS and aDirS) must be added in aNewShape
|
||||
-- (addressed by aGenS and aDirS).
|
||||
is deferred;
|
||||
|
||||
GDDShapeIsToAdd (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep;
|
||||
aSubDirS : NumShape from Sweep)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Returns true if aNewSubShape (addressed by
|
||||
-- aGenS and aSubDirS) must be added in aNewShape
|
||||
-- (addressed by aGenS and aDirS).
|
||||
is deferred;
|
||||
|
||||
SeparatedWires (me;
|
||||
aNewShape : Shape from TopoDS;
|
||||
aNewSubShape : Shape from TopoDS;
|
||||
aGenS : Shape from TopoDS;
|
||||
aSubGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep)
|
||||
returns Boolean from Standard
|
||||
---Purpose: In some particular cases the topology of a
|
||||
-- generated face must be composed of independant
|
||||
-- closed wires, in this case this function returns
|
||||
-- true.
|
||||
is deferred;
|
||||
|
||||
HasShape(me; aGenS : Shape from TopoDS; aDirS : NumShape from Sweep)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Returns true if aDirS and aGenS addresses a
|
||||
-- resulting Shape. In some specific cases the shape
|
||||
-- can be geometrically inexsistant, then this
|
||||
-- function returns false.
|
||||
is deferred;
|
||||
|
||||
IsInvariant (me; aGenS : Shape from TopoDS)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Returns true if the geometry of aGenS is not
|
||||
-- modified by the trsf of the BRepSweep Trsf.
|
||||
is deferred;
|
||||
|
||||
|
||||
-- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
-- Method coding the continuities on the edges between 2 faces
|
||||
-- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
SetContinuity(me : in out;
|
||||
aGenS : Shape from TopoDS;
|
||||
aDirS : NumShape from Sweep);
|
||||
---Purpose: Called to propagate the continuity of every vertex
|
||||
-- between two edges of the generating wire aGenS on
|
||||
-- the generated edge and faces.
|
||||
|
||||
fields
|
||||
|
||||
myLocation : Location from TopLoc is protected;
|
||||
myCopy : Boolean from Standard is protected;
|
||||
|
||||
end Trsf from BRepSweep;
|
165
src/BRepSweep/BRepSweep_Trsf.cxx
Executable file
165
src/BRepSweep/BRepSweep_Trsf.cxx
Executable file
@@ -0,0 +1,165 @@
|
||||
// File: BRepSweep_Trsf.cxx
|
||||
// Created: Thu Jun 10 10:21:13 1993
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phobox>
|
||||
|
||||
#include <BRepSweep_Trsf.ixx>
|
||||
#include <Sweep_NumShapeIterator.hxx>
|
||||
#include <BRepSweep_Iterator.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepLProp.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
BRepSweep_Trsf::BRepSweep_Trsf(const BRep_Builder& aBuilder,
|
||||
const TopoDS_Shape& aGenShape,
|
||||
const Sweep_NumShape& aDirWire,
|
||||
const TopLoc_Location& aLocation,
|
||||
const Standard_Boolean aCopy):
|
||||
BRepSweep_NumLinearRegularSweep(aBuilder,aGenShape,aDirWire),
|
||||
myLocation(aLocation),
|
||||
myCopy(aCopy)
|
||||
{
|
||||
}
|
||||
|
||||
void BRepSweep_Trsf::Delete()
|
||||
{}
|
||||
|
||||
|
||||
void BRepSweep_Trsf::Init()
|
||||
{
|
||||
if(!myCopy){
|
||||
Sweep_NumShapeIterator It;
|
||||
for(It.Init(myDirWire);It.More();It.Next()){
|
||||
Process(myGenShape,It.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean BRepSweep_Trsf::Process(const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape& aDirV)
|
||||
{
|
||||
Standard_Boolean dotrsf = (aDirV.Index()==2 && !myDirWire.Closed());
|
||||
Standard_Integer iD = myDirShapeTool.Index(aDirV);
|
||||
Standard_Integer iG = myGenShapeTool.Index(aGenS);
|
||||
if(IsInvariant(aGenS)){
|
||||
myShapes(iG,iD) = aGenS;
|
||||
myBuiltShapes(iG,iD) = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
else{
|
||||
BRepSweep_Iterator Jt;
|
||||
Standard_Boolean touch = Standard_False;
|
||||
for(Jt.Init(aGenS);Jt.More();Jt.Next()){
|
||||
if(Process(Jt.Value(),aDirV)) touch = Standard_True;
|
||||
}
|
||||
if(!touch || !dotrsf){
|
||||
TopoDS_Shape newShape = aGenS;
|
||||
if(dotrsf) newShape.Move(myLocation);
|
||||
myShapes(iG,iD) = newShape;
|
||||
myBuiltShapes(iG,iD) = Standard_True;
|
||||
}
|
||||
return touch;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetContinuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepSweep_Trsf::SetContinuity(const TopoDS_Shape& aGenS,
|
||||
const Sweep_NumShape& aDirS)
|
||||
{
|
||||
Standard_Real tl = Precision::Confusion(), tol3d;
|
||||
//angular etant un peu severe pour les contours sketches.
|
||||
Standard_Real ta = 0.00175;//environ 0.1 degre
|
||||
GeomAbs_Shape cont;
|
||||
BRep_Builder B = myBuilder.Builder();
|
||||
if(aGenS.ShapeType() == TopAbs_EDGE){
|
||||
if (HasShape(aGenS,aDirS)){
|
||||
TopoDS_Edge E = TopoDS::Edge(aGenS);
|
||||
BRepAdaptor_Curve e;
|
||||
Standard_Real ud,uf;
|
||||
TopoDS_Vertex d,f;
|
||||
TopExp::Vertices(E,d,f);
|
||||
if(d.IsSame(f)){
|
||||
// tol3d = Max(tl,BRep_Tool::Tolerance(d));
|
||||
tol3d = Max(tl,2.*BRep_Tool::Tolerance(d));//IFV 24.05.00 buc60684
|
||||
e.Initialize(E);
|
||||
ud = BRep_Tool::Parameter(d,TopoDS::Edge(aGenS));
|
||||
uf = BRep_Tool::Parameter(f,TopoDS::Edge(aGenS));
|
||||
cont = BRepLProp::Continuity(e,e,ud,uf,tol3d,ta);
|
||||
if(cont >= 1){
|
||||
TopoDS_Shape s_wnt = Shape(d,aDirS);
|
||||
TopoDS_Edge e_wnt = TopoDS::Edge(s_wnt);
|
||||
s_wnt = Shape(aGenS,aDirS);
|
||||
TopoDS_Face f_wnt = TopoDS::Face(s_wnt);
|
||||
B.Continuity(e_wnt,f_wnt,f_wnt,cont);
|
||||
}
|
||||
}
|
||||
if(aDirS.Closed()){
|
||||
Sweep_NumShape dirv = myDirShapeTool.Shape(2);
|
||||
if(GDDShapeIsToAdd(Shape(aGenS,aDirS),
|
||||
Shape(aGenS,dirv),
|
||||
aGenS,aDirS,dirv)){
|
||||
TopLoc_Location Lo;
|
||||
Standard_Real fi,la;
|
||||
cont = BRep_Tool::Curve(E,Lo,fi,la)->Continuity();
|
||||
if(cont >= 1){
|
||||
TopoDS_Shape s_wnt = Shape(aGenS,dirv);
|
||||
TopoDS_Edge e_wnt = TopoDS::Edge(s_wnt);
|
||||
s_wnt = Shape(aGenS,aDirS);
|
||||
TopoDS_Face f_wnt = TopoDS::Face(s_wnt);
|
||||
B.Continuity(e_wnt,f_wnt,f_wnt,cont);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(aGenS.ShapeType() == TopAbs_WIRE){
|
||||
TopoDS_Edge E1,E2;
|
||||
BRepAdaptor_Curve e1,e2;
|
||||
Standard_Real u1,u2;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape M;
|
||||
TopExp::MapShapesAndAncestors(aGenS,TopAbs_VERTEX,TopAbs_EDGE,M);
|
||||
TopTools_ListIteratorOfListOfShape It,Jt;
|
||||
for(Standard_Integer i = 1; i <= M.Extent(); i++){
|
||||
TopoDS_Vertex V = TopoDS::Vertex(M.FindKey(i));
|
||||
Standard_Integer j = 1;
|
||||
for(It.Initialize(M.FindFromIndex(i));It.More();It.Next(),j++){
|
||||
Jt.Initialize(M.FindFromIndex(i));
|
||||
for(Standard_Integer k=1; k <= j; k++) { Jt.Next(); }
|
||||
for(;Jt.More();Jt.Next()){
|
||||
E1 = TopoDS::Edge(It.Value());
|
||||
E2 = TopoDS::Edge(Jt.Value());
|
||||
if (!E1.IsSame(E2) && HasShape(E1,aDirS) && HasShape(E2,aDirS)){
|
||||
u1 = BRep_Tool::Parameter(V,E1);
|
||||
u2 = BRep_Tool::Parameter(V,E2);
|
||||
// tol3d = Max(tl,BRep_Tool::Tolerance(V));
|
||||
tol3d = Max(tl,2.*BRep_Tool::Tolerance(V)); //IFV 24.05.00 buc60684
|
||||
e1.Initialize(E1);
|
||||
e2.Initialize(E2);
|
||||
cont = BRepLProp::Continuity(e1,e2,u1,u2,tol3d,ta);
|
||||
if(cont >= 1){
|
||||
TopoDS_Shape s_wnt = Shape(V,aDirS);
|
||||
TopoDS_Edge e_wnt = TopoDS::Edge(s_wnt);
|
||||
s_wnt = Shape(E1,aDirS);
|
||||
TopoDS_Face f1_wnt = TopoDS::Face(s_wnt);
|
||||
s_wnt = Shape(E2,aDirS);
|
||||
TopoDS_Face f2_wnt = TopoDS::Face(s_wnt);
|
||||
B.Continuity(e_wnt,f1_wnt,f2_wnt,cont);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
src/BRepSweep/BRepSweep_WOKSteps.edl
Executable file
17
src/BRepSweep/BRepSweep_WOKSteps.edl
Executable file
@@ -0,0 +1,17 @@
|
||||
|
||||
--
|
||||
-- File: BRepSweep_WOKSteps.edl
|
||||
-- Author: JR
|
||||
-- History: 19-11-99
|
||||
-- Copyright: Matra Datavision 1999
|
||||
--
|
||||
|
||||
@ifnotdefined ( %BRepSweep_WOKSteps_EDL) then
|
||||
|
||||
@set %BRepSweep_WOKSteps_EDL = "";
|
||||
|
||||
@string %WOKSteps_XcppGroup += " xcpp.repl ";
|
||||
@set %WOKSteps_xcpp_repl = "*BRepSweep_Replace(xcpp.header)";
|
||||
|
||||
@endif;
|
||||
|
3
src/BRepSweep/FILES
Executable file
3
src/BRepSweep/FILES
Executable file
@@ -0,0 +1,3 @@
|
||||
BRepSweep_NumLinearRegularSweep.hxx
|
||||
BRepSweep_WOKSteps.edl
|
||||
BRepSweep_Replace.tcl
|
Reference in New Issue
Block a user