FreeCAD C++
Public Member Functions | List of all members
Part::TopoShape Class Reference

#include <Mod/Part/App/TopoShape.h>

Detailed Description

The representation for a CAD Shape

Public Member Functions

TopoDS_Shape getSubShape (const char *Type) const
 get the Topo"sub"Shape with the given name
 
PyObject * getPySubShape (const char *Type) const
 get the Topo"sub"Shape with the given name
 
Subelement management
virtual std::vector< const char * > getElementTypes (void) const
 
virtual unsigned long countSubElements (const char *Type) const
 
virtual Data::SegmentgetSubElement (const char *Type, unsigned long) const
 get the subelement by type and number
 
virtual void getLinesFromSubelement (const Data::Segment *, std::vector< Base::Vector3d > &Points, std::vector< Line > &lines) const
 
virtual void getFacesFromSubelement (const Data::Segment *, std::vector< Base::Vector3d > &Points, std::vector< Base::Vector3d > &PointNormals, std::vector< Facet > &faces) const
 
Save/restore
void Save (Base::Writer &writer) const
 
void Restore (Base::XMLReader &reader)
 
void SaveDocFile (Base::Writer &writer) const
 
void RestoreDocFile (Base::Reader &reader)
 
unsigned int getMemSize (void) const
 
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
 
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
 
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).
 
Manipulation
void transformGeometry (const Base::Matrix4D &rclMat)
 
TopoDS_Shape transformGShape (const Base::Matrix4D &) const
 
void transformShape (const Base::Matrix4D &, bool copy)
 
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
 
Getting basic geometric entities
virtual void getPoints (std::vector< Base::Vector3d > &Points, std::vector< Base::Vector3d > &Normals, float Accuracy, uint16_t flags=0) const
 
virtual void getFaces (std::vector< Base::Vector3d > &Points, std::vector< Facet > &faces, float Accuracy, uint16_t flags=0) const
 
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.
 
virtual ~ComplexGeoData ()
 Destructor.
 
virtual SegmentgetSubElementByName (const char *Name) const
 get subelement by combined name
 
void applyTransform (const Base::Matrix4D &rclTrf)
 
void applyTranslation (const Base::Vector3d &)
 
void applyRotation (const Base::Rotation &)
 
void setPlacement (const Base::Placement &rclPlacement)
 
Base::Placement getPlacement () const
 
virtual Base::Vector3d getPointFromLineIntersection (const Base::Vector3f &base, const Base::Vector3f &dir) const
 
virtual void getLines (std::vector< Base::Vector3d > &Points, std::vector< Line > &lines, float Accuracy, uint16_t flags=0) const
 
- Public Member Functions inherited from Base::BaseClass
 BaseClass ()
 Construction.
 
virtual ~BaseClass ()
 Destruction.
 

Placement control

void setTransform (const Base::Matrix4D &rclTrf)
 set the transformation of the CasCade Shape
 
void setPlacement (const Base::Placement &rclTrf)
 set the transformation of the CasCade Shape
 
Base::Matrix4D getTransform (void) const
 get the transformation of the CasCade Shape
 
Base::Placement getPlacemet (void) const
 get the transformation of the CasCade Shape
 
Base::BoundBox3d getBoundBox (void) const
 Bound box from the CasCade shape.
 
virtual bool getCenterOfGravity (Base::Vector3d &center) const
 
static void convertTogpTrsf (const Base::Matrix4D &mtrx, gp_Trsf &trsf)
 
static void convertToMatrix (const gp_Trsf &trsf, Base::Matrix4D &mtrx)
 

Additional Inherited Members

- Static Public Member Functions inherited from Base::Persistence
static std::string encodeAttribute (const std::string &)
 Encodes an attribute upon saving.
 
- Protected Member Functions inherited from Data::ComplexGeoData
Base::Vector3d transformToOutside (const Base::Vector3f &vec) const
 from local to outside
 
Base::Vector3f transformToInside (const Base::Vector3d &vec) const
 from local to inside
 

Member Function Documentation

◆ generalFuse()

TopoDS_Shape Part::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.

◆ getElementTypes()

virtual std::vector<const char*> Part::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.

◆ getFacesFromSubelement()

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

Get faces from segment

Reimplemented from Data::ComplexGeoData.

◆ getLinesFromSubelement()

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

Get lines from segment

Reimplemented from Data::ComplexGeoData.

◆ getPoints()

virtual void Part::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.

◆ makePipe()

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

Sweeping