CModel
-
class Lib3MF::CModel : public CBase
-
PPackagePart RootModelPart()
Returns the PackagePart within the OPC package that holds the root model.
- Returns:
the PackagePart within the OPC package that holds the model-file
-
PPackagePart FindOrCreatePackagePart(const std::string &sAbsolutePath)
Returns a new PackagePart for use within the OPC package.
- Parameters:
sAbsolutePath – the absolute Path (physical location) within the OPC package
- Returns:
the new PackagePart within the OPC package
-
void SetUnit(const eModelUnit eUnit)
sets the units of a model.
- Parameters:
eUnit – Unit enum value for the model unit
-
eModelUnit GetUnit()
returns the units of a model.
- Returns:
Unit enum value for the model unit
-
std::string GetLanguage()
retrieves the language of a model
- Returns:
language identifier
-
void SetLanguage(const std::string &sLanguage)
sets the language of a model
- Parameters:
sLanguage – language identifier
-
PWriter QueryWriter(const std::string &sWriterClass)
creates a model writer instance for a specific file type
- Parameters:
sWriterClass – string identifier for the file type
- Returns:
string identifier for the file type
-
PReader QueryReader(const std::string &sReaderClass)
creates a model reader instance for a specific file type
- Parameters:
sReaderClass – string identifier for the file type
- Returns:
string identifier for the file type
-
PTexture2D GetTexture2DByID(const Lib3MF_uint32 nUniqueResourceID)
finds a model texture by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the texture2d instance
-
ePropertyType GetPropertyTypeByID(const Lib3MF_uint32 nUniqueResourceID)
returns a Property’s type
- Parameters:
nUniqueResourceID – Resource ID of the Property to Query
- Returns:
returns a Property’s type
-
PBaseMaterialGroup GetBaseMaterialGroupByID(const Lib3MF_uint32 nUniqueResourceID)
finds a model base material group by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the BaseMaterialGroup instance
-
PTexture2DGroup GetTexture2DGroupByID(const Lib3MF_uint32 nUniqueResourceID)
finds a model texture2d group by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the Texture2DGroup instance
-
PCompositeMaterials GetCompositeMaterialsByID(const Lib3MF_uint32 nUniqueResourceID)
finds a model CompositeMaterials by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the CompositeMaterials instance
-
PMultiPropertyGroup GetMultiPropertyGroupByID(const Lib3MF_uint32 nUniqueResourceID)
finds a model MultiPropertyGroup by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the MultiPropertyGroup instance
-
PMeshObject GetMeshObjectByID(const Lib3MF_uint32 nUniqueResourceID)
finds a mesh object by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the mesh object instance
-
PComponentsObject GetComponentsObjectByID(const Lib3MF_uint32 nUniqueResourceID)
finds a components object by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the components object instance
-
PColorGroup GetColorGroupByID(const Lib3MF_uint32 nUniqueResourceID)
finds a model color group by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the ColorGroup instance
-
PSliceStack GetSliceStackByID(const Lib3MF_uint32 nUniqueResourceID)
finds a model slicestack by its UniqueResourceID
- Parameters:
nUniqueResourceID – UniqueResourceID
- Returns:
returns the slicestack instance
-
std::string GetBuildUUID(bool &bHasUUID)
returns, whether a build has a UUID and, if true, the build’s UUID
- Parameters:
bHasUUID – flag whether the build has a UUID
- Returns:
the UUID as string of the form ‘xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx’
-
void SetBuildUUID(const std::string &sUUID)
sets the build’s UUID
- Parameters:
sUUID – the UUID as string of the form ‘xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx’
-
PBuildItemIterator GetBuildItems()
creates a build item iterator instance with all build items.
- Returns:
returns the iterator instance.
-
PResourceIterator GetResources()
creates a resource iterator instance with all resources.
- Returns:
returns the iterator instance.
-
PObjectIterator GetObjects()
creates a resource iterator instance with all object resources.
- Returns:
returns the iterator instance.
-
PMeshObjectIterator GetMeshObjects()
creates a resource iterator instance with all mesh object resources.
- Returns:
returns the iterator instance.
-
PComponentsObjectIterator GetComponentsObjects()
creates a resource iterator instance with all components object resources.
- Returns:
returns the iterator instance.
-
PTexture2DIterator GetTexture2Ds()
creates a Texture2DIterator instance with all texture2d resources.
- Returns:
returns the iterator instance.
-
PBaseMaterialGroupIterator GetBaseMaterialGroups()
creates a BaseMaterialGroupIterator instance with all base material resources.
- Returns:
returns the iterator instance.
-
PColorGroupIterator GetColorGroups()
creates a ColorGroupIterator instance with all ColorGroup resources.
- Returns:
returns the iterator instance.
-
PTexture2DGroupIterator GetTexture2DGroups()
creates a Texture2DGroupIterator instance with all base material resources.
- Returns:
returns the iterator instance.
-
PCompositeMaterialsIterator GetCompositeMaterials()
creates a CompositeMaterialsIterator instance with all CompositeMaterials resources.
- Returns:
returns the iterator instance.
-
PMultiPropertyGroupIterator GetMultiPropertyGroups()
creates a MultiPropertyGroupsIterator instance with all MultiPropertyGroup resources.
- Returns:
returns the iterator instance.
-
PSliceStackIterator GetSliceStacks()
creates a resource iterator instance with all slice stack resources.
- Returns:
returns the iterator instance.
-
PModel MergeToModel()
Merges all components and objects which are referenced by a build item into a mesh. The memory is duplicated and a new model is created.
- Returns:
returns the merged model instance
-
PMeshObject AddMeshObject()
adds an empty mesh object to the model.
- Returns:
returns the mesh object instance
-
PComponentsObject AddComponentsObject()
adds an empty component object to the model.
- Returns:
returns the components object instance
-
PSliceStack AddSliceStack(const Lib3MF_double dZBottom)
creates a new model slicestack by its id
- Parameters:
dZBottom – Bottom Z value of the slicestack
- Returns:
returns the new slicestack instance
-
PTexture2D AddTexture2DFromAttachment(CAttachment *pTextureAttachment)
adds a texture2d resource to the model. Its path is given by that of an existing attachment.
- Parameters:
pTextureAttachment – attachment containing the image data.
- Returns:
returns the new texture instance.
-
PBaseMaterialGroup AddBaseMaterialGroup()
adds an empty BaseMaterialGroup resource to the model.
- Returns:
returns the new base material instance.
-
PColorGroup AddColorGroup()
adds an empty ColorGroup resource to the model.
- Returns:
returns the new ColorGroup instance.
-
PTexture2DGroup AddTexture2DGroup(CTexture2D *pTexture2DInstance)
adds an empty Texture2DGroup resource to the model.
- Parameters:
pTexture2DInstance – The texture2D instance of the created Texture2DGroup.
- Returns:
returns the new Texture2DGroup instance.
-
PCompositeMaterials AddCompositeMaterials(CBaseMaterialGroup *pBaseMaterialGroupInstance)
adds an empty CompositeMaterials resource to the model.
- Parameters:
pBaseMaterialGroupInstance – The BaseMaterialGroup instance of the created CompositeMaterials.
- Returns:
returns the new CompositeMaterials instance.
-
PMultiPropertyGroup AddMultiPropertyGroup()
adds an empty MultiPropertyGroup resource to the model.
- Returns:
returns the new MultiPropertyGroup instance.
-
PBuildItem AddBuildItem(CObject *pObject, const sTransform &Transform)
adds a build item to the model.
- Parameters:
pObject – Object instance.
Transform – Transformation matrix.
- Returns:
returns the build item instance.
-
void RemoveBuildItem(CBuildItem *pBuildItemInstance)
removes a build item from the model
- Parameters:
pBuildItemInstance – Build item to remove.
-
PMetaDataGroup GetMetaDataGroup()
Returns the metadata of the model as MetaDataGroup
- Returns:
returns an Instance of the metadatagroup of the model
-
PAttachment AddAttachment(const std::string &sURI, const std::string &sRelationShipType)
adds an attachment stream to the model. The OPC part will be related to the model stream with a certain relationship type.
- Parameters:
sURI – Path of the attachment
sRelationShipType – Relationship type of the attachment
- Returns:
Instance of the attachment object
-
void RemoveAttachment(CAttachment *pAttachmentInstance)
Removes attachment from the model.
- Parameters:
pAttachmentInstance – Attachment instance to remove
-
PAttachment GetAttachment(const Lib3MF_uint32 nIndex)
retrieves an attachment stream object from the model..
- Parameters:
nIndex – Index of the attachment stream
- Returns:
Instance of the attachment object
-
PAttachment FindAttachment(const std::string &sURI)
retrieves an attachment stream object from the model.
- Parameters:
sURI – Path URI in the package
- Returns:
Instance of the attachment object
-
Lib3MF_uint32 GetAttachmentCount()
retrieves the number of attachments of the model.
- Returns:
Returns the number of attachments.
-
bool HasPackageThumbnailAttachment()
Retrieve whether the OPC package contains a package thumbnail.
- Returns:
returns whether the OPC package contains a package thumbnail
-
PAttachment CreatePackageThumbnailAttachment()
Create a new or the existing package thumbnail for the OPC package.
- Returns:
Instance of a new or the existing thumbnailattachment object.
-
PAttachment GetPackageThumbnailAttachment()
Get the attachment to the OPC package containing the package thumbnail.
- Returns:
Instance of the thumbnailattachment object or NULL.
-
void RemovePackageThumbnailAttachment()
Remove the attachment to the OPC package containing the package thumbnail.
-
void AddCustomContentType(const std::string &sExtension, const std::string &sContentType)
Adds a new Content Type to the model.
- Parameters:
sExtension – File Extension
sContentType – Content Type Identifier
-
void RemoveCustomContentType(const std::string &sExtension)
Removes a custom Content Type from the model (UTF8 version).
- Parameters:
sExtension – File Extension
-
void SetRandomNumberCallback(const RandomNumberCallback pTheCallback, const Lib3MF_pvoid pUserData)
Sets the random number generator callback for use in the library
- Parameters:
pTheCallback – The callback used to generate random numbers
pUserData – Userdata to be passed to the callback function
-
PPackagePart RootModelPart()