Description
Class that contains an OCAF document (a tree hierarchy of shapes in the OpenCascade framework).
Most often this is populated by loading a STEP file from disk.
#include <ChCascadeDoc.h>
Classes | |
class | ScanShapesCallback |
Class to be used as a callback interface for post-processing Cascade shapes. More... | |
Public Member Functions | |
bool | Load_STEP (const char *filename) |
Populate the document with all shapes that are contained in the STEP file, saved from some CAD. More... | |
void | Dump (std::ostream &mstream) |
Show shape hierarchy, writing on mstream to print in default console log) | |
bool | GetRootShape (TopoDS_Shape &mshape, const int num=1) |
Get the root shape. More... | |
bool | GetNamedShape (TopoDS_Shape &mshape, const char *name, bool set_location_to_root=true, bool get_multiple=false) |
Get a sub-shape with a given name, returned in 'mshape'. More... | |
void | ScanCascadeShapes (ScanShapesCallback &callback) |
Scan all Cascade shapes and execute the provided callback for each one. | |
Static Public Member Functions | |
static bool | GetVolumeProperties (const TopoDS_Shape &mshape, const double density, ChVector3d ¢er_position, ChVector3d &inertiaXX, ChVector3d &inertiaXY, double &volume, double &mass) |
Get the volume properties (center of mass, inertia moments, volume) of a given shape. More... | |
static void | FromCascadeToChrono (const TopLoc_Location &from_coord, ChFrame<> &to_coord) |
Convert OpenCascade coordinates into Chrono coordinates. | |
static void | FromChronoToCascade (const ChFrame<> &from_coord, TopLoc_Location &to_coord) |
Convert Chrono coordinates into OpenCascade coordinates. | |
Member Function Documentation
◆ GetNamedShape()
bool ChCascadeDoc::GetNamedShape | ( | TopoDS_Shape & | mshape, |
const char * | name, | ||
bool | set_location_to_root = true , |
||
bool | get_multiple = false |
||
) |
Get a sub-shape with a given name, returned in 'mshape'.
Since the document can contain assembles, subassemblies etc, the name can use a 'directory type' syntax, using the / slash such as in "assembly/subassebmly/subsubassembly/mypart" It is possible to use # and ? wildcards as in Unix. If there are multiple parts (or assemblies) with the same name, only the first instance is returned in 'mshape'; otherwise, one can use the # wildcard to get the n-th object, for example "MyAssembly/bolt#3", "Car/Wheel#2/hub", etc. If the 'set_location_to_root' parameter is true (default), the location of the shape is changed so that it represents its position respect to the root, that is the shape .Location() function will give the absolute position, otherwise if false it will give its position relative to the assembly where it is a sub-shape. If the 'get_multiple' = true, if there are multiple parts satisfying the search string, they are all returned in a single shape of compound type (with null location).
◆ GetRootShape()
bool ChCascadeDoc::GetRootShape | ( | TopoDS_Shape & | mshape, |
const int | num = 1 |
||
) |
Get the root shape.
Note that there could be more than one root, if so, use 'num' to select the one that you need.
◆ GetVolumeProperties()
|
static |
Get the volume properties (center of mass, inertia moments, volume) of a given shape.
- Parameters
-
mshape pass the shape here density pass the density here center_position get the COG position center, respect to shape pos. inertiaXX get the inertia diagonal terms inertiaXY get the inertia extradiagonal terms volume get the volume mass get the mass
◆ Load_STEP()
bool ChCascadeDoc::Load_STEP | ( | const char * | filename | ) |
Populate the document with all shapes that are contained in the STEP file, saved from some CAD.
If load was ok, return true.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono_cascade/ChCascadeDoc.h
- /builds/uwsbel/chrono/src/chrono_cascade/ChCascadeDoc.cpp