.TH "SoSTLFileKit" 3 "Thu May 29 2014" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoSTLFileKit \- .PP \fBSoSTLFileKit\fP is a class for using STL files with Coin\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBSoForeignFileKit\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "enum \fBColorization\fP { \fBGREY\fP, \fBMATERIALISE\fP, \fBTNO_VISICAM\fP }" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "virtual \fBSoType\fP \fBgetTypeId\fP (void) const " .br .RI "\fIReturns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. \fP" .ti -1c .RI "virtual const \fBSoNodekitCatalog\fP * \fBgetNodekitCatalog\fP (void) const " .br .ti -1c .RI "\fBSoSTLFileKit\fP (void)" .br .ti -1c .RI "virtual SbBool \fBcanReadFile\fP (const char *filename=NULL) const " .br .ti -1c .RI "virtual SbBool \fBreadFile\fP (const char *filename)" .br .ti -1c .RI "virtual SbBool \fBcanWriteFile\fP (const char *filename=NULL) const " .br .ti -1c .RI "virtual SbBool \fBwriteFile\fP (const char *filename)" .br .ti -1c .RI "SbBool \fBcanReadScene\fP (void) const " .br .ti -1c .RI "SbBool \fBreadScene\fP (\fBSoNode\fP *scene)" .br .ti -1c .RI "virtual \fBSoSeparator\fP * \fBconvert\fP ()" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static \fBSoType\fP \fBgetClassTypeId\fP (void)" .br .ti -1c .RI "static const \fBSoNodekitCatalog\fP * \fBgetClassNodekitCatalog\fP (void)" .br .ti -1c .RI "static void \fBinitClass\fP (void)" .br .ti -1c .RI "static SbBool \fBidentify\fP (const char *filename)" .br .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "\fBSoSFString\fP \fBinfo\fP" .br .ti -1c .RI "\fBSoSFBool\fP \fBbinary\fP" .br .ti -1c .RI "\fBSoSFEnum\fP \fBcolorization\fP" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual const \fBSoFieldData\fP * \fBgetFieldData\fP (void) const " .br .ti -1c .RI "virtual \fB~SoSTLFileKit\fP (void)" .br .ti -1c .RI "void \fBreset\fP (void)" .br .ti -1c .RI "SbBool \fBaddFacet\fP (const \fBSbVec3f\fP &v1, const \fBSbVec3f\fP &v2, const \fBSbVec3f\fP &v3, const \fBSbVec3f\fP &normal)" .br .ti -1c .RI "void \fBorganizeModel\fP (void)" .br .in -1c .SS "Static Protected Member Functions" .in +1c .ti -1c .RI "static const \fBSoFieldData\fP ** \fBgetFieldDataPtr\fP (void)" .br .ti -1c .RI "static const \fBSoNodekitCatalog\fP ** \fBgetClassNodekitCatalogPtr\fP (void)" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "\fBSoSFNode\fP \fBshapehints\fP" .br .ti -1c .RI "\fBSoSFNode\fP \fBtexture\fP" .br .ti -1c .RI "\fBSoSFNode\fP \fBnormalbinding\fP" .br .ti -1c .RI "\fBSoSFNode\fP \fBnormals\fP" .br .ti -1c .RI "\fBSoSFNode\fP \fBmaterialbinding\fP" .br .ti -1c .RI "\fBSoSFNode\fP \fBmaterial\fP" .br .ti -1c .RI "\fBSoSFNode\fP \fBcoordinates\fP" .br .ti -1c .RI "\fBSoSFNode\fP \fBfacets\fP" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP \fBSoSTLFileKit\fP is a class for using STL files with Coin\&. Class for using STL files with Coin\&. You can use it to read and write STL files, and convert back and forth between Open Inventor scene graphs and SoSTLFileKits\&. .PP STL files are 3D models intended for 3D printers, and is a format supported by a wide variety of computer-aided design programs\&. STL models are, because of their intended purpose, always representations of solid objects\&. STL is short for Stereolithography, the process used for 3D printing\&. .PP Ordinary STL models do not contain color information\&. There are, however, two extensions to the binary file format for specifying color\&. Currently neither extension is supported\&. This is caused by lack of sample models using the extensions and will be added as soon as such models are found\&. We have the specs on the extensions, and it should be pretty straight-forwards to implement, but we want to get it right at once since we have write support (we don't want to inadvertently create a third color extension ;)\&. .PP When writing STL files, certain STL model criterias are not enforced by \fBSoSTLFileKit\fP\&. These are: .PP .IP "\(bu" 2 STL models should represent complete solids - it is the user's responsibility to give models of solid data to \fBreadScene()\fP, and not \fBreadScene()\fP's responsibility to check the incoming data\&. .IP "\(bu" 2 STL models should have all triangles in counterclockwise order\&. This is not enforced either\&. .IP "\(bu" 2 STL models should reside in the positive octant of the coordinate space\&. This is also the user's responsibility to ensure, although adding functionality for translating the model should be easy, so it might get implemented\&. .PP .PP Since the color extensions are not supported yet, color information is not collected either when converting Open Inventor scene graphs to SoSTLFileKits\&. .PP Be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2\&.1 API\&. .PP \fBSince:\fP .RS 4 Coin 3\&.0 .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "SoSTLFileKit::SoSTLFileKit (void)" Constructor\&. .SS "SoSTLFileKit::~SoSTLFileKit (void)\fC [protected]\fP, \fC [virtual]\fP" Destructor\&. .SH "Member Function Documentation" .PP .SS "\fBSoType\fP SoSTLFileKit::getTypeId (void) const\fC [virtual]\fP" .PP Returns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. Usage example: .PP .PP .nf void foo(SoNode * node) { if (node->getTypeId() == SoFile::getClassTypeId()) { SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type } } .fi .PP .PP For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in \fIall\fP subclasses\&. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance \fBInventor/nodes/SoSubNode\&.h\fP (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine\&.h (for engine classes) and so on\&. .PP For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups\&. .PP Reimplemented from \fBSoForeignFileKit\fP\&. .SS "const \fBSoFieldData\fP * SoSTLFileKit::getFieldData (void) const\fC [protected]\fP, \fC [virtual]\fP" Returns a pointer to the class-wide field data storage object for this instance\&. If no fields are present, returns \fCNULL\fP\&. .PP Reimplemented from \fBSoForeignFileKit\fP\&. .SS "const \fBSoNodekitCatalog\fP * SoSTLFileKit::getNodekitCatalog (void) const\fC [virtual]\fP" Returns the nodekit catalog which defines the layout of this class' kit\&. .PP Reimplemented from \fBSoForeignFileKit\fP\&. .SS "void SoSTLFileKit::initClass (void)\fC [static]\fP" Initializes class and registers file identification functions\&. .SS "SbBool SoSTLFileKit::identify (const char *filename)\fC [static]\fP" Returns wether or not \fIfilename\fP is identified as an STL file\&. .SS "SbBool SoSTLFileKit::canReadFile (const char *filename = \fCNULL\fP) const\fC [virtual]\fP" Checks if this concrete class can read the given file\&. .PP Reimplemented from \fBSoForeignFileKit\fP\&. .SS "SbBool SoSTLFileKit::readFile (const char *filename)\fC [virtual]\fP" Reads in an STL file\&. Both ascii and binary files are supported\&. For binary files, the color extensions are not implemented yet\&. .PP Returns FALSE if \fIfilename\fP could not be opened or parsed correctly\&. .PP \fBSee also:\fP .RS 4 \fBcanReadFile\fP .RE .PP .PP Reimplemented from \fBSoForeignFileKit\fP\&. .SS "SbBool SoSTLFileKit::canWriteFile (const char *filename = \fCNULL\fP) const\fC [virtual]\fP" Checks if this concrete class can write to the given file\&. .PP Reimplemented from \fBSoForeignFileKit\fP\&. .SS "SbBool SoSTLFileKit::writeFile (const char *filename)\fC [virtual]\fP" Writes the STL model to an STL file\&. .PP \fBSee also:\fP .RS 4 binary, info, \fBcanWriteFile\fP, canReadScene .RE .PP .PP Reimplemented from \fBSoForeignFileKit\fP\&. .SS "SbBool SoSTLFileKit::readScene (\fBSoNode\fP *scene)" Converts a scene graph into an \fBSoSTLFileKit\fP\&. Useful for creating STL files\&. .PP \fBSee also:\fP .RS 4 canReadScene, \fBcanWriteFile\fP, \fBwriteFile\fP .RE .PP .SS "\fBSoSeparator\fP * SoSTLFileKit::convert ()\fC [virtual]\fP" Converts (if necessary) the internal representation of the foreign file to a pure Coin scenegraph\&. Returns the root node with a refcount of 0\&. .PP Implements \fBSoForeignFileKit\fP\&. .SS "void SoSTLFileKit::reset (void)\fC [protected]\fP" Resets the STL model so it contains nothing\&. .SS "SbBool SoSTLFileKit::addFacet (const \fBSbVec3f\fP &v1, const \fBSbVec3f\fP &v2, const \fBSbVec3f\fP &v3, const \fBSbVec3f\fP &n)\fC [protected]\fP" Adds one triangle to the STL model\&. .PP \fBSee also:\fP .RS 4 \fBreset\fP, \fBorganizeModel\fP .RE .PP .SS "void SoSTLFileKit::organizeModel (void)\fC [protected]\fP" Should be called after the STL model is completely set up in the \fBSoSTLFileKit\fP through import from a file or from a scene graph\&. The model will then be optimized for fast rendering\&. .PP \fBSee also:\fP .RS 4 \fBaddFacet\fP, \fBreset\fP .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.