Base::InventorBuilder Class Reference

This class does basically the same as Builder3D except that it writes the data directly into a given stream without buffering the output data in a string stream. More...

#include <Builder3D.h>

Public Member Functions

void addInfo (const char *str)
 Sets an info node. More...
 
void addLabel (const char *str)
 Sets a label node. More...
 
void beginSeparator ()
 Sets a separator node. More...
 
void close ()
 If needed closes the first opened separator node. This method must not be used more than one time for an instance. More...
 
void endSeparator ()
 Closes the last added separator node. More...
 
 InventorBuilder (std::ostream &str)
 Construction of an InventorBuilder instance. This automatically opens a separator node. More...
 
virtual ~InventorBuilder ()
 Destruction of an InventorBuilder instance. More...
 
Appearance handling
void addBaseColor (float color_r, float color_g, float color_b)
 Sets a base color node. The colors are in the range [0, 1]. More...
 
void addMaterial (float color_r, float color_g, float color_b, float color_a=0)
 Sets a material node. The colors are in the range [0, 1]. More...
 
void beginMaterial ()
 Starts a material node. The node must be closed with endMaterial and the colors must be added with addColor(). More...
 
void endMaterial ()
 Closes a material node. More...
 
void addColor (float color_r, float color_g, float color_b)
 Adds a color to a material node. The colors are in the range [0, 1]. More...
 
void addMaterialBinding (const char *binding="OVERALL")
 Sets a material binding node. More...
 
void addDrawStyle (short pointSize, short lineWidth, unsigned short linePattern=0xffff, const char *style="FILLED")
 Sets a draw style node. More...
 
void addShapeHints (float crease=0.0f)
 Sets a shape hints node. More...
 
void addPolygonOffset (float factor=1.0f, float units=1.0f, const char *styles="FILLED", bool on=true)
 Sets a polygon offset node. More...
 
Add coordinates
void addPoint (float x, float y, float z)
 add a single point More...
 
void addPoint (const Vector3f &vec)
 add a single point More...
 
void addPoints (const std::vector< Vector3f > &vec)
 add a list of points More...
 
Point set handling
void beginPoints ()
 starts a point set More...
 
void endPoints ()
 ends the points set operation More...
 
void addPointSet ()
 add an SoPointSet node More...
 
Normal handling
void beginNormal ()
 starts a point set More...
 
void endNormal ()
 ends the points set operation More...
 
void addNormalBinding (const char *)
 add normal binding node More...
 
Line/Direction handling
void addSingleLine (const Vector3f &pt1, const Vector3f &pt2, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff)
 add a line defined by 2 Vector3D More...
 
void addSingleArrow (const Vector3f &pt1, const Vector3f &pt2, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff)
 add a arrow (directed line) by 2 Vector3D. The arrow shows in direction of point 2. More...
 
void addLineSet (const std::vector< Vector3f > &points, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff)
 add a line defined by a list of points whereat always a pair (i.e. a point and the following point) builds a line. More...
 
void addLineSet ()
 add an SoLineSet node More...
 
Triangle handling
void addSingleTriangle (const Vector3f &pt0, const Vector3f &pt1, const Vector3f &pt2, bool filled=true, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a (filled) triangle defined by 3 vectors More...
 
void addSinglePlane (const Vector3f &base, const Vector3f &eX, const Vector3f &eY, float length, float width, bool filled=true, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 
void addIndexedFaceSet (const std::vector< int > &indices)
 
void addFaceSet (const std::vector< int > &vertices)
 
Surface handling
void addNurbsSurface (const std::vector< Base::Vector3f > &controlPoints, int numUControlPoints, int numVControlPoints, const std::vector< float > &uKnots, const std::vector< float > &vKnots)
 The number of control points must be numUControlPoints * numVControlPoints. More...
 
void addCylinder (float radius, float height)
 
void addSphere (float radius)
 
Bounding Box handling
void addBoundingBox (const Vector3f &pt1, const Vector3f &pt2, short lineWidth=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 
Transformation
void addTransformation (const Matrix4D &)
 adds a transformation More...
 
void addTransformation (const Vector3f &translation, const Vector3f &rotationaxis, float fAngle)
 

Text handling

void addText (float pos_x, float pos_y, float pos_z, const char *text, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a text More...
 
void addText (const Vector3f &vec, const char *text, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a text More...
 

Detailed Description

This class does basically the same as Builder3D except that it writes the data directly into a given stream without buffering the output data in a string stream.

Compared to file streams, string streams are quite slow when writing data with more than a few hundred lines. Due to performance reasons the user should use a file stream in this case.

Author
Werner Mayer

Constructor & Destructor Documentation

◆ InventorBuilder()

InventorBuilder::InventorBuilder ( std::ostream &  str)

Construction of an InventorBuilder instance. This automatically opens a separator node.

Parameters
str- stream to write the content into

References beginSeparator().

◆ ~InventorBuilder()

InventorBuilder::~InventorBuilder ( )
virtual

Destruction of an InventorBuilder instance.

References close().

Member Function Documentation

◆ addBaseColor()

void InventorBuilder::addBaseColor ( float  color_r,
float  color_g,
float  color_b 
)

Sets a base color node. The colors are in the range [0, 1].

Parameters
color_r- red color
color_g- green color
color_b- blue color

References Base::blanks().

◆ addBoundingBox()

void InventorBuilder::addBoundingBox ( const Vector3f pt1,
const Vector3f pt2,
short  lineWidth = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

◆ addColor()

void InventorBuilder::addColor ( float  color_r,
float  color_g,
float  color_b 
)

Adds a color to a material node. The colors are in the range [0, 1].

Parameters
color_r- red color
color_g- green color
color_b- blue color

Referenced by importIFClegacy.IfcWriter::addExtrudedCircle(), importIFClegacy.IfcWriter::addExtrudedCompositeCurve(), importIFClegacy.IfcWriter::addExtrudedEllipse(), and importIFClegacy.IfcWriter::addExtrudedPolyline().

◆ addCylinder()

void InventorBuilder::addCylinder ( float  radius,
float  height 
)

References Base::blanks().

◆ addDrawStyle()

void InventorBuilder::addDrawStyle ( short  pointSize,
short  lineWidth,
unsigned short  linePattern = 0xffff,
const char *  style = "FILLED" 
)

Sets a draw style node.

Parameters
pointSize- the point size
lineWidth- the line width
linePattern- the line pattern
style- the draw style

References Base::blanks().

◆ addFaceSet()

void InventorBuilder::addFaceSet ( const std::vector< int > &  vertices)

References Base::blanks().

◆ addIndexedFaceSet()

void InventorBuilder::addIndexedFaceSet ( const std::vector< int > &  indices)

◆ addInfo()

void InventorBuilder::addInfo ( const char *  str)

Sets an info node.

Parameters
str- text set to the info node

References Base::blanks().

Referenced by MeshCore::MeshOutput::SaveInventor().

◆ addLabel()

void InventorBuilder::addLabel ( const char *  str)

Sets a label node.

Parameters
str- text set to the label node

References Base::blanks().

Referenced by MeshCore::MeshOutput::SaveInventor().

◆ addLineSet() [1/2]

void InventorBuilder::addLineSet ( )

add an SoLineSet node

Adds a SoLineSet node after creating a SoCordinate3 node with beginPoints() and endPoints().

See also
startPoints()
beginPoints()
endPoints()

References Base::blanks().

◆ addLineSet() [2/2]

void InventorBuilder::addLineSet ( const std::vector< Vector3f > &  points,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0,
unsigned short  linePattern = 0xffff 
)

add a line defined by a list of points whereat always a pair (i.e. a point and the following point) builds a line.

Add a line defined by a list of points whereat always a pair (i.e.

a point and the following point) builds a line. The size of the list must then be even.

Referenced by Part::TopoShape::exportLineSet().

◆ addMaterial()

void InventorBuilder::addMaterial ( float  color_r,
float  color_g,
float  color_b,
float  color_a = 0 
)

Sets a material node. The colors are in the range [0, 1].

Parameters
color_r- red color
color_g- green color
color_b- blue color
color_a- transparency

References Base::blanks().

Referenced by Part::TopoShape::exportFaceSet().

◆ addMaterialBinding()

void InventorBuilder::addMaterialBinding ( const char *  binding = "OVERALL")

Sets a material binding node.

Parameters
binding- binding of the material. Allowed values are: OVERALL, PER_PART, PER_PART_INDEXED, PER_FACE, PER_FACE_INDEXED, PER_VERTEX, PER_VERTEX_INDEXED and DEFAULT.

References draftgeoutils.faces::bind(), and Base::blanks().

◆ addNormalBinding()

void InventorBuilder::addNormalBinding ( const char *  binding)

add normal binding node

References Base::blanks().

Referenced by MeshCore::MeshOutput::SaveInventor().

◆ addNurbsSurface()

void InventorBuilder::addNurbsSurface ( const std::vector< Base::Vector3f > &  controlPoints,
int  numUControlPoints,
int  numVControlPoints,
const std::vector< float > &  uKnots,
const std::vector< float > &  vKnots 
)

The number of control points must be numUControlPoints * numVControlPoints.

The order in u or v direction of the NURBS surface is implicitly given by number of elements in uKnots - numUControlPoints or number of elements in vKnots - numVControlPoints.

◆ addPoint() [1/2]

void InventorBuilder::addPoint ( const Vector3f vec)

add a single point

add a vector to a point set

References addPoint(), and draftgeoutils.general::vec().

Referenced by draftguitools.gui_stretch.Stretch::action(), and draftguitools.gui_stretch.Stretch::numericInput().

◆ addPoint() [2/2]

void InventorBuilder::addPoint ( float  x,
float  y,
float  z 
)

◆ addPoints()

void InventorBuilder::addPoints ( const std::vector< Vector3f > &  vec)

add a list of points

References addPoint(), and draftgeoutils.general::vec().

Referenced by Part::TopoShape::exportFaceSet().

◆ addPointSet()

void InventorBuilder::addPointSet ( )

add an SoPointSet node

Adds an SoPointSet node after creating an SoCordinate3 node with beginPoints() and endPoints().

See also
startPoints()
beginPoints()
endPoints()

References Base::blanks().

◆ addPolygonOffset()

void InventorBuilder::addPolygonOffset ( float  factor = 1.0f,
float  units = 1.0f,
const char *  styles = "FILLED",
bool  on = true 
)

Sets a polygon offset node.

Parameters
factor- Offset multiplication factor.
units- Offset translation multiplication factor.
styles- Can be FILLED, LINES or POINTS.
on- Whether the offset is on or off.

References Base::blanks().

◆ addShapeHints()

void InventorBuilder::addShapeHints ( float  crease = 0.0f)

Sets a shape hints node.

Parameters
crease- the crease angle in radians

References Base::blanks().

Referenced by Part::TopoShape::exportFaceSet().

◆ addSingleArrow()

void InventorBuilder::addSingleArrow ( const Vector3f pt1,
const Vector3f pt2,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0,
unsigned short  linePattern = 0xffff 
)

◆ addSingleLine()

void InventorBuilder::addSingleLine ( const Vector3f pt1,
const Vector3f pt2,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0,
unsigned short  linePattern = 0xffff 
)

◆ addSinglePlane()

void InventorBuilder::addSinglePlane ( const Vector3f base,
const Vector3f eX,
const Vector3f eY,
float  length,
float  width,
bool  filled = true,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

◆ addSingleTriangle()

void InventorBuilder::addSingleTriangle ( const Vector3f pt0,
const Vector3f pt1,
const Vector3f pt2,
bool  filled = true,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a (filled) triangle defined by 3 vectors

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

◆ addSphere()

void InventorBuilder::addSphere ( float  radius)

References Base::blanks().

◆ addText() [1/2]

void InventorBuilder::addText ( const Vector3f vec,
const char *  text,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a text

References addText(), and draftgeoutils.general::vec().

◆ addText() [2/2]

void InventorBuilder::addText ( float  pos_x,
float  pos_y,
float  pos_z,
const char *  text,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a text

Add a Text with a given position to the 3D set.

The origin is the lower leftmost corner.

Parameters
pos_x,pos_y,pos_zorigin of the text
textthe text to display.
color_rred part of the text color (0.0 - 1.0).
color_ggreen part of the text color (0.0 - 1.0).
color_bblue part of the text color (0.0 - 1.0).

References Base::blanks().

Referenced by addText().

◆ addTransformation() [1/2]

void InventorBuilder::addTransformation ( const Matrix4D transform)

◆ addTransformation() [2/2]

void InventorBuilder::addTransformation ( const Vector3f translation,
const Vector3f rotationaxis,
float  fAngle 
)

◆ beginMaterial()

void InventorBuilder::beginMaterial ( )

Starts a material node. The node must be closed with endMaterial and the colors must be added with addColor().

References Base::blanks().

◆ beginNormal()

void InventorBuilder::beginNormal ( )

starts a point set

References Base::blanks().

Referenced by MeshCore::MeshOutput::SaveInventor().

◆ beginPoints()

void InventorBuilder::beginPoints ( )

starts a point set

Starts the definition of point set.

If possible don't make too many beginPoints() and endPoints() calls. Try to put all points in one set.

See also
startPoints()
endPoints()

References Base::blanks().

Referenced by Part::TopoShape::exportFaceSet(), and MeshCore::MeshOutput::SaveInventor().

◆ beginSeparator()

void InventorBuilder::beginSeparator ( )

◆ close()

void InventorBuilder::close ( )

If needed closes the first opened separator node. This method must not be used more than one time for an instance.

References endSeparator().

Referenced by femexamples.examplesgui.FemExamples::reject(), and ~InventorBuilder().

◆ endMaterial()

void InventorBuilder::endMaterial ( )

Closes a material node.

References Base::blanks().

◆ endNormal()

void InventorBuilder::endNormal ( )

ends the points set operation

References Base::blanks().

Referenced by MeshCore::MeshOutput::SaveInventor().

◆ endPoints()

void InventorBuilder::endPoints ( )

ends the points set operation

Ends the point set operations and write the resulting inventor string.

See also
startPoints()

References Base::blanks().

Referenced by Part::TopoShape::exportFaceSet(), and MeshCore::MeshOutput::SaveInventor().

◆ endSeparator()

void InventorBuilder::endSeparator ( )

Closes the last added separator node.

References Base::blanks().

Referenced by close(), Part::TopoShape::exportFaceSet(), and MeshCore::MeshOutput::SaveInventor().


The documentation for this class was generated from the following files: