Pedegodgical example of all the things in an OpenNURBS 3dm archive. The openNURBS examples use ONX_Model to store the information read from 3dm archives. Please study example_read.cpp for details. More...
#include <opennurbs_extensions.h>
Public Member Functions | |
ONX_Model () | |
virtual | ~ONX_Model () |
unsigned int | ActiveAndDeletedComponentCount (ON_ModelComponent::Type component_type) const |
unsigned int | ActiveComponentCount (ON_ModelComponent::Type component_type) const |
int | AddDefaultDimensionStyle (const wchar_t *dimension_style_name, ON::LengthUnitSystem length_unit_system, double model_tolerance) |
Easy way to add a default dimension style to the model. More... | |
int | AddDefaultLayer (const wchar_t *layer_name, ON_Color layer_color) |
Easy way to add a default layer to the model. Properties: layer_name - [in] can be nullptr or empty. layer_color - [in] can be ON_Color::UnsetColor More... | |
int | AddLayer (const wchar_t *layer_name, ON_Color layer_color) |
Easy way to add a layer to the model. More... | |
ON_ModelComponentReference | AddManagedModelComponent (class ON_ModelComponent *managed_model_component, bool bResolveIdAndNameConflicts) |
Add a managed model component (ON_Layer, ON_DimStyle, ...) to this model. More... | |
ON_ModelComponentReference | AddManagedModelComponent (class ON_ModelComponent *managed_model_component) |
ON_ModelComponentReference | AddManagedModelGeometryComponent (class ON_Object *managed_geometry_object, class ON_3dmObjectAttributes *managed_attributes, bool bResolveIdAndNameConflicts) |
Add an copy of the model_geometry and attrbutes to this model. More... | |
ON_ModelComponentReference | AddManagedModelGeometryComponent (class ON_Object *managed_geometry_object, class ON_3dmObjectAttributes *managed_attributes) |
ON_ModelComponentReference | AddModelComponent (const class ON_ModelComponent &model_component, bool bResolveIdAndNameConflicts) |
Add an copy of a model_compoent to this model. model_component - [in] A copy of model_component is added to this model. The index, id, and name of the copied component are set the the model values (Manifest() "Manifest" index, name, and id). More... | |
ON_ModelComponentReference | AddModelComponent (const class ON_ModelComponent &model_component) |
ON_ModelComponentReference | AddModelComponentForExperts (class ON_ModelComponent *model_component, bool bManagedComponent, bool bResolveIdAndNameConflicts, bool bUpdateComponentIdentification) |
Add a model component to this model and control how the model_component instance is managed. More... | |
ON_ModelComponentReference | AddModelGeometryComponent (const class ON_Object *geometry_object, const class ON_3dmObjectAttributes *attributes, bool bResolveIdAndNameConflicts) |
Add an copy of the model_geometry and attrbutes to this model. More... | |
ON_ModelComponentReference | AddModelGeometryComponent (const class ON_Object *geometry_object, const class ON_3dmObjectAttributes *attributes) |
ON_ModelComponentReference | AddModelGeometryComponentForExperts (bool bManageGeometry, class ON_Object *geometry_object, bool bManageAttributes, class ON_3dmObjectAttributes *attributes, bool bResolveIdAndNameConflicts) |
Add geometry and attibutes to this model and control how the instances are managed. More... | |
ON_ModelComponentReference | ComponentFromId (ON_ModelComponent::Type component_type, ON_UUID component_model_id) const |
ON_ModelComponentReference | ComponentFromIndex (ON_ModelComponent::Type component_type, int component_model_index) const |
ON_ModelComponentReference | ComponentFromName (ON_ModelComponent::Type component_type, ON_UUID component_parent_id, const wchar_t *component_model_name) const |
ON_ModelComponentReference | ComponentFromNameHash (ON_ModelComponent::Type component_type, const ON_NameHash &component_model_name_hash) const |
ON_ModelComponentReference | ComponentFromUnsignedIndex (ON_ModelComponent::Type component_type, unsigned int component_model_index) const |
unsigned int | ComponentIndexLimit (ON_ModelComponent::Type component_type) const |
ON_SHA1_Hash | ContentHash () const |
ON_ModelComponentReference | CurrentDimensionStyle () const |
ON_UUID | CurrentDimensionStyleId () const |
ON_ModelComponentReference | DefaultDimensionStyle () const |
unsigned int | DeletedComponentCount (ON_ModelComponent::Type component_type) const |
ON_ModelComponentReference | DimensionStyleFromId (ON_UUID dimension_styleid) const |
ON_ModelComponentReference | DimensionStyleFromIndex (int dimension_style_index) const |
Get a dimension style from its model index. More... | |
ON_ModelComponentReference | DimensionStyleFromName (const wchar_t *dimension_style_name) const |
ON_ModelComponentReference | DimensionStyleFromNameHash (ON_NameHash dimension_style_name_hash) const |
ON_ModelComponentReference | DimensionStyleWithFontCharacteristics (const ON_Font &font_characteristics, double model_space_text_scale) |
Find or create a dimension style with the specified font characteristics. More... | |
void | Dump (ON_TextLog &) const |
text dump of entire model More... | |
void | DumpComponentList (ON_ModelComponent::Type component_type, ON_TextLog &text_log) const |
void | DumpComponentLists (ON_TextLog &text_log) const |
void | DumpSummary (ON_TextLog &) const |
text dump of model properties and settings More... | |
void | DumpUserDataTable (ON_TextLog &) const |
text dump of user data table More... | |
ON_ModelComponentReference | FirstDimensionStyleFromFont (const ON_Font *font, double model_space_text_scale, bool bIgnoreSystemDimStyles) const |
ON_ModelComponentReference | FirstDimensionStyleFromManagedFontSerialNumber (unsigned int managed_font_serial_number, double model_space_text_scale, bool bIgnoreSystemDimStyles) const |
bool | GetDocumentUserString (const wchar_t *key, ON_wString &string_value) const |
Get user string from the document. More... | |
int | GetDocumentUserStrings (ON_ClassArray< ON_UserString > &user_strings) const |
Get a list of all user strings in the document. More... | |
ON_ModelComponentReference | ImageFromFileContent (const ON_ContentHash &image_file_content_hash) const |
ON_ModelComponentReference | ImageFromFileFullPath (const wchar_t *image_file_full_path_name) const |
ON_ModelComponentReference | ImageFromFileReference (const ON_FileReference &file_reference) const |
ON_ModelComponentReference | ImageFromId (ON_UUID image_id) const |
ON_ModelComponentReference | ImageFromIndex (int image_model_index) const |
Get an image from its model index. More... | |
bool | IncrementalReadBegin (ON_BinaryArchive &archive, bool bManageComponents, unsigned int table_filter, ON_TextLog *error_log) |
Reads everything up to the object table. More... | |
bool | IncrementalReadFinish (ON_BinaryArchive &archive, bool bManageComponents, unsigned int table_filter, ON_TextLog *error_log) |
Reads everything up to the object table. More... | |
bool | IncrementalReadModelGeometry (ON_BinaryArchive &archive, bool bManageModelGeometryComponent, bool bManageGeometry, bool bManageAttributes, unsigned int model_object_type_filter, ON_ModelComponentReference &model_geometry_reference) |
Reads the next item in the model geometry table. More... | |
ON_ModelComponentReference | LayerFromAttributes (const ON_3dmObjectAttributes &attributes) const |
ON_ModelComponentReference | LayerFromId (ON_UUID layer_model_id) const |
ON_ModelComponentReference | LayerFromIndex (int layer_model_index) const |
Get a layer from its model index. More... | |
ON_ModelComponentReference | LayerFromName (ON_UUID layer_parent_id, const wchar_t *layer_name) const |
ON_ModelComponentReference | LayerFromNameHash (const ON_NameHash &layer_model_name_hash) const |
ON_ModelComponentReference | LinePatternFromAttributes (const ON_3dmObjectAttributes &attributes) const |
Get linetype from object attributes. More... | |
ON_ModelComponentReference | LinePatternFromId (ON_UUID line_pattern_model_id) const |
ON_ModelComponentReference | LinePatternFromIndex (int line_pattern_model_index) const |
Get a line pattern from its model index. More... | |
ON_ModelComponentReference | LinePatternFromLayerIndex (int layer_index) const |
ON_ModelComponentReference | LinePatternFromName (const wchar_t *line_pattern_name) const |
ON_ModelComponentReference | LinePatternFromNameHash (ON_NameHash line_pattern_model_name_hash) const |
const ON_ComponentManifest & | Manifest () const |
A manifest of every model component in this ONX_Model. More... | |
ON__UINT64 | ModelContentVersionNumber () const |
This number changes every time the content of the ONX_Model is modified. More... | |
ON_BoundingBox | ModelGeometryBoundingBox () const |
ON_ModelGeometryComponent | ModelGeometryFromId (unsigned int model_object_index) |
ON_ModelGeometryComponent | ModelGeometryFromIndex (int model_object_index) |
ON_ModelGeometryComponent | ModelGeometryFromUnsignedIndex (unsigned int model_object_index) |
const ON_ManifestMap & | ModelToOriginalMap () const |
const ON_ManifestMap & | OriginalToModelMap () const |
bool | Read (ON_BinaryArchive &archive, unsigned int table_filter, unsigned int model_object_type_filter, ON_TextLog *error_log) |
Reads an openNURBS archive and saves the information in this model More... | |
bool | Read (const char *filename, unsigned int table_filter, unsigned int model_object_type_filter, ON_TextLog *error_log) |
bool | Read (const wchar_t *filename, unsigned int table_filter, unsigned int model_object_type_filter, ON_TextLog *error_log) |
bool | Read (ON_BinaryArchive &archive, ON_TextLog *error_log=nullptr) |
bool | Read (const char *filename, ON_TextLog *error_log=nullptr) |
bool | Read (const wchar_t *filename, ON_TextLog *error_log=nullptr) |
ON_ModelComponentReference | RemoveModelComponent (ON_ModelComponent::Type component_type, ON_UUID component_id) |
ON_BoundingBox | RenderLightBoundingBox () const |
ON_ModelComponentReference | RenderMaterialFromAttributes (const ON_3dmObjectAttributes &attributes) const |
ON_ModelComponentReference | RenderMaterialFromId (ON_UUID render_material_id) const |
ON_ModelComponentReference | RenderMaterialFromIndex (int render_material_index) const |
ON_ModelComponentReference | RenderMaterialFromLayerIndex (int layer_index) const |
Get render material from object attributes. More... | |
void | Reset () |
bool | SetCurrentDimensionStyleId (ON_UUID dimension_style_id) |
bool | SetDocumentUserString (const wchar_t *key, const wchar_t *string_value) |
Attach a user string to the document. More... | |
int | UsesIDef (const ON_InstanceRef &iref, ON_UUID idef_uuid) const |
See if the instance reference iref refers to an instance definition. More... | |
bool | ValdateComponentIdAndName (ON_ModelComponent::Type component_type, const ON_UUID &candidate_id, const ON_UUID &component_parent_id, const wchar_t *candidate_name, bool bResolveIdConflict, bool bResolveNameConflict, ON_UUID &model_id, ON_wString &model_name) const |
ON_Color | WireframeColorFromAttributes (const ON_3dmObjectAttributes &attributes) const |
Get wireframe drawing color from object attributes. More... | |
bool | Write (const char *filename, int version=0, ON_TextLog *error_log=nullptr) const |
Writes contents of this model to an openNURBS archive. More... | |
bool | Write (const wchar_t *filename, int version=0, ON_TextLog *error_log=nullptr) const |
Writes contents of this model to an openNURBS archive. More... | |
bool | Write (ON_BinaryArchive &archive, int version=0, ON_TextLog *error_log=nullptr) const |
Writes contents of this model to an openNURBS archive. More... | |
Static Public Member Functions | |
static bool | GetRDKDocumentInformation (const ONX_Model_UserData &docud, ON_wString &rdk_xml_document_data) |
static bool | GetRDKObjectInformation (const ON_Object &object, ON_wString &rdk_xml_object_data) |
static bool | IsRDKDocumentInformation (const ONX_Model_UserData &docud) |
static bool | IsRDKObjectInformation (const ON_UserData &objectud) |
Public Attributes | |
ON__UINT64 | m_3dm_file_byte_count = 0 |
int | m_3dm_file_version = 0 |
3dm archive start section information More... | |
unsigned int | m_3dm_opennurbs_version = 0 |
ON_3dmProperties | m_properties |
ON_3dmSettings | m_settings |
ON_String | m_sStartSectionComments |
ON_SimpleArray< ONX_Model_UserData * > | m_userdata_table |
Friends | |
class | ONX_ModelComponentIterator |
Pedegodgical example of all the things in an OpenNURBS 3dm archive. The openNURBS examples use ONX_Model to store the information read from 3dm archives. Please study example_read.cpp for details.
ONX_Model::ONX_Model | ( | ) |
|
virtual |
unsigned int ONX_Model::ActiveAndDeletedComponentCount | ( | ON_ModelComponent::Type | component_type | ) | const |
unsigned int ONX_Model::ActiveComponentCount | ( | ON_ModelComponent::Type | component_type | ) | const |
int ONX_Model::AddDefaultDimensionStyle | ( | const wchar_t * | dimension_style_name, |
ON::LengthUnitSystem | length_unit_system, | ||
double | model_tolerance | ||
) |
Easy way to add a default dimension style to the model.
dimension_style_name | [in] can be nullptr or empty |
length_unit_system | [in] If ON::LengthUnitSystem::Unset, then settings length unit system is used. |
tolerance | [in] If not > 0, then settings tolerance is used. |
int ONX_Model::AddDefaultLayer | ( | const wchar_t * | layer_name, |
ON_Color | layer_color | ||
) |
Easy way to add a default layer to the model. Properties: layer_name - [in] can be nullptr or empty. layer_color - [in] can be ON_Color::UnsetColor
int ONX_Model::AddLayer | ( | const wchar_t * | layer_name, |
ON_Color | layer_color | ||
) |
Easy way to add a layer to the model.
ON_ModelComponentReference ONX_Model::AddManagedModelComponent | ( | class ON_ModelComponent * | managed_model_component, |
bool | bResolveIdAndNameConflicts | ||
) |
Add a managed model component (ON_Layer, ON_DimStyle, ...) to this model.
managed_model_component - [in] managed_model_component must be created by operator new and on the heap. It will be deleted when the model and last ON_ModelComponentReference are destroyed.
bResolveIdAndNameConflicts - [in] If bResolveIdAndNameConflicts is false, then model_component.Id() must be non-nil and not used in this model and model_component.Name() must be correctly set. If bResolveIdAndNameConflicts is true, then id and name will be modified as needed in managed_model_component, the model, and the manifest.
ON_ModelComponentReference ONX_Model::AddManagedModelComponent | ( | class ON_ModelComponent * | managed_model_component | ) |
ON_ModelComponentReference ONX_Model::AddManagedModelGeometryComponent | ( | class ON_Object * | managed_geometry_object, |
class ON_3dmObjectAttributes * | managed_attributes, | ||
bool | bResolveIdAndNameConflicts | ||
) |
Add an copy of the model_geometry and attrbutes to this model.
managed_geometry_object | [in] managed_geometry_object must point to an instance geometric object (curve, surface, brep, mesh, points, ...), a render light, an annotation object, or a detail object created by operator new and on the heap. It will be deleted when the this ONX_Model and the last ON_ModelComponentReference are destroyed. |
managed_attributes | [in] managed_attributes should be nullptr or point to an instance created by operator new and on the heap. It will be deleted when the this ONX_Model and the last ON_ModelComponentReference are destroyed. |
bResolveIdAndNameConflicts | [in] If bResolveIdAndNameConflicts is false, then managed_attributes must be nullptr or managed_attributes->m_uuid must be non-nil and not used in this model. If bResolveIdAndNameConflicts is true, then id will be modified as needed. |
ON_ModelComponentReference ONX_Model::AddManagedModelGeometryComponent | ( | class ON_Object * | managed_geometry_object, |
class ON_3dmObjectAttributes * | managed_attributes | ||
) |
ON_ModelComponentReference ONX_Model::AddModelComponent | ( | const class ON_ModelComponent & | model_component, |
bool | bResolveIdAndNameConflicts | ||
) |
Add an copy of a model_compoent to this model. model_component - [in] A copy of model_component is added to this model. The index, id, and name of the copied component are set the the model values (Manifest() "Manifest" index, name, and id).
bResolveIdAndNameConflicts - [in] If bResolveIdAndNameConflicts is false, then model_component.Id() must be non-nil and not used in this model and model_component.Name() must be correctly set. If bResolveIdAndNameConflicts is true, then id and name will be modified as needed in the model and manifest.
ON_ModelComponentReference ONX_Model::AddModelComponent | ( | const class ON_ModelComponent & | model_component | ) |
ON_ModelComponentReference ONX_Model::AddModelComponentForExperts | ( | class ON_ModelComponent * | model_component, |
bool | bManagedComponent, | ||
bool | bResolveIdAndNameConflicts, | ||
bool | bUpdateComponentIdentification | ||
) |
Add a model component to this model and control how the model_component instance is managed.
model_component - [in] An ON_ModelComponent created on the heap by calling new X where X is derived from ON_ModelComponent.
bManagedComponent - [in] If bManagedComponent is true, then ~ONX_Model will delete the component. If bManagedComponent is false, then you are responsible for insuring the component exists past the desctruction of this ONX_Model.
bResolveIdAndNameConflicts - [in] If bResolveIdAndNameConflicts is false, then model_component.Id() must be non-nil and not used in this model and model_component.Name() must be correctly set. If bResolveIdAndNameConflicts is true, then id and name will be modified as needed.
bUpdateComponentIdentification - [in] The model_component Index(), Id(), and Name() values are set to match the ones used in the model (Manifest() "Manifest" values.)
ON_ModelComponentReference ONX_Model::AddModelGeometryComponent | ( | const class ON_Object * | geometry_object, |
const class ON_3dmObjectAttributes * | attributes, | ||
bool | bResolveIdAndNameConflicts | ||
) |
Add an copy of the model_geometry and attrbutes to this model.
geometry_object | [in] geometry_object must point to a geometric object (curve, surface, brep, mesh, points, ...), a render light, an annotation object, or a detail object. A copy of geometry_object is added to and managed by this model. |
attributes | [in] nullptr if not available. A copy of attributes is added to and managed by this model. |
bResolveIdAndNameConflicts | [in] If bResolveIdAndNameConflicts is false, then attributes must be nullptr or attributes->m_uid must be non-nil and not used in this model. If bResolveIdAndNameConflicts is true, then id will be modified as needed. |
ON_ModelComponentReference ONX_Model::AddModelGeometryComponent | ( | const class ON_Object * | geometry_object, |
const class ON_3dmObjectAttributes * | attributes | ||
) |
ON_ModelComponentReference ONX_Model::AddModelGeometryComponentForExperts | ( | bool | bManageGeometry, |
class ON_Object * | geometry_object, | ||
bool | bManageAttributes, | ||
class ON_3dmObjectAttributes * | attributes, | ||
bool | bResolveIdAndNameConflicts | ||
) |
Add geometry and attibutes to this model and control how the instances are managed.
bManageGeometry | [in] If true, geometry_object should point to an instance created by operator new and on the heap. It will be deleted when the this ONX_Model and the last ON_ModelComponentReference are destroyed. If false, the expert caller is carefully managing the instance and memory to insure model_geometry is a valid instance while this ONX_Model and any ON_ModelComponentReference are active. |
geometry_object | [in] geometry_object should point to a geometric object (curve, surface, brep, mesh, points, ...), a render light, an annotation object, or a detail object. |
bManageAttributes | [in] If true, attributes should be nullptr or point to an instance created by operator new and on the heap. It will be deleted when the this ONX_Model and the last ON_ModelComponentReference are destroyed. If false, the expert caller is carefully managing the instance and memory to insure attributes is a valid instance while this ONX_Model and and ON_ModelComponentReference are active. |
attributes | [in] nullptr if not avaiable. |
bResolveIdAndNameConflicts | [in] If bResolveIdAndNameConflicts is false, then attributes must be nullptr or attributes->m_uid must be non-nil and not used in this model. If bResolveIdAndNameConflicts is true, then id will be modified as needed. |
ON_ModelComponentReference ONX_Model::ComponentFromId | ( | ON_ModelComponent::Type | component_type, |
ON_UUID | component_model_id | ||
) | const |
ON_ModelComponentReference ONX_Model::ComponentFromIndex | ( | ON_ModelComponent::Type | component_type, |
int | component_model_index | ||
) | const |
ON_ModelComponentReference ONX_Model::ComponentFromName | ( | ON_ModelComponent::Type | component_type, |
ON_UUID | component_parent_id, | ||
const wchar_t * | component_model_name | ||
) | const |
ON_ModelComponentReference ONX_Model::ComponentFromNameHash | ( | ON_ModelComponent::Type | component_type, |
const ON_NameHash & | component_model_name_hash | ||
) | const |
ON_ModelComponentReference ONX_Model::ComponentFromUnsignedIndex | ( | ON_ModelComponent::Type | component_type, |
unsigned int | component_model_index | ||
) | const |
unsigned int ONX_Model::ComponentIndexLimit | ( | ON_ModelComponent::Type | component_type | ) | const |
ON_SHA1_Hash ONX_Model::ContentHash | ( | ) | const |
ON_ModelComponentReference ONX_Model::CurrentDimensionStyle | ( | ) | const |
ON_UUID ONX_Model::CurrentDimensionStyleId | ( | ) | const |
ON_ModelComponentReference ONX_Model::DefaultDimensionStyle | ( | ) | const |
unsigned int ONX_Model::DeletedComponentCount | ( | ON_ModelComponent::Type | component_type | ) | const |
ON_ModelComponentReference ONX_Model::DimensionStyleFromId | ( | ON_UUID | dimension_styleid | ) | const |
ON_ModelComponentReference ONX_Model::DimensionStyleFromIndex | ( | int | dimension_style_index | ) | const |
Get a dimension style from its model index.
dimension_style_model_index | [in] |
Model index and Manifest() manifest item index are the same.
ON_ModelComponentReference ONX_Model::DimensionStyleFromName | ( | const wchar_t * | dimension_style_name | ) | const |
ON_ModelComponentReference ONX_Model::DimensionStyleFromNameHash | ( | ON_NameHash | dimension_style_name_hash | ) | const |
ON_ModelComponentReference ONX_Model::DimensionStyleWithFontCharacteristics | ( | const ON_Font & | font_characteristics, |
double | model_space_text_scale | ||
) |
Find or create a dimension style with the specified font characteristics.
void ONX_Model::Dump | ( | ON_TextLog & | ) | const |
text dump of entire model
void ONX_Model::DumpComponentList | ( | ON_ModelComponent::Type | component_type, |
ON_TextLog & | text_log | ||
) | const |
void ONX_Model::DumpComponentLists | ( | ON_TextLog & | text_log | ) | const |
void ONX_Model::DumpSummary | ( | ON_TextLog & | ) | const |
text dump of model properties and settings
void ONX_Model::DumpUserDataTable | ( | ON_TextLog & | ) | const |
text dump of user data table
ON_ModelComponentReference ONX_Model::FirstDimensionStyleFromFont | ( | const ON_Font * | font, |
double | model_space_text_scale, | ||
bool | bIgnoreSystemDimStyles | ||
) | const |
font | [in] |
model_space_text_scale | [in] If model_space_text_scale > 0, then the DimScale() must be equal to model_space_text_scale. |
bIgnoreSystemDimStyles | [in] |
dimension styles with a non-nil parent id are ignored.
ON_ModelComponentReference ONX_Model::FirstDimensionStyleFromManagedFontSerialNumber | ( | unsigned int | managed_font_serial_number, |
double | model_space_text_scale, | ||
bool | bIgnoreSystemDimStyles | ||
) | const |
managed_font_serial_number | [in] |
model_space_text_scale | [in] If model_space_text_scale > 0, then the DimScale() must be equal to model_space_text_scale. |
bIgnoreSystemDimStyles | [in] |
dimension styles with a non-nil parent id are ignored.
bool ONX_Model::GetDocumentUserString | ( | const wchar_t * | key, |
ON_wString & | string_value | ||
) | const |
Get user string from the document.
key | [in] id used to retrieve the string. |
string_value | [out] |
int ONX_Model::GetDocumentUserStrings | ( | ON_ClassArray< ON_UserString > & | user_strings | ) | const |
Get a list of all user strings in the document.
user_strings | [out] user strings are appended to this list. |
|
static |
|
static |
ON_ModelComponentReference ONX_Model::ImageFromFileContent | ( | const ON_ContentHash & | image_file_content_hash | ) | const |
ON_ModelComponentReference ONX_Model::ImageFromFileFullPath | ( | const wchar_t * | image_file_full_path_name | ) | const |
ON_ModelComponentReference ONX_Model::ImageFromFileReference | ( | const ON_FileReference & | file_reference | ) | const |
ON_ModelComponentReference ONX_Model::ImageFromId | ( | ON_UUID | image_id | ) | const |
ON_ModelComponentReference ONX_Model::ImageFromIndex | ( | int | image_model_index | ) | const |
Get an image from its model index.
image_model_index | [in] |
Model index and Manifest() manifest item index are the same.
bool ONX_Model::IncrementalReadBegin | ( | ON_BinaryArchive & | archive, |
bool | bManageComponents, | ||
unsigned int | table_filter, | ||
ON_TextLog * | error_log | ||
) |
Reads everything up to the object table.
archive | [in] archive to read from |
bManageComponents | [in] true: The ONX_Model destructor will delete the model components created by this function. false: The caller must delete the ON_ModelComponent components after the ONX_Model is destroyed. |
table_filter | [in] If table_filter is zero, then everything in the archive before the model object table is read. Otherwise the bits in table_filter identify what tables should be read. The bits are defined by the ON_BInaryArchive::table_type enum. |
error_log | [out] any archive reading errors are logged here. pass nullptr if you don't want to log errors |
If the input is valid and everything before the model object table is successfully read, then true is returned. Otherwise false is returned.
bool ONX_Model::IncrementalReadFinish | ( | ON_BinaryArchive & | archive, |
bool | bManageComponents, | ||
unsigned int | table_filter, | ||
ON_TextLog * | error_log | ||
) |
Reads everything up to the object table.
archive | [in] archive to read from |
bManageComponents | [in] true: The ONX_Model destructor will delete the model components created by this function. false: The caller must delete the ON_ModelComponent components after the ONX_Model is destroyed. |
table_filter | [in] If table_filter is zero, then everything in the archive before the model object table is read. Otherwise the bits in table_filter identify what tables should be read. The bits are defined by the ON_BInaryArchive::table_type enum. |
error_log | [out] any archive reading errors are logged here. pass nullptr if you don't want to log errors |
If the input is valid and everything before the model object table is successfully read, then true is returned. Otherwise false is returned.
bool ONX_Model::IncrementalReadModelGeometry | ( | ON_BinaryArchive & | archive, |
bool | bManageModelGeometryComponent, | ||
bool | bManageGeometry, | ||
bool | bManageAttributes, | ||
unsigned int | model_object_type_filter, | ||
ON_ModelComponentReference & | model_geometry_reference | ||
) |
Reads the next item in the model geometry table.
archive | [in] |
bManageModelGeometryComponent | [in] true: The ONX_Model destructor will delete the ON_ModelGeometryComponent components created by this function. false: The caller must delete the ON_ModelGeometryComponent components after the ONX_Model is destroyed. |
bManageGeometry | [in] true: The ON_ModelGeometryComponent destructor will delete the ON_Geometry classes created by this function. false: The caller must delete the ON_Geometry classes after the ONX_Model and ON_ModelGeometryComponent components are destroyed. |
bManageAttributes | [in] true: The ON_ModelGeometryComponent destructor will delete the ON_3dmObjectAttributes classes created by this function. false: The caller must delete the ON_3dmObjectAttributes classes after the ONX_Model and ON_ModelGeometryComponent components are destroyed. |
model_object_type_filter | [in] If model_object_type_filter is not zero, then it is a bitfield filter made by bitwise oring ON::object_type values to select which types of objects will be read from the model object table. |
model_geometry_reference | [out] A reference to an ON_ModelGeometryComponent. This referenced ON_ModelGeometryComponent component is also added to the ONX_Model. Call ONX_Model.RemoveComponent() if you want to discard it before continuing. |
You must call IncrementalReadBegin() before making any calls to IncrementalReadModelObject().
|
static |
|
static |
ON_ModelComponentReference ONX_Model::LayerFromAttributes | ( | const ON_3dmObjectAttributes & | attributes | ) | const |
ON_ModelComponentReference ONX_Model::LayerFromId | ( | ON_UUID | layer_model_id | ) | const |
ON_ModelComponentReference ONX_Model::LayerFromIndex | ( | int | layer_model_index | ) | const |
Get a layer from its model index.
layer_model_index | [in] |
Model index and Manifest() manifest item index are the same.
ON_ModelComponentReference ONX_Model::LayerFromName | ( | ON_UUID | layer_parent_id, |
const wchar_t * | layer_name | ||
) | const |
ON_ModelComponentReference ONX_Model::LayerFromNameHash | ( | const ON_NameHash & | layer_model_name_hash | ) | const |
ON_ModelComponentReference ONX_Model::LinePatternFromAttributes | ( | const ON_3dmObjectAttributes & | attributes | ) | const |
Get linetype from object attributes.
attributes | [in] object attributes. |
line_pattern | [out] linetype |
ON_ModelComponentReference ONX_Model::LinePatternFromId | ( | ON_UUID | line_pattern_model_id | ) | const |
ON_ModelComponentReference ONX_Model::LinePatternFromIndex | ( | int | line_pattern_model_index | ) | const |
Get a line pattern from its model index.
line_pattern_model_index | [in] |
Model index and Manifest() manifest item index are the same.
ON_ModelComponentReference ONX_Model::LinePatternFromLayerIndex | ( | int | layer_index | ) | const |
ON_ModelComponentReference ONX_Model::LinePatternFromName | ( | const wchar_t * | line_pattern_name | ) | const |
ON_ModelComponentReference ONX_Model::LinePatternFromNameHash | ( | ON_NameHash | line_pattern_model_name_hash | ) | const |
const ON_ComponentManifest& ONX_Model::Manifest | ( | ) | const |
A manifest of every model component in this ONX_Model.
Use the manifest to find model objects from a name, id or index.
The manifest Id, Name, and Index values are values used in the model. These are assigned when a component is added to the ONX_Model. When possible the id and name are not changed.
The manifest=model and original component values are different when:
The OriginalToModelMap() can be used to convert original component index and id to the manifest=model index and id.
The ModelToOriginalMap() can be used to manifest=model index and id to the original component index and id.
ON__UINT64 ONX_Model::ModelContentVersionNumber | ( | ) | const |
This number changes every time the content of the ONX_Model is modified.
ON_BoundingBox ONX_Model::ModelGeometryBoundingBox | ( | ) | const |
ON_ModelGeometryComponent ONX_Model::ModelGeometryFromId | ( | unsigned int | model_object_index | ) |
ON_ModelGeometryComponent ONX_Model::ModelGeometryFromIndex | ( | int | model_object_index | ) |
ON_ModelGeometryComponent ONX_Model::ModelGeometryFromUnsignedIndex | ( | unsigned int | model_object_index | ) |
const ON_ManifestMap& ONX_Model::ModelToOriginalMap | ( | ) | const |
ON_ManifestMapItem Source = model-manifest index and id. ON_ManifestMapItem Destination = original component index and id.
const ON_ManifestMap& ONX_Model::OriginalToModelMap | ( | ) | const |
ON_ManifestMapItem Source = original component index and id. ON_ManifestMapItem Destination = model-manifest index and id.
bool ONX_Model::Read | ( | ON_BinaryArchive & | archive, |
unsigned int | table_filter, | ||
unsigned int | model_object_type_filter, | ||
ON_TextLog * | error_log | ||
) |
Reads an openNURBS archive and saves the information in this model
archive | [in] archive to read from |
table_filter | [in] If table_filter is zero, then everything in the archive is read. Otherwise the bits in table_filter identify what tables should be read. The bits are defined by the ON_BInaryArchive::table_type enum. |
model_object_type_filter | [in] If model_object_type_filter is not zero, then it is a bitfield filter made by bitwise oring ON::object_type values to select which types of objects will be read from the model object table. |
error_log | [out] any archive reading errors are logged here. |
bool ONX_Model::Read | ( | const char * | filename, |
unsigned int | table_filter, | ||
unsigned int | model_object_type_filter, | ||
ON_TextLog * | error_log | ||
) |
bool ONX_Model::Read | ( | const wchar_t * | filename, |
unsigned int | table_filter, | ||
unsigned int | model_object_type_filter, | ||
ON_TextLog * | error_log | ||
) |
bool ONX_Model::Read | ( | ON_BinaryArchive & | archive, |
ON_TextLog * | error_log = nullptr |
||
) |
bool ONX_Model::Read | ( | const char * | filename, |
ON_TextLog * | error_log = nullptr |
||
) |
bool ONX_Model::Read | ( | const wchar_t * | filename, |
ON_TextLog * | error_log = nullptr |
||
) |
ON_ModelComponentReference ONX_Model::RemoveModelComponent | ( | ON_ModelComponent::Type | component_type, |
ON_UUID | component_id | ||
) |
ON_BoundingBox ONX_Model::RenderLightBoundingBox | ( | ) | const |
ON_ModelComponentReference ONX_Model::RenderMaterialFromAttributes | ( | const ON_3dmObjectAttributes & | attributes | ) | const |
ON_ModelComponentReference ONX_Model::RenderMaterialFromId | ( | ON_UUID | render_material_id | ) | const |
ON_ModelComponentReference ONX_Model::RenderMaterialFromIndex | ( | int | render_material_index | ) | const |
ON_ModelComponentReference ONX_Model::RenderMaterialFromLayerIndex | ( | int | layer_index | ) | const |
Get render material from object attributes.
attributes | [in] object attributes. |
material | [out] render material |
void ONX_Model::Reset | ( | ) |
bool ONX_Model::SetCurrentDimensionStyleId | ( | ON_UUID | dimension_style_id | ) |
dimension_style_id | [in] Id of a dimension style in this model, a system dimension style, or ON_nil_uuid. |
bool ONX_Model::SetDocumentUserString | ( | const wchar_t * | key, |
const wchar_t * | string_value | ||
) |
Attach a user string to the document.
key | [in] id used to retrieve this string. |
string_value | [in] If nullptr, the string with this id will be removed. |
int ONX_Model::UsesIDef | ( | const ON_InstanceRef & | iref, |
ON_UUID | idef_uuid | ||
) | const |
See if the instance reference iref refers to an instance definition.
iref | [in] |
idef_uuid | [in] id of idef we are looking for |
bool ONX_Model::ValdateComponentIdAndName | ( | ON_ModelComponent::Type | component_type, |
const ON_UUID & | candidate_id, | ||
const ON_UUID & | component_parent_id, | ||
const wchar_t * | candidate_name, | ||
bool | bResolveIdConflict, | ||
bool | bResolveNameConflict, | ||
ON_UUID & | model_id, | ||
ON_wString & | model_name | ||
) | const |
ON_Color ONX_Model::WireframeColorFromAttributes | ( | const ON_3dmObjectAttributes & | attributes | ) | const |
Get wireframe drawing color from object attributes.
attributes | [in] object attributes. |
bool ONX_Model::Write | ( | const char * | filename, |
int | version = 0 , |
||
ON_TextLog * | error_log = nullptr |
||
) | const |
Writes contents of this model to an openNURBS archive.
filename | [in] |
version | [in] Version of the openNURBS archive to write. 0 default value and suggested. When 0 is passed in, the value of ON_BinaryArchive::CurrentArchiveVersion() is used. 2, 3, 4, 50, 60, ... If you pass in a value < ON_BinaryArchive::CurrentArchiveVersion(), then some information in current data structures will not be saved in the 3dm archive. Rhino 2.x can read version 2 files. Rhino 3.x can read version 2 and 3 files. Rhino 4.x can read version 2, 3, and 4 files. Rhino 5.x can read version 2, 3, 4, 5, and 50 files. Rhino 6.x can read version 2, 3, 4, 5, 50, and 60 files. |
error_log | [out] any archive writing errors are logged here. |
bool ONX_Model::Write | ( | const wchar_t * | filename, |
int | version = 0 , |
||
ON_TextLog * | error_log = nullptr |
||
) | const |
Writes contents of this model to an openNURBS archive.
filename | [in] |
version | [in] Version of the openNURBS archive to write. 0 default value and suggested. When 0 is passed in, the value of ON_BinaryArchive::CurrentArchiveVersion() is used. 2, 3, 4, 50, 60, ... If you pass in a value < ON_BinaryArchive::CurrentArchiveVersion(), then some information in current data structures will not be saved in the 3dm archive. Rhino 2.x can read version 2 files. Rhino 3.x can read version 2 and 3 files. Rhino 4.x can read version 2, 3, and 4 files. Rhino 5.x can read version 2, 3, 4, 5, and 50 files. Rhino 6.x can read version 2, 3, 4, 5, 50, and 60 files. |
error_log | [out] any archive writing errors are logged here. |
bool ONX_Model::Write | ( | ON_BinaryArchive & | archive, |
int | version = 0 , |
||
ON_TextLog * | error_log = nullptr |
||
) | const |
Writes contents of this model to an openNURBS archive.
archive | [in] archive to write to You must call archive.SetArchiveFullPath(...) i order for file references to work correctly. |
version | [in] Version of the openNURBS archive to write. 0 default value and suggested. When 0 is passed in, the value of ON_BinaryArchive::CurrentArchiveVersion() is used. 2, 3, 4, 50, 60, ... If you pass in a value < ON_BinaryArchive::CurrentArchiveVersion(), then some information in current data structures will not be saved in the 3dm archive. Rhino 2.x can read version 2 files. Rhino 3.x can read version 2 and 3 files. Rhino 4.x can read version 2, 3, and 4 files. Rhino 5.x can read version 2, 3, 4, 5, and 50 files. Rhino 6.x can read version 2, 3, 4, 5, 50, and 60 files. |
error_log | [out] any archive writing errors are logged here. |
True if archive is written with no error. False if errors occur. Error details are logged in error_log.
|
friend |
ON__UINT64 ONX_Model::m_3dm_file_byte_count = 0 |
int ONX_Model::m_3dm_file_version = 0 |
3dm archive start section information
unsigned int ONX_Model::m_3dm_opennurbs_version = 0 |
ON_3dmProperties ONX_Model::m_properties |
ON_3dmSettings ONX_Model::m_settings |
ON_String ONX_Model::m_sStartSectionComments |
ON_SimpleArray<ONX_Model_UserData*> ONX_Model::m_userdata_table |