Part::TopoShape Class Reference

The representation for a CAD Shape. More...

#include <TopoShape.h>

Public Member Functions

const TopoDS_Shape & getShape () const
 
void operator= (const TopoShape &)
 
void setShape (const TopoDS_Shape &shape)
 
 TopoShape ()
 
 TopoShape (const TopoDS_Shape &)
 
 TopoShape (const TopoShape &)
 
 ~TopoShape ()
 
Subelement management
virtual std::vector< const char * > getElementTypes (void) const
 Sub type list List of different subelement types it is NOT a list of the subelements itself. More...
 
virtual unsigned long countSubElements (const char *Type) const
 
virtual Data::SegmentgetSubElement (const char *Type, unsigned long) const
 get the subelement by type and number More...
 
virtual void getLinesFromSubelement (const Data::Segment *, std::vector< Base::Vector3d > &Points, std::vector< Line > &lines) const
 Get lines from segment. More...
 
virtual void getFacesFromSubelement (const Data::Segment *, std::vector< Base::Vector3d > &Points, std::vector< Base::Vector3d > &PointNormals, std::vector< Facet > &faces) const
 Get faces from segment. More...
 
TopoDS_Shape getSubShape (const char *Type, bool silent=false) const
 get the Topo"sub"Shape with the given name More...
 
TopoDS_Shape getSubShape (TopAbs_ShapeEnum type, int idx, bool silent=false) const
 
std::vector< TopoShapegetSubTopoShapes (TopAbs_ShapeEnum type=TopAbs_SHAPE) const
 
std::vector< TopoDS_Shape > getSubShapes (TopAbs_ShapeEnum type=TopAbs_SHAPE) const
 
unsigned long countSubShapes (const char *Type) const
 
unsigned long countSubShapes (TopAbs_ShapeEnum type) const
 
bool hasSubShape (const char *Type) const
 
bool hasSubShape (TopAbs_ShapeEnum type) const
 
PyObjectgetPySubShape (const char *Type, bool silent=false) const
 get the Topo"sub"Shape with the given name More...
 
PyObjectgetPyObject ()
 This method returns the Python wrapper for a C++ object. More...
 
void setPyObject (PyObject *)
 
Save/restore
void Save (Base::Writer &writer) const
 This method is used to save properties to an XML document. More...
 
void Restore (Base::XMLReader &reader)
 This method is used to restore properties from an XML document. More...
 
void SaveDocFile (Base::Writer &writer) const
 This method is used to save large amounts of data to a binary file. More...
 
void RestoreDocFile (Base::Reader &reader)
 This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data. More...
 
unsigned int getMemSize (void) const
 This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? More...
 
Input/Output
void read (const char *FileName)
 
void write (const char *FileName) const
 
void dump (std::ostream &out) const
 
void importIges (const char *FileName)
 
void importStep (const char *FileName)
 
void importBrep (const char *FileName)
 
void importBrep (std::istream &, int indicator=1)
 
void importBinary (std::istream &)
 
void exportIges (const char *FileName) const
 
void exportStep (const char *FileName) const
 
void exportBrep (const char *FileName) const
 
void exportBrep (std::ostream &) const
 
void exportBinary (std::ostream &)
 
void exportStl (const char *FileName, double deflection) const
 
void exportFaceSet (double, double, const std::vector< App::Color > &, std::ostream &) const
 
void exportLineSet (std::ostream &) const
 
Query
bool isNull () const
 
bool isValid () const
 
bool analyze (bool runBopCheck, std::ostream &) const
 
bool isClosed () const
 
bool isCoplanar (const TopoShape &other, double tol=-1) const
 
bool findPlane (gp_Pln &pln, double tol=-1) const
 
bool isInfinite () const
 Returns true if the expansion of the shape is infinite, false otherwise. More...
 
Boolean operation
TopoDS_Shape cut (TopoDS_Shape) const
 
TopoDS_Shape cut (const std::vector< TopoDS_Shape > &, Standard_Real tolerance=0.0) const
 
TopoDS_Shape common (TopoDS_Shape) const
 
TopoDS_Shape common (const std::vector< TopoDS_Shape > &, Standard_Real tolerance=0.0) const
 
TopoDS_Shape fuse (TopoDS_Shape) const
 
TopoDS_Shape fuse (const std::vector< TopoDS_Shape > &, Standard_Real tolerance=0.0) const
 
TopoDS_Shape oldFuse (TopoDS_Shape) const
 
TopoDS_Shape section (TopoDS_Shape, Standard_Boolean approximate=Standard_False) const
 
TopoDS_Shape section (const std::vector< TopoDS_Shape > &, Standard_Real tolerance=0.0, Standard_Boolean approximate=Standard_False) const
 
std::list< TopoDS_Wire > slice (const Base::Vector3d &, double) const
 
TopoDS_Compound slices (const Base::Vector3d &, const std::vector< double > &) const
 
TopoDS_Shape generalFuse (const std::vector< TopoDS_Shape > &sOthers, Standard_Real tolerance, std::vector< TopTools_ListOfShape > *mapInOut=nullptr) const
 generalFuse: run general fuse algorithm between this and shapes supplied as sOthers More...
 
TopoDS_Shape makePipe (const TopoDS_Shape &profile) const
 Sweeping. More...
 
TopoDS_Shape makePipeShell (const TopTools_ListOfShape &profiles, const Standard_Boolean make_solid, const Standard_Boolean isFrenet=Standard_False, int transition=0) const
 
TopoDS_Shape makePrism (const gp_Vec &) const
 
TopoDS_Shape revolve (const gp_Ax1 &, double d, Standard_Boolean isSolid=Standard_False) const
 revolve shape. Note: isSolid is deprecated (instead, use some Part::FaceMaker to make a face, first). More...
 
TopoDS_Shape makeSweep (const TopoDS_Shape &profile, double, int) const
 
TopoDS_Shape makeTube (double radius, double tol, int cont, int maxdeg, int maxsegm) const
 
TopoDS_Shape makeTorus (Standard_Real radius1, Standard_Real radius2, Standard_Real angle1, Standard_Real angle2, Standard_Real angle3, Standard_Boolean isSolid=Standard_True) const
 
TopoDS_Shape makeHelix (Standard_Real pitch, Standard_Real height, Standard_Real radius, Standard_Real angle=0, Standard_Boolean left=Standard_False, Standard_Boolean style=Standard_False) const
 
TopoDS_Shape makeLongHelix (Standard_Real pitch, Standard_Real height, Standard_Real radius, Standard_Real angle=0, Standard_Boolean left=Standard_False) const
 
TopoDS_Shape makeThread (Standard_Real pitch, Standard_Real depth, Standard_Real height, Standard_Real radius) const
 
TopoDS_Shape makeLoft (const TopTools_ListOfShape &profiles, Standard_Boolean isSolid, Standard_Boolean isRuled, Standard_Boolean isClosed=Standard_False, Standard_Integer maxDegree=5) const
 
TopoDS_Shape makeOffsetShape (double offset, double tol, bool intersection=false, bool selfInter=false, short offsetMode=0, short join=0, bool fill=false) const
 
TopoDS_Shape makeOffset2D (double offset, short joinType=0, bool fill=false, bool allowOpenResult=false, bool intersection=false) const
 
TopoDS_Shape makeThickSolid (const TopTools_ListOfShape &remFace, double offset, double tol, bool intersection=false, bool selfInter=false, short offsetMode=0, short join=0) const
 
Manipulation
void transformGeometry (const Base::Matrix4D &rclMat)
 Applies a transformation on the real geometric data type. More...
 
TopoDS_Shape transformGShape (const Base::Matrix4D &) const
 
bool transformShape (const Base::Matrix4D &, bool copy, bool checkScale=false)
 
TopoDS_Shape mirror (const gp_Ax2 &) const
 
TopoDS_Shape toNurbs () const
 
TopoDS_Shape replaceShape (const std::vector< std::pair< TopoDS_Shape, TopoDS_Shape > > &s) const
 
TopoDS_Shape removeShape (const std::vector< TopoDS_Shape > &s) const
 
void sewShape ()
 
bool fix (double, double, double)
 
bool removeInternalWires (double)
 
TopoDS_Shape removeSplitter () const
 
TopoDS_Shape defeaturing (const std::vector< TopoDS_Shape > &s) const
 
TopoDS_Shape makeShell (const TopoDS_Shape &) const
 TopoShape::makeShell If the input shape is a compound with faces not being part of a shell it tries to make a shell. More...
 
Getting basic geometric entities
virtual void getPoints (std::vector< Base::Vector3d > &Points, std::vector< Base::Vector3d > &Normals, float Accuracy, uint16_t flags=0) const
 Get points from object with given accuracy. More...
 
virtual void getFaces (std::vector< Base::Vector3d > &Points, std::vector< Facet > &faces, float Accuracy, uint16_t flags=0) const
 Get faces from object with given accuracy. More...
 
void setFaces (const std::vector< Base::Vector3d > &Points, const std::vector< Facet > &faces, float Accuracy=1.0e-06)
 
void getDomains (std::vector< Domain > &) const
 
- Public Member Functions inherited from Data::ComplexGeoData
 ComplexGeoData (void)
 Constructor. More...
 
virtual ~ComplexGeoData ()
 Destructor. More...
 
virtual SegmentgetSubElementByName (const char *Name) const
 get subelement by combined name More...
 
void applyTransform (const Base::Matrix4D &rclTrf)
 Applies an additional transformation to the current transformation. More...
 
void applyTranslation (const Base::Vector3d &)
 Applies an additional translation to the current transformation. More...
 
void applyRotation (const Base::Rotation &)
 Applies an additional rotation to the current transformation. More...
 
void setPlacement (const Base::Placement &rclPlacement)
 Override the current transformation with a placement using the setTransform() method. More...
 
Base::Placement getPlacement () const
 Return the current transformation as placement using getTransform(). More...
 
virtual Base::Vector3d getPointFromLineIntersection (const Base::Vector3f &base, const Base::Vector3f &dir) const
 Get point from line object intersection
More...
 
virtual void getLines (std::vector< Base::Vector3d > &Points, std::vector< Line > &lines, float Accuracy, uint16_t flags=0) const
 Get lines from object with given accuracy. More...
 
- Public Member Functions inherited from Base::Persistence
void dumpToStream (std::ostream &stream, int compression)
 
virtual Base::Type getTypeId (void) const
 
void restoreFromStream (std::istream &stream)
 
- Public Member Functions inherited from Base::BaseClass
 BaseClass ()
 Construction. More...
 
bool isDerivedFrom (const Type type) const
 
virtual ~BaseClass ()
 Destruction. More...
 
- Public Member Functions inherited from Base::Handled
int getRefCount (void) const
 
 Handled ()
 
const Handledoperator= (const Handled &)
 
void ref () const
 
void unref () const
 
virtual ~Handled ()
 

Placement control

void setTransform (const Base::Matrix4D &rclTrf)
 set the transformation of the CasCade Shape More...
 
void setShapePlacement (const Base::Placement &rclTrf)
 set the transformation of the CasCade Shape More...
 
Base::Placement getShapePlacement (void) const
 get the transformation of the CasCade Shape More...
 
Base::Matrix4D getTransform (void) const
 get the transformation of the CasCade Shape More...
 
Base::BoundBox3d getBoundBox (void) const
 Bound box from the CasCade shape. More...
 
virtual bool getCenterOfGravity (Base::Vector3d &center) const
 Get the center of gravity If this method is implemented then true is returned and the center of gravity. More...
 
static void convertTogpTrsf (const Base::Matrix4D &mtrx, gp_Trsf &trsf)
 
static void convertToMatrix (const gp_Trsf &trsf, Base::Matrix4D &mtrx)
 
static Base::Matrix4D convert (const gp_Trsf &trsf)
 
static gp_Trsf convert (const Base::Matrix4D &mtrx)
 

Element name mapping aware shape maker

To be complete in next batch of patches

TopoShapemakECompound (const std::vector< TopoShape > &shapes, const char *op=0, bool force=true)
 
TopoShapemakEWires (const TopoShape &shape, const char *op=0, bool fix=false, double tol=0.0)
 
TopoShape makEWires (const char *op=0, bool fix=false, double tol=0.0) const
 
TopoShapemakEFace (const std::vector< TopoShape > &shapes, const char *op=0, const char *maker=0)
 
TopoShapemakEFace (const TopoShape &shape, const char *op=0, const char *maker=0)
 
TopoShape makEFace (const char *op=0, const char *maker=0) const
 
TopoShapemakETransform (const TopoShape &shape, const Base::Matrix4D &mat, const char *op=0, bool checkScale=false, bool copy=false)
 
TopoShape makETransform (const Base::Matrix4D &mat, const char *op=0, bool checkScale=false, bool copy=false) const
 
TopoShapemakETransform (const TopoShape &shape, const gp_Trsf &trsf, const char *op=0, bool copy=false)
 
TopoShape makETransform (const gp_Trsf &trsf, const char *op=0, bool copy=false) const
 
void move (const TopLoc_Location &loc)
 
TopoShape moved (const TopLoc_Location &loc) const
 
TopoShapemakEGTransform (const TopoShape &shape, const Base::Matrix4D &mat, const char *op=0, bool copy=false)
 
TopoShape makEGTransform (const Base::Matrix4D &mat, const char *op=0, bool copy=false) const
 
TopoShapemakERefine (const TopoShape &shape, const char *op=0, bool no_fail=true)
 
TopoShape makERefine (const char *op=0, bool no_fail=true) const
 
TopAbs_ShapeEnum shapeType (bool silent=false) const
 
const std::string & shapeName (bool silent=false) const
 
static TopAbs_ShapeEnum shapeType (const char *type, bool silent=false)
 
static TopAbs_ShapeEnum shapeType (char type, bool silent=false)
 
static const std::string & shapeName (TopAbs_ShapeEnum type, bool silent=false)
 
static std::pair< TopAbs_ShapeEnum, int > shapeTypeAndIndex (const char *name)
 

Additional Inherited Members

- Static Public Member Functions inherited from Data::ComplexGeoData
static const std::string & elementMapPrefix ()
 Special prefix to mark the beginning of a mapped sub-element name. More...
 
static const std::string & tagPostfix ()
 Special postfix to mark the following tag. More...
 
static const std::string & indexPostfix ()
 Special postfix to mark the index of an array element. More...
 
static const std::string & missingPrefix ()
 Special prefix to mark a missing element. More...
 
static bool hasMissingElement (const char *subname)
 Check if a subname contains missing element. More...
 
static const char * isMappedElement (const char *name)
 Check if the name starts with elementMapPrefix() More...
 
static std::string newElementName (const char *name)
 Strip out the trailing element name if there is mapped element name precedes it. More...
 
static std::string oldElementName (const char *name)
 Strip out the mapped element name if there is one. More...
 
static std::string noElementName (const char *name)
 Strip out the old and new element name if there is one. More...
 
static const char * findElementName (const char *subname)
 Find the start of an element name in a subname. More...
 
static const char * hasMappedElementName (const char *subname)
 
- Static Public Member Functions inherited from Base::Persistence
static void * create (void)
 
static std::string encodeAttribute (const std::string &)
 Encodes an attribute upon saving. More...
 
static Base::Type getClassTypeId (void)
 
static void init (void)
 
- Static Public Member Functions inherited from Base::BaseClass
static void * create (void)
 
static Type getClassTypeId (void)
 
static void init (void)
 
- Public Attributes inherited from Data::ComplexGeoData
long Tag
 
- Protected Member Functions inherited from Data::ComplexGeoData
Base::Vector3d transformToOutside (const Base::Vector3f &vec) const
 from local to outside More...
 
Base::Vector3f transformToInside (const Base::Vector3d &vec) const
 from local to inside More...
 
- Static Protected Member Functions inherited from Base::BaseClass
static void initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr)
 

Detailed Description

The representation for a CAD Shape.

Constructor & Destructor Documentation

◆ TopoShape() [1/3]

TopoShape::TopoShape ( )

◆ TopoShape() [2/3]

TopoShape::TopoShape ( const TopoDS_Shape &  shape)

◆ TopoShape() [3/3]

TopoShape::TopoShape ( const TopoShape shape)

◆ ~TopoShape()

TopoShape::~TopoShape ( )

Member Function Documentation

◆ analyze()

bool TopoShape::analyze ( bool  runBopCheck,
std::ostream &  str 
) const

◆ common() [1/2]

TopoDS_Shape TopoShape::common ( const std::vector< TopoDS_Shape > &  shapes,
Standard_Real  tolerance = 0.0 
) const

◆ common() [2/2]

TopoDS_Shape TopoShape::common ( TopoDS_Shape  shape) const

References makeShell().

Referenced by Part::TopoShapePy::common().

◆ convert() [1/2]

gp_Trsf TopoShape::convert ( const Base::Matrix4D mtrx)
static

References convertTogpTrsf().

◆ convert() [2/2]

Base::Matrix4D TopoShape::convert ( const gp_Trsf &  trsf)
static

References convertToMatrix().

◆ convertTogpTrsf()

void TopoShape::convertTogpTrsf ( const Base::Matrix4D mtrx,
gp_Trsf &  trsf 
)
static

Referenced by convert(), and setTransform().

◆ convertToMatrix()

◆ countSubElements()

unsigned long TopoShape::countSubElements ( const char *  Type) const
virtual

Implements Data::ComplexGeoData.

References countSubShapes().

◆ countSubShapes() [1/2]

unsigned long TopoShape::countSubShapes ( const char *  Type) const

◆ countSubShapes() [2/2]

unsigned long TopoShape::countSubShapes ( TopAbs_ShapeEnum  type) const

◆ cut() [1/2]

TopoDS_Shape TopoShape::cut ( const std::vector< TopoDS_Shape > &  shapes,
Standard_Real  tolerance = 0.0 
) const

◆ cut() [2/2]

TopoDS_Shape TopoShape::cut ( TopoDS_Shape  shape) const

◆ defeaturing()

TopoDS_Shape TopoShape::defeaturing ( const std::vector< TopoDS_Shape > &  s) const

◆ dump()

void TopoShape::dump ( std::ostream &  out) const

◆ exportBinary()

void TopoShape::exportBinary ( std::ostream &  out)

◆ exportBrep() [1/2]

void TopoShape::exportBrep ( const char *  FileName) const

◆ exportBrep() [2/2]

void TopoShape::exportBrep ( std::ostream &  out) const

◆ exportFaceSet()

◆ exportIges()

void TopoShape::exportIges ( const char *  FileName) const

◆ exportLineSet()

void TopoShape::exportLineSet ( std::ostream &  str) const

◆ exportStep()

void TopoShape::exportStep ( const char *  FileName) const

◆ exportStl()

void TopoShape::exportStl ( const char *  FileName,
double  deflection 
) const

◆ findPlane()

bool TopoShape::findPlane ( gp_Pln &  pln,
double  tol = -1 
) const

References draftgeoutils.general::vec().

Referenced by isCoplanar().

◆ fix()

bool TopoShape::fix ( double  precision,
double  mintol,
double  maxtol 
)

References isValid().

Referenced by makEWires(), and removeInternalWires().

◆ fuse() [1/2]

◆ fuse() [2/2]

◆ generalFuse()

TopoDS_Shape TopoShape::generalFuse ( const std::vector< TopoDS_Shape > &  sOthers,
Standard_Real  tolerance,
std::vector< TopTools_ListOfShape > *  mapInOut = nullptr 
) const

generalFuse: run general fuse algorithm between this and shapes supplied as sOthers

Parameters
sOthers(input): list of shapes to run the algorithm between (this is automatically added to the list)
tolerance(input): fuzzy value (pass zero to disable fuzzyness and use shape tolerances only)
mapInOut(output): pointer to list of lists, to write the info which shapes in result came from which argument shape. The length of list is equal to length of sOthers+1. First element is a list of shapes that came from shape of this, and the rest are those that come from shapes in sOthers. If the info is not needed, nullptr can be passed.
Returns
compound of slices that can be combined to reproduce results of cut, fuse, common. The shapes share edges and faces where they touch. For example, if input shapes are two intersecting spheres, GFA returns three solids: two cuts and common.

References draftutils.utils::tolerance().

Referenced by Part::TopoShapePy::generalFuse().

◆ getBoundBox()

Base::BoundBox3d TopoShape::getBoundBox ( void  ) const
virtual

Bound box from the CasCade shape.

Implements Data::ComplexGeoData.

Referenced by PathSimulator::PathSim::BeginSimulation().

◆ getCenterOfGravity()

bool TopoShape::getCenterOfGravity ( Base::Vector3d center) const
virtual

Get the center of gravity If this method is implemented then true is returned and the center of gravity.

The default implementation only returns false.

Reimplemented from Data::ComplexGeoData.

◆ getDomains()

◆ getElementTypes()

std::vector< const char * > TopoShape::getElementTypes ( void  ) const
virtual

Sub type list List of different subelement types it is NOT a list of the subelements itself.

Implements Data::ComplexGeoData.

◆ getFaces()

void TopoShape::getFaces ( std::vector< Base::Vector3d > &  Points,
std::vector< Facet > &  faces,
float  Accuracy,
uint16_t  flags = 0 
) const
virtual

◆ getFacesFromSubelement()

void TopoShape::getFacesFromSubelement ( const Data::Segment element,
std::vector< Base::Vector3d > &  Points,
std::vector< Base::Vector3d > &  PointNormals,
std::vector< Facet > &  faces 
) const
virtual

◆ getLinesFromSubelement()

void TopoShape::getLinesFromSubelement ( const Data::Segment element,
std::vector< Base::Vector3d > &  Points,
std::vector< Line > &  lines 
) const
virtual

Get lines from segment.

Reimplemented from Data::ComplexGeoData.

References Base::BaseClass::getClassTypeId(), and Base::BaseClass::getTypeId().

◆ getMemSize()

unsigned int TopoShape::getMemSize ( void  ) const
virtual

This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?

Implements Base::Persistence.

◆ getPoints()

void TopoShape::getPoints ( std::vector< Base::Vector3d > &  Points,
std::vector< Base::Vector3d > &  Normals,
float  Accuracy,
uint16_t  flags = 0 
) const
virtual

Get points from object with given accuracy.

Reimplemented from Data::ComplexGeoData.

References draftgeoutils.general::v1().

◆ getPyObject()

PyObject * TopoShape::getPyObject ( void  )
virtual

This method returns the Python wrapper for a C++ object.

It's in the responsibility of the programmer to do the correct reference counting. Basically there are two ways how to implement that: Either always return a new Python object then reference counting is not a matter or return always the same Python object then the reference counter must be incremented by one. However, it's absolutely forbidden to return always the same Python object without incrementing the reference counter.

The default implementation returns 'None'.

Reimplemented from Base::BaseClass.

References TopoShape().

◆ getPySubShape()

PyObject * TopoShape::getPySubShape ( const char *  Type,
bool  silent = false 
) const

get the Topo"sub"Shape with the given name

References getSubShape(), and Part::shape2pyshape().

◆ getShape()

const TopoDS_Shape& Part::TopoShape::getShape ( ) const

Referenced by Part::TopoShapeCompoundPy::add(), Part::TopoShapeCompSolidPy::add(), Part::TopoShapeShellPy::add(), Part::TopoShapeWirePy::add(), Part::TopoShapeFacePy::addWire(), Part::TopoShapePy::ancestorsOfType(), Part::TopoShapePy::childShapes(), Part::TopoShapePy::cleaned(), Part::TopoShapePy::common(), Part::TopoShapePy::complement(), Part::TopoShapeCompoundPy::connectEdgesToWires(), Part::TopoShapePy::copy(), Part::TopoShapeFacePy::curveOnSurface(), Part::TopoShapePy::cut(), Part::TopoShapeFacePy::cutHoles(), Part::TopoShapePy::distToShape(), Drawing::FeatureProjection::execute(), Part::Refine::execute(), PartDesign::Fillet::execute(), PartDesign::Thickness::execute(), PartDesign::Transformed::execute(), Path::FeatureArea::execute(), Path::FeatureShape::execute(), Part::Revolution::execute(), PartDesign::Body::execute(), PartDesign::Boolean::execute(), PartDesign::Chamfer::execute(), Part::TopoShapePy::fixTolerance(), Part::TopoShapePy::fuse(), PartDesign::Helix::generateHelixPath(), PartDesign::DressUp::getAddSubShape(), Part::TopoShapePy::getArea(), PartDesign::DressUp::getContiniusEdges(), Part::TopoShapePy::getLength(), TechDraw::ShapeExtractor::getLocation3dFromFeat(), Part::TopoShapePy::getOrientation(), Part::TopoShapeSolidPy::getOuterShell(), Part::TopoShapeFacePy::getOuterWire(), Fem::Constraint::getPoints(), Part::Datum::getShape(), Part::Feature::getShape(), Part::TopoShapePy::getShapeType(), Part::TopoShapePy::getSubShapes(), Part::TopoShapePy::getTolerance(), PartDesign::MultiTransform::getTransformations(), Part::TopoShapePy::getVolume(), Part::TopoShapePy::globalTolerance(), Part::TopoShapePy::hashCode(), Part::TopoShapePy::inTolerance(), Part::TopoShapePy::isEqual(), Part::TopoShapePy::isInside(), Part::TopoShapePy::isPartner(), Part::TopoShapePy::isSame(), Part::TopoShapePy::limitTolerance(), Part::TopoShapePy::makeChamfer(), Part::TopoShapePy::makeFillet(), Part::TopoShapePy::makeParallelProjection(), Part::TopoShapePy::makePerspectiveProjection(), Part::TopoShapeWirePy::makePipe(), Part::TopoShapeWirePy::makePipeShell(), Part::TopoShapePy::makeThickness(), Part::TopoShapePy::nullify(), Part::TopoShapeSolidPy::offsetFaces(), Part::TopoShapePy::oldFuse(), Fem::Constraint::onChanged(), Part::TopoShapePy::optimalBoundingBox(), Part::TopoShapePy::overTolerance(), Part::TopoShapeEdgePy::parameterAt(), Part::TopoShapeEdgePy::parameters(), Part::TopoShapePy::project(), Part::TopoShapePy::proximity(), Part::TopoShapeCompoundPy::PyInit(), Part::TopoShapeCompSolidPy::PyInit(), Part::TopoShapeEdgePy::PyInit(), Part::TopoShapeFacePy::PyInit(), Part::TopoShapeShellPy::PyInit(), Part::TopoShapeSolidPy::PyInit(), Part::TopoShapeVertexPy::PyInit(), Part::TopoShapeWirePy::PyInit(), PartDesignGui::ViewProviderTransformed::recomputeFeature(), Part::TopoShapePy::reflectLines(), Part::TopoShapePy::reverse(), Part::TopoShapePy::reversed(), Part::TopoShapePy::revolve(), Part::TopoShapePy::rotate(), Part::TopoShapePy::scale(), Part::TopoShapePy::section(), Part::TopoShapePy::setOrientation(), shapeType(), FemGui::TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(), and Part::TopoShapePy::translate().

◆ getShapePlacement()

Base::Placement TopoShape::getShapePlacement ( void  ) const

get the transformation of the CasCade Shape

\obsolete

References DraftVecUtils::angle().

◆ getSubElement()

Data::Segment * TopoShape::getSubElement ( const char *  Type,
unsigned long  n 
) const
virtual

get the subelement by type and number

Implements Data::ComplexGeoData.

References getSubShape().

◆ getSubShape() [1/2]

TopoDS_Shape TopoShape::getSubShape ( const char *  Type,
bool  silent = false 
) const

◆ getSubShape() [2/2]

TopoDS_Shape TopoShape::getSubShape ( TopAbs_ShapeEnum  type,
int  idx,
bool  silent = false 
) const

◆ getSubShapes()

std::vector< TopoDS_Shape > TopoShape::getSubShapes ( TopAbs_ShapeEnum  type = TopAbs_SHAPE) const

◆ getSubTopoShapes()

std::vector< TopoShape > TopoShape::getSubTopoShapes ( TopAbs_ShapeEnum  type = TopAbs_SHAPE) const

◆ getTransform()

Base::Matrix4D TopoShape::getTransform ( void  ) const
virtual

get the transformation of the CasCade Shape

Implements Data::ComplexGeoData.

References convertToMatrix().

Referenced by PartDesign::Body::execute(), PartDesign::ShapeBinder::execute(), and Part::Feature::onChanged().

◆ hasSubShape() [1/2]

bool TopoShape::hasSubShape ( const char *  Type) const

◆ hasSubShape() [2/2]

bool TopoShape::hasSubShape ( TopAbs_ShapeEnum  type) const

◆ importBinary()

void TopoShape::importBinary ( std::istream &  str)

◆ importBrep() [1/2]

void TopoShape::importBrep ( const char *  FileName)

◆ importBrep() [2/2]

void TopoShape::importBrep ( std::istream &  str,
int  indicator = 1 
)

◆ importIges()

void TopoShape::importIges ( const char *  FileName)

Example code to get the labels for each face in an IGES file.

#include <XSControl_WorkSession.hxx>
#include <XSControl_TransferReader.hxx>
#include <IGESData_IGESModel.hxx>
#include <IGESData_IGESEntity.hxx>
IGESControl_Reader aReader;
...
// Gets the labels of all face items if defined in the IGES file
Handle(XSControl_WorkSession) ws = aReader.WS();
Handle(XSControl_TransferReader) tr = ws->TransferReader();
std::string name;
Handle(IGESData_IGESModel) aModel = aReader.IGESModel();
Standard_Integer all = aModel->NbEntities();
TopExp_Explorer ex;
for (ex.Init(this->_Shape, TopAbs_FACE); ex.More(); ex.Next())
{
const TopoDS_Face& aFace = TopoDS::Face(ex.Current());
Handle(Standard_Transient) ent = tr->EntityFromShapeResult(aFace, 1);
if (!ent.IsNull()) {
int i = aModel->Number(ent);
if (i > 0) {
Handle(IGESData_IGESEntity) ie = aModel->Entity(i);
if (ie->HasShortLabel())
name = ie->ShortLabel()->ToCString();
}
}
}
int i
Definition: SplineSurface.py:40

References Part::encodeFilename().

Referenced by Part::ImportIges::execute(), and read().

◆ importStep()

void TopoShape::importStep ( const char *  FileName)

◆ isClosed()

bool TopoShape::isClosed ( ) const

Referenced by makeLoft().

◆ isCoplanar()

bool TopoShape::isCoplanar ( const TopoShape other,
double  tol = -1 
) const

References findPlane(), and isNull().

◆ isInfinite()

bool TopoShape::isInfinite ( ) const

Returns true if the expansion of the shape is infinite, false otherwise.

Referenced by TechDraw::ShapeExtractor::extractDrawableShapes(), and TechDraw::ShapeExtractor::getShapes().

◆ isNull()

◆ isValid()

bool TopoShape::isValid ( void  ) const

Referenced by fix().

◆ makECompound()

TopoShape & TopoShape::makECompound ( const std::vector< TopoShape > &  shapes,
const char *  op = 0,
bool  force = true 
)

◆ makEFace() [1/3]

TopoShape Part::TopoShape::makEFace ( const char *  op = 0,
const char *  maker = 0 
) const

References makEFace().

◆ makEFace() [2/3]

TopoShape & TopoShape::makEFace ( const std::vector< TopoShape > &  shapes,
const char *  op = 0,
const char *  maker = 0 
)

◆ makEFace() [3/3]

TopoShape & TopoShape::makEFace ( const TopoShape shape,
const char *  op = 0,
const char *  maker = 0 
)

References makEFace().

◆ makEGTransform() [1/2]

TopoShape Part::TopoShape::makEGTransform ( const Base::Matrix4D mat,
const char *  op = 0,
bool  copy = false 
) const

References makEGTransform().

◆ makEGTransform() [2/2]

TopoShape & TopoShape::makEGTransform ( const TopoShape shape,
const Base::Matrix4D mat,
const char *  op = 0,
bool  copy = false 
)

◆ makeHelix()

TopoDS_Shape TopoShape::makeHelix ( Standard_Real  pitch,
Standard_Real  height,
Standard_Real  radius,
Standard_Real  angle = 0,
Standard_Boolean  left = Standard_False,
Standard_Boolean  style = Standard_False 
) const

◆ makeLoft()

TopoDS_Shape TopoShape::makeLoft ( const TopTools_ListOfShape &  profiles,
Standard_Boolean  isSolid,
Standard_Boolean  isRuled,
Standard_Boolean  isClosed = Standard_False,
Standard_Integer  maxDegree = 5 
) const

◆ makeLongHelix()

TopoDS_Shape TopoShape::makeLongHelix ( Standard_Real  pitch,
Standard_Real  height,
Standard_Real  radius,
Standard_Real  angle = 0,
Standard_Boolean  left = Standard_False 
) const

◆ makeOffset2D()

◆ makeOffsetShape()

TopoDS_Shape TopoShape::makeOffsetShape ( double  offset,
double  tol,
bool  intersection = false,
bool  selfInter = false,
short  offsetMode = 0,
short  join = 0,
bool  fill = false 
) const

◆ makePipe()

TopoDS_Shape TopoShape::makePipe ( const TopoDS_Shape &  profile) const

Sweeping.

Referenced by Part::TopoShapeWirePy::makePipe().

◆ makePipeShell()

TopoDS_Shape TopoShape::makePipeShell ( const TopTools_ListOfShape &  profiles,
const Standard_Boolean  make_solid,
const Standard_Boolean  isFrenet = Standard_False,
int  transition = 0 
) const

◆ makePrism()

TopoDS_Shape TopoShape::makePrism ( const gp_Vec &  vec) const

◆ makERefine() [1/2]

TopoShape Part::TopoShape::makERefine ( const char *  op = 0,
bool  no_fail = true 
) const

References makERefine().

◆ makERefine() [2/2]

TopoShape & TopoShape::makERefine ( const TopoShape shape,
const char *  op = 0,
bool  no_fail = true 
)

◆ makeShell()

TopoDS_Shape TopoShape::makeShell ( const TopoDS_Shape &  input) const

TopoShape::makeShell If the input shape is a compound with faces not being part of a shell it tries to make a shell.

If this operation fails or if the input shape is not a compound or a compound with not only faces the input shape is returned.

Returns
Shell or passed shape

Referenced by common(), cut(), and fuse().

◆ makeSweep()

TopoDS_Shape TopoShape::makeSweep ( const TopoDS_Shape &  profile,
double  tol,
int  fillMode 
) const

◆ makeThickSolid()

TopoDS_Shape TopoShape::makeThickSolid ( const TopTools_ListOfShape &  remFace,
double  offset,
double  tol,
bool  intersection = false,
bool  selfInter = false,
short  offsetMode = 0,
short  join = 0 
) const

◆ makeThread()

TopoDS_Shape TopoShape::makeThread ( Standard_Real  pitch,
Standard_Real  depth,
Standard_Real  height,
Standard_Real  radius 
) const

◆ makeTorus()

TopoDS_Shape TopoShape::makeTorus ( Standard_Real  radius1,
Standard_Real  radius2,
Standard_Real  angle1,
Standard_Real  angle2,
Standard_Real  angle3,
Standard_Boolean  isSolid = Standard_True 
) const

Referenced by Part::Torus::execute().

◆ makETransform() [1/4]

TopoShape Part::TopoShape::makETransform ( const Base::Matrix4D mat,
const char *  op = 0,
bool  checkScale = false,
bool  copy = false 
) const

References makETransform().

◆ makETransform() [2/4]

TopoShape Part::TopoShape::makETransform ( const gp_Trsf &  trsf,
const char *  op = 0,
bool  copy = false 
) const

References makETransform().

◆ makETransform() [3/4]

TopoShape& Part::TopoShape::makETransform ( const TopoShape shape,
const Base::Matrix4D mat,
const char *  op = 0,
bool  checkScale = false,
bool  copy = false 
)

◆ makETransform() [4/4]

TopoShape & TopoShape::makETransform ( const TopoShape shape,
const gp_Trsf &  trsf,
const char *  op = 0,
bool  copy = false 
)

◆ makeTube()

TopoDS_Shape TopoShape::makeTube ( double  radius,
double  tol,
int  cont,
int  maxdeg,
int  maxsegm 
) const

◆ makEWires() [1/2]

TopoShape Part::TopoShape::makEWires ( const char *  op = 0,
bool  fix = false,
double  tol = 0.0 
) const

References makEWires().

◆ makEWires() [2/2]

TopoShape & TopoShape::makEWires ( const TopoShape shape,
const char *  op = 0,
bool  fix = false,
double  tol = 0.0 
)

References fix(), and makECompound().

Referenced by makEWires().

◆ mirror()

TopoDS_Shape TopoShape::mirror ( const gp_Ax2 &  ax2) const

◆ move()

◆ moved()

TopoShape Part::TopoShape::moved ( const TopLoc_Location &  loc) const

◆ oldFuse()

TopoDS_Shape TopoShape::oldFuse ( TopoDS_Shape  shape) const

◆ operator=()

void TopoShape::operator= ( const TopoShape sh)

◆ read()

◆ removeInternalWires()

bool TopoShape::removeInternalWires ( double  minArea)

References fix().

Referenced by Part::TopoShapePy::removeInternalWires().

◆ removeShape()

TopoDS_Shape TopoShape::removeShape ( const std::vector< TopoDS_Shape > &  s) const

◆ removeSplitter()

◆ replaceShape()

TopoDS_Shape TopoShape::replaceShape ( const std::vector< std::pair< TopoDS_Shape, TopoDS_Shape > > &  s) const

◆ Restore()

void TopoShape::Restore ( Base::XMLReader )
virtual

This method is used to restore properties from an XML document.

It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:

void PropertyVector::Restore(Base::XMLReader &reader)
{
// read my Element
reader.readElement("PropertyVector");
// get the value of my Attribute
_cVec.x = reader.getAttributeAsFloat("valueX");
_cVec.y = reader.getAttributeAsFloat("valueY");
_cVec.z = reader.getAttributeAsFloat("valueZ");
}
The XML reader class This is an important helper class for the store and retrieval system of objects ...
Definition: Reader.h:118
void readElement(const char *ElementName=0)
read until a start element is found (<name>) or start-end element (<name/>) (with special name if giv...
Definition: Reader.cpp:240
double getAttributeAsFloat(const char *AttrName) const
return the named attribute as a double floating point (does type checking)
Definition: Reader.cpp:158

Implements Base::Persistence.

◆ RestoreDocFile()

void TopoShape::RestoreDocFile ( Base::Reader )
virtual

This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data.

Again you have to apply for the call of this method in the Restore() call:

void PropertyMeshKernel::Restore(Base::XMLReader &reader)
{
reader.readElement("Mesh");
std::string file (reader.getAttribute("file") );
if(file == "")
{
// read XML
MeshCore::MeshDocXML restorer(*_pcMesh);
restorer.Restore(reader);
}else{
// initiate a file read
reader.addFile(file.c_str(),this);
}
}
const char * getAttribute(const char *AttrName) const
return the named attribute as a double floating point (does type checking)
Definition: Reader.cpp:173
const char * addFile(const char *Name, Base::Persistence *Object)
add a read request of a persistent object
Definition: Reader.cpp:371
file
Definition: DrawingExample.py:75

After you issued the reader.addFile() your RestoreDocFile() is called:

void PropertyMeshKernel::RestoreDocFile(Base::Reader &reader)
{
_pcMesh->Read( reader );
}
Definition: Reader.h:296
See also
Base::Reader,Base::XMLReader

Reimplemented from Base::Persistence.

◆ revolve()

TopoDS_Shape TopoShape::revolve ( const gp_Ax1 &  axis,
double  d,
Standard_Boolean  isSolid = Standard_False 
) const

revolve shape. Note: isSolid is deprecated (instead, use some Part::FaceMaker to make a face, first).

References Base::Console(), and Base::ConsoleSingleton::Message().

Referenced by Part::Revolution::execute(), and Part::TopoShapePy::revolve().

◆ Save()

void TopoShape::Save ( Base::Writer ) const
virtual

This method is used to save properties to an XML document.

A good example you'll find in PropertyStandard.cpp, e.g. the vector:

void PropertyVector::Save (Writer &writer) const
{
writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x <<
"\" valueY=\"" << _cVec.y <<
"\" valueZ=\"" << _cVec.z <<"\"/>" << endl;
}

The writer.ind() expression writes the indentation, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.

See also
Base::Writer

Implements Base::Persistence.

◆ SaveDocFile()

void TopoShape::SaveDocFile ( Base::Writer ) const
virtual

This method is used to save large amounts of data to a binary file.

Sometimes it makes no sense to write property data as XML. In case the amount of data is too big or the data type has a more effective way to save itself. In this cases it is possible to write the data in a separate file inside the document archive. In case you want do so you have to re-implement SaveDocFile(). First, you have to inform the framework in Save() that you want do so. Here an example from the Mesh module which can save a (pontetionaly big) triangle mesh:

void PropertyMeshKernel::Save (Base::Writer &writer) const
{
if (writer.isForceXML())
{
writer << writer.ind() << "<Mesh>" << std::endl;
MeshCore::MeshDocXML saver(*_pcMesh);
saver.Save(writer);
}else{
writer << writer.ind() << "<Mesh file=\"" << writer.addFile("MeshKernel.bms", this) << "\"/>" << std::endl;
}
The Writer class This is an important helper class for the store and retrieval system of persistent o...
Definition: Writer.h:58
const char * ind(void) const
get the current indentation
Definition: Writer.h:109
std::string addFile(const char *Name, const Base::Persistence *Object)
add a write request of a persistent object
Definition: Writer.cpp:165
bool isForceXML(void)
check on state
Definition: Writer.cpp:97

The writer.isForceXML() is an indication to force you to write XML. Regardless of size and effectiveness. The second part informs the Base::writer through writer.addFile("MeshKernel.bms", this) that this object wants to write a file with the given name. The method addFile() returns a unique name that then is written in the XML stream. This allows your RestoreDocFile() method to identify and read the file again. Later your SaveDocFile() method is called as many times as you issued the addFile() call:

void PropertyMeshKernel::SaveDocFile (Base::Writer &writer) const
{
_pcMesh->Write( writer );
}

In this method you can simply stream your content to the file (Base::Writer inheriting from ostream).

Reimplemented from Base::Persistence.

◆ section() [1/2]

TopoDS_Shape TopoShape::section ( const std::vector< TopoDS_Shape > &  shapes,
Standard_Real  tolerance = 0.0,
Standard_Boolean  approximate = Standard_False 
) const

◆ section() [2/2]

TopoDS_Shape TopoShape::section ( TopoDS_Shape  shape,
Standard_Boolean  approximate = Standard_False 
) const

◆ setFaces()

void TopoShape::setFaces ( const std::vector< Base::Vector3d > &  Points,
const std::vector< Facet > &  faces,
float  Accuracy = 1.0e-06 
)

◆ setPyObject()

void TopoShape::setPyObject ( PyObject obj)
virtual

Reimplemented from Base::BaseClass.

References Part::TopoShapePy::Type.

◆ setShape()

◆ setShapePlacement()

◆ setTransform()

void TopoShape::setTransform ( const Base::Matrix4D rclTrf)
virtual

◆ sewShape()

void TopoShape::sewShape ( )

◆ shapeName() [1/2]

const std::string & TopoShape::shapeName ( bool  silent = false) const

References shapeName(), and shapeType().

◆ shapeName() [2/2]

const std::string & TopoShape::shapeName ( TopAbs_ShapeEnum  type,
bool  silent = false 
)
static

Referenced by shapeName(), and shapeTypeAndIndex().

◆ shapeType() [1/3]

TopAbs_ShapeEnum TopoShape::shapeType ( bool  silent = false) const

References getShape(), and isNull().

◆ shapeType() [2/3]

TopAbs_ShapeEnum TopoShape::shapeType ( char  type,
bool  silent = false 
)
static

◆ shapeType() [3/3]

TopAbs_ShapeEnum TopoShape::shapeType ( const char *  type,
bool  silent = false 
)
static

◆ shapeTypeAndIndex()

std::pair< TopAbs_ShapeEnum, int > TopoShape::shapeTypeAndIndex ( const char *  name)
static

References shapeName(), and shapeType().

Referenced by getSubShape(), and hasSubShape().

◆ slice()

std::list< TopoDS_Wire > TopoShape::slice ( const Base::Vector3d dir,
double  d 
) const

◆ slices()

TopoDS_Compound TopoShape::slices ( const Base::Vector3d dir,
const std::vector< double > &  d 
) const

◆ toNurbs()

TopoDS_Shape TopoShape::toNurbs ( ) const

◆ transformGeometry()

void TopoShape::transformGeometry ( const Base::Matrix4D rclMat)
virtual

Applies a transformation on the real geometric data type.

Implements Data::ComplexGeoData.

References makEGTransform().

◆ transformGShape()

TopoDS_Shape TopoShape::transformGShape ( const Base::Matrix4D rclTrf) const

◆ transformShape()

bool TopoShape::transformShape ( const Base::Matrix4D rclTrf,
bool  copy,
bool  checkScale = false 
)

◆ write()

void TopoShape::write ( const char *  FileName) const

The documentation for this class was generated from the following files:
  • Sources/FreeCAD/src/Mod/Part/App/TopoShape.h
  • Sources/FreeCAD/src/Mod/Part/App/TopoShape.cpp