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 LoadSTEP (const std::string &filename)
 Populate the document with all shapes that are contained in the STEP file. More...
 
void Dump (std::ostream &stream) const
 Dump the shapes hierarchy on given stream.
 
bool GetRootShape (TopoDS_Shape &shape, const int num=1) const
 Get the root shape. More...
 
bool GetNamedShape (TopoDS_Shape &shape, const std::string &name, bool set_location_to_root=true, bool get_multiple=false) const
 Get a sub-shape with a given name, returned in 'shape'. More...
 
void ScanCascadeShapes (ScanShapesCallback &callback) const
 Scan all Cascade shapes and execute the provided callback for each one.
 

Static Public Member Functions

static bool GetVolumeProperties (const TopoDS_Shape &shape, const double density, ChVector3d &center_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 ConvertFrameCascadeToChrono (const TopLoc_Location &from_coord, ChFramed &to_coord)
 Convert OpenCascade coordinates into Chrono coordinates.
 
static void ConvertFrameChronoToCascade (const ChFramed &from_coord, TopLoc_Location &to_coord)
 Convert Chrono coordinates into OpenCascade coordinates.
 

Member Function Documentation

◆ GetNamedShape()

bool ChCascadeDoc::GetNamedShape ( TopoDS_Shape &  shape,
const std::string &  name,
bool  set_location_to_root = true,
bool  get_multiple = false 
) const

Get a sub-shape with a given name, returned in 'shape'.

Since the document can contain assemblies, subassemblies, etc., the input name can use a 'directory type' syntax using the '/' slash such as: "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 'shape'. Otherwise, one can use the '#' wildcard to get the n-th object, such as: "MyAssembly/bolt#3" or "Car/Wheel#2/hub". If the 'set_location_to_root' parameter is true (default), the location of the shape is changed so that it represents its position with 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 &  shape,
const int  num = 1 
) const

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()

bool ChCascadeDoc::GetVolumeProperties ( const TopoDS_Shape &  shape,
const double  density,
ChVector3d center_position,
ChVector3d inertiaXX,
ChVector3d inertiaXY,
double &  volume,
double &  mass 
)
static

Get the volume properties (center of mass, inertia moments, volume) of a given shape.

Parameters
shapepass the shape here
densitypass the density here
center_positionget the COG position center, with respect to shape pos
inertiaXXget the inertia diagonal terms
inertiaXYget the inertia extradiagonal terms
volumeget the volume
massget the mass

◆ LoadSTEP()

bool ChCascadeDoc::LoadSTEP ( const std::string &  filename)

Populate the document with all shapes that are contained in the STEP file.

Return true if load is successful.


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