Rhino C++ API  8.6
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
ONX_Model Class Reference

#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)
 
int AddDefaultLayer (const wchar_t *layer_name, ON_Color layer_color)
 
int AddLayer (const wchar_t *layer_name, ON_Color layer_color)
 
ON_ModelComponentReference AddManagedModelComponent (class ON_ModelComponent *managed_model_component)
 
ON_ModelComponentReference AddManagedModelComponent (class ON_ModelComponent *managed_model_component, bool bResolveIdAndNameConflicts)
 
ON_ModelComponentReference AddManagedModelGeometryComponent (class ON_Object *managed_geometry_object, class ON_3dmObjectAttributes *managed_attributes)
 
ON_ModelComponentReference AddManagedModelGeometryComponent (class ON_Object *managed_geometry_object, class ON_3dmObjectAttributes *managed_attributes, bool bResolveIdAndNameConflicts)
 
ON_ModelComponentReference AddModelComponent (const class ON_ModelComponent &model_component)
 
ON_ModelComponentReference AddModelComponent (const class ON_ModelComponent &model_component, bool bResolveIdAndNameConflicts)
 
ON_ModelComponentReference AddModelComponentForExperts (class ON_ModelComponent *model_component, bool bManagedComponent, bool bResolveIdAndNameConflicts, bool bUpdateComponentIdentification)
 
ON_ModelComponentReference AddModelGeometryComponent (const class ON_Object *geometry_object, const class ON_3dmObjectAttributes *attributes)
 
ON_ModelComponentReference AddModelGeometryComponent (const class ON_Object *geometry_object, const class ON_3dmObjectAttributes *attributes, bool bResolveIdAndNameConflicts)
 
ON_ModelComponentReference AddModelGeometryComponentForExperts (bool bManageGeometry, class ON_Object *geometry_object, bool bManageAttributes, class ON_3dmObjectAttributes *attributes, bool bResolveIdAndNameConflicts)
 
int AddRenderEnvironment (const wchar_t *env_name)
 
int AddRenderMaterial (const wchar_t *mat_name)
 
int AddRenderTexture (const wchar_t *filename)
 
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
 
const ON_ModelComponentReferenceComponentFromRuntimeSerialNumber (ON__UINT64 runtime_serial_number) 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
 
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)
 
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
 
int GetDocumentUserStrings (ON_ClassArray< ON_UserString > &user_strings) const
 
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
 
bool IncrementalReadBegin (ON_BinaryArchive &archive, bool bManageComponents, unsigned int table_filter, ON_TextLog *error_log)
 
bool IncrementalReadFinish (ON_BinaryArchive &archive, bool bManageComponents, unsigned int table_filter, ON_TextLog *error_log)
 
bool IncrementalReadModelGeometry (ON_BinaryArchive &archive, bool bManageModelGeometryComponent, bool bManageGeometry, bool bManageAttributes, unsigned int model_object_type_filter, ON_ModelComponentReference &model_geometry_reference)
 
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
 
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
 
ON_ModelComponentReference LinePatternFromId (ON_UUID line_pattern_model_id) const
 
ON_ModelComponentReference LinePatternFromIndex (int line_pattern_model_index) const
 
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_ComponentManifestManifest () const
 
ON_ModelComponentReference MaterialFromAttributes (const ON_3dmObjectAttributes &attributes) const
 
ON_ModelComponentReference MaterialFromId (ON_UUID material_id) const
 
ON_ModelComponentReference MaterialFromIndex (int material_index) const
 
ON_ModelComponentReference MaterialFromLayerIndex (int layer_index) const
 
ON__UINT64 ModelContentVersionNumber () const
 
ON_BoundingBox ModelGeometryBoundingBox () const
 
const ON_ModelGeometryComponentModelGeometryComponentFromId (ON_UUID model_geometry_component_id) const
 
ON_ModelComponentReference ModelGeometryFromId (ON_UUID model_geometry_component_id) const
 
const ON_ManifestMapModelToOriginalMap () const
 
const ON_ManifestMapOriginalToModelMap () const
 
bool Read (const char *filename, ON_TextLog *error_log=nullptr)
 
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, ON_TextLog *error_log=nullptr)
 
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 (ON_BinaryArchive &archive, unsigned int table_filter, unsigned int model_object_type_filter, ON_TextLog *error_log)
 
ON_ModelComponentReference RemoveModelComponent (ON_ModelComponent::Type component_type, ON_UUID component_id)
 
ON_BoundingBox RenderLightBoundingBox () const
 
ON_DEPRECATED ON_ModelComponentReference RenderMaterialFromAttributes (const ON_3dmObjectAttributes &) const
 
ON_DEPRECATED ON_ModelComponentReference RenderMaterialFromId (ON_UUID) const
 
ON_DEPRECATED ON_ModelComponentReference RenderMaterialFromIndex (int) const
 
ON_DEPRECATED ON_ModelComponentReference RenderMaterialFromLayerIndex (int) const
 
void Reset ()
 
bool SetCurrentDimensionStyleId (ON_UUID dimension_style_id)
 
bool SetDocumentUserString (const wchar_t *key, const wchar_t *string_value)
 
int UsesIDef (const ON_InstanceRef &iref, ON_UUID idef_uuid) const
 
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
 
bool Write (const char *filename, int version=0, ON_TextLog *error_log=nullptr) const
 
bool Write (const wchar_t *filename, int version=0, ON_TextLog *error_log=nullptr) const
 
bool Write (ON_BinaryArchive &archive, int version=0, ON_TextLog *error_log=nullptr) const
 

Static Public Member Functions

static bool GetRDKDocumentInformation (const ONX_Model_UserData &docud, ON_wString &rdk_xml_document_data)
 
static bool GetRDKEmbeddedFile (const ONX_Model_UserData &docud, const wchar_t *path, ON_SimpleArray< unsigned char > &bytes)
 
static bool GetRDKEmbeddedFilePaths (const ONX_Model_UserData &docud, ON_ClassArray< ON_wString > &paths)
 
static bool GetRDKEmbeddedFiles (const ONX_Model_UserData &docud, ON_ClassArray< ON_wString > &paths, ON_SimpleArray< unsigned char * > &embedded_files_as_buffers)
 
static bool GetRDKEmbeddedFiles (const ONX_Model_UserData &docud, ON_ClassArray< ON_wString > &paths, ON_SimpleArray< unsigned char * > &embedded_files_as_buffers, ON_SimpleArray< size_t > &buffer_sizes)
 
static bool GetRDKObjectInformation (const ON_Object &object, ON_wString &xml)
 
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
 
class ONX_ModelPrivate
 < Private extension. More...
 

Detailed Description

Description: 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.

Constructor & Destructor Documentation

◆ ONX_Model()

ONX_Model::ONX_Model ( )

◆ ~ONX_Model()

virtual ONX_Model::~ONX_Model ( )
virtual

Member Function Documentation

◆ ActiveAndDeletedComponentCount()

unsigned int ONX_Model::ActiveAndDeletedComponentCount ( ON_ModelComponent::Type  component_type) const

Returns: Number of active and deleted components. Count does not include system components.

◆ ActiveComponentCount()

unsigned int ONX_Model::ActiveComponentCount ( ON_ModelComponent::Type  component_type) const

Returns: Number of active components. Count does not include system components.

◆ AddDefaultDimensionStyle()

int ONX_Model::AddDefaultDimensionStyle ( const wchar_t *  dimension_style_name,
ON::LengthUnitSystem  length_unit_system,
double  model_tolerance 
)

Description: Easy way to add a default dimension style to the model. Parameters: 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. Returns: The default dimension style's index (>=0) is returned.

◆ AddDefaultLayer()

int ONX_Model::AddDefaultLayer ( const wchar_t *  layer_name,
ON_Color  layer_color 
)

Description: 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 Returns: The default layer's index (>=0) is returned.

◆ AddLayer()

int ONX_Model::AddLayer ( const wchar_t *  layer_name,
ON_Color  layer_color 
)

Description: Easy way to add a layer to the model. Returns: If layer_name is valid, the layer's index (>=0) is returned. Otherwise, ON_UNSET_INT_INDEX is returned.

◆ AddManagedModelComponent() [1/2]

ON_ModelComponentReference ONX_Model::AddManagedModelComponent ( class ON_ModelComponent managed_model_component)

◆ AddManagedModelComponent() [2/2]

ON_ModelComponentReference ONX_Model::AddManagedModelComponent ( class ON_ModelComponent managed_model_component,
bool  bResolveIdAndNameConflicts 
)

Description: 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.

Returns: A reference to the added model component. If the reference is empty (ON_ModelComponent::IsEmpty() is true) then the input was not valid.

◆ AddManagedModelGeometryComponent() [1/2]

ON_ModelComponentReference ONX_Model::AddManagedModelGeometryComponent ( class ON_Object managed_geometry_object,
class ON_3dmObjectAttributes managed_attributes 
)

◆ AddManagedModelGeometryComponent() [2/2]

ON_ModelComponentReference ONX_Model::AddManagedModelGeometryComponent ( class ON_Object managed_geometry_object,
class ON_3dmObjectAttributes managed_attributes,
bool  bResolveIdAndNameConflicts 
)

Description: Add an copy of the model_geometry and attributes to this model.

Parameters: 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.

Returns: A reference to the added model component. If the reference is empty (ON_ModelComponent::IsEmpty() is true) then the input was not valid.

◆ AddModelComponent() [1/2]

ON_ModelComponentReference ONX_Model::AddModelComponent ( const class ON_ModelComponent model_component)

◆ AddModelComponent() [2/2]

ON_ModelComponentReference ONX_Model::AddModelComponent ( const class ON_ModelComponent model_component,
bool  bResolveIdAndNameConflicts 
)

Description: Add a copy of a model_component 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.

Returns: A reference to the added model component. If the reference is empty (ON_ModelComponent::IsEmpty() is true) then the input was not valid.

◆ AddModelComponentForExperts()

ON_ModelComponentReference ONX_Model::AddModelComponentForExperts ( class ON_ModelComponent model_component,
bool  bManagedComponent,
bool  bResolveIdAndNameConflicts,
bool  bUpdateComponentIdentification 
)

Description: 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 destruction 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.)

Returns: A reference to the added model component. If the reference is empty (ON_ModelComponentReference::IsEmpty() is true), then the input was not valid and the model component was not added.

◆ AddModelGeometryComponent() [1/2]

ON_ModelComponentReference ONX_Model::AddModelGeometryComponent ( const class ON_Object geometry_object,
const class ON_3dmObjectAttributes attributes 
)

◆ AddModelGeometryComponent() [2/2]

ON_ModelComponentReference ONX_Model::AddModelGeometryComponent ( const class ON_Object geometry_object,
const class ON_3dmObjectAttributes attributes,
bool  bResolveIdAndNameConflicts 
)

Description: Add an copy of the model_geometry and attributes to this model.

Parameters: 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.

Returns: A reference to the added model component. If the reference is empty (ON_ModelComponent::IsEmpty() is true) then the input was not valid.

◆ AddModelGeometryComponentForExperts()

ON_ModelComponentReference ONX_Model::AddModelGeometryComponentForExperts ( bool  bManageGeometry,
class ON_Object geometry_object,
bool  bManageAttributes,
class ON_3dmObjectAttributes attributes,
bool  bResolveIdAndNameConflicts 
)

Description: Add geometry and attributes to this model and control how the instances are managed.

Parameters: 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 available.

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.

Returns: A reference to the added model component. If the reference is empty (ON_ModelComponent::IsEmpty() is true) then the input was not valid.

◆ AddRenderEnvironment()

int ONX_Model::AddRenderEnvironment ( const wchar_t *  env_name)

Description: Easy way to add a render environment to the model. Creates a basic environment. Returns: If env_name is valid and the function succeeds, the environment's index is returned. Otherwise ON_UNSET_INT_INDEX is returned.

◆ AddRenderMaterial()

int ONX_Model::AddRenderMaterial ( const wchar_t *  mat_name)

Description: Easy way to add a render material to the model. Creates a PBR material. Returns: If mat_name is valid and the function succeeds, the material's index is returned. Otherwise ON_UNSET_INT_INDEX is returned.

◆ AddRenderTexture()

int ONX_Model::AddRenderTexture ( const wchar_t *  filename)

Description: Easy way to add a render texture to the model. Creates a bitmap texture. The texture's name is derived from the supplied file name. The file must exist locally or the function will fail. Returns: If the function succeeds, the texture's index is returned. Otherwise ON_UNSET_INT_INDEX is returned.

◆ ComponentFromId()

ON_ModelComponentReference ONX_Model::ComponentFromId ( ON_ModelComponent::Type  component_type,
ON_UUID  component_model_id 
) const

◆ ComponentFromIndex()

ON_ModelComponentReference ONX_Model::ComponentFromIndex ( ON_ModelComponent::Type  component_type,
int  component_model_index 
) const

◆ ComponentFromName()

ON_ModelComponentReference ONX_Model::ComponentFromName ( ON_ModelComponent::Type  component_type,
ON_UUID  component_parent_id,
const wchar_t *  component_model_name 
) const

◆ ComponentFromNameHash()

ON_ModelComponentReference ONX_Model::ComponentFromNameHash ( ON_ModelComponent::Type  component_type,
const ON_NameHash component_model_name_hash 
) const

◆ ComponentFromRuntimeSerialNumber()

const ON_ModelComponentReference& ONX_Model::ComponentFromRuntimeSerialNumber ( ON__UINT64  runtime_serial_number) const

Parameters: runtime_serial_number - [in] Value of ON_ModelComponent::RuntimeSerialNumber() to search for. Returns: If there is a model component with the specified runtime serial number, then a reference to that component is returned. Otherwise, ON_ModelComponentReference::Empty is returned. Remarks: ONX_Model::ComponentFromRuntimeSerialNumber() used to get a reference rather than a copy of the model's primary ON_ModelComponentReference. This is the function that must be used if a caller is going to use exclusive access functions like

ON_ModelComponent* ON_ModelComponentReference::ExclusiveModelComponent() ON_3dmObjectAttributes* ON_ModelGeometryComponent::ExclusiveAttributes() ON_Geometry* ON_ModelGeometryComponent::ExclusiveGeometry()

to modify content that is in the ONX_Model. The exclusive access functions will only return non-nullptr values when there are no external references to the model component.

◆ ComponentFromUnsignedIndex()

ON_ModelComponentReference ONX_Model::ComponentFromUnsignedIndex ( ON_ModelComponent::Type  component_type,
unsigned int  component_model_index 
) const

◆ ComponentIndexLimit()

unsigned int ONX_Model::ComponentIndexLimit ( ON_ModelComponent::Type  component_type) const

◆ ContentHash()

ON_SHA1_Hash ONX_Model::ContentHash ( ) const

Returns: A SHA-1 hash of the model's content. If two models have identical content, then the have equal ContentHash() values.

◆ CurrentDimensionStyle()

ON_ModelComponentReference ONX_Model::CurrentDimensionStyle ( ) const

Returns: Current dimension style = DimensionStyleFromId(CurrentDimensionStyleId())

◆ CurrentDimensionStyleId()

ON_UUID ONX_Model::CurrentDimensionStyleId ( ) const

Returns: Id of the current dimension style or nil if the current style is not set or not in this model.

◆ DefaultDimensionStyle()

ON_ModelComponentReference ONX_Model::DefaultDimensionStyle ( ) const

Returns: A system dimension style that is the default for this model and is used when a referenced dimension style is missing from this model.

◆ DeletedComponentCount()

unsigned int ONX_Model::DeletedComponentCount ( ON_ModelComponent::Type  component_type) const

Returns: Number of deleted components.

◆ DimensionStyleFromId()

ON_ModelComponentReference ONX_Model::DimensionStyleFromId ( ON_UUID  dimension_styleid) const

◆ DimensionStyleFromIndex()

ON_ModelComponentReference ONX_Model::DimensionStyleFromIndex ( int  dimension_style_index) const

Description: Get a dimension style from its model index. Parameters: dimension_style_model_index - [in] Returns: An ON_ModelComponentReference to the dimension style. Remarks: Model index and Manifest() manifest item index are the same.

◆ DimensionStyleFromName()

ON_ModelComponentReference ONX_Model::DimensionStyleFromName ( const wchar_t *  dimension_style_name) const

◆ DimensionStyleFromNameHash()

ON_ModelComponentReference ONX_Model::DimensionStyleFromNameHash ( ON_NameHash  dimension_style_name_hash) const

◆ DimensionStyleWithFontCharacteristics()

ON_ModelComponentReference ONX_Model::DimensionStyleWithFontCharacteristics ( const ON_Font font_characteristics,
double  model_space_text_scale 
)

Description: Find or create a dimension style with the specified font characteristics.

◆ Dump()

void ONX_Model::Dump ( ON_TextLog ) const

text dump of entire model

END model document level user string tools BEGIN model text dump tools

◆ DumpComponentList()

void ONX_Model::DumpComponentList ( ON_ModelComponent::Type  component_type,
ON_TextLog text_log 
) const

◆ DumpComponentLists()

void ONX_Model::DumpComponentLists ( ON_TextLog text_log) const

Returns: A text dump of all component lists.

◆ DumpSummary()

void ONX_Model::DumpSummary ( ON_TextLog ) const

text dump of model properties and settings

◆ DumpUserDataTable()

void ONX_Model::DumpUserDataTable ( ON_TextLog ) const

text dump of user data table

◆ FirstDimensionStyleFromFont()

ON_ModelComponentReference ONX_Model::FirstDimensionStyleFromFont ( const ON_Font font,
double  model_space_text_scale,
bool  bIgnoreSystemDimStyles 
) const

Parameters: 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] Returns: The first dimension style with the specified font. Remarks: dimension styles with a non-nil parent id are ignored.

◆ FirstDimensionStyleFromManagedFontSerialNumber()

ON_ModelComponentReference ONX_Model::FirstDimensionStyleFromManagedFontSerialNumber ( unsigned int  managed_font_serial_number,
double  model_space_text_scale,
bool  bIgnoreSystemDimStyles 
) const

Parameters: 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] Returns: The first dimension style with the specified font. Remarks: dimension styles with a non-nil parent id are ignored.

◆ GetDocumentUserString()

bool ONX_Model::GetDocumentUserString ( const wchar_t *  key,
ON_wString string_value 
) const

Description: Get user string from the document. Parameters: key - [in] id used to retrieve the string. string_value - [out] Returns: True if a string with id was found.

◆ GetDocumentUserStrings()

int ONX_Model::GetDocumentUserStrings ( ON_ClassArray< ON_UserString > &  user_strings) const

Description: Get a list of all user strings in the document. Parameters: user_strings - [out] user strings are appended to this list. Returns: Number of elements appended to the user_strings list.

◆ GetRDKDocumentInformation()

static bool ONX_Model::GetRDKDocumentInformation ( const ONX_Model_UserData docud,
ON_wString rdk_xml_document_data 
)
static
Deprecated:
This function is deprecated.

◆ GetRDKEmbeddedFile()

static bool ONX_Model::GetRDKEmbeddedFile ( const ONX_Model_UserData docud,
const wchar_t *  path,
ON_SimpleArray< unsigned char > &  bytes 
)
static
Deprecated:
This function is deprecated in favor of ON_EmbeddedFile.

◆ GetRDKEmbeddedFilePaths()

static bool ONX_Model::GetRDKEmbeddedFilePaths ( const ONX_Model_UserData docud,
ON_ClassArray< ON_wString > &  paths 
)
static
Deprecated:
This function is deprecated in favor of ON_EmbeddedFile.

◆ GetRDKEmbeddedFiles() [1/2]

static bool ONX_Model::GetRDKEmbeddedFiles ( const ONX_Model_UserData docud,
ON_ClassArray< ON_wString > &  paths,
ON_SimpleArray< unsigned char * > &  embedded_files_as_buffers 
)
static
Deprecated:
This function is deprecated as it did not return the buffer sizes, making it useless

◆ GetRDKEmbeddedFiles() [2/2]

static bool ONX_Model::GetRDKEmbeddedFiles ( const ONX_Model_UserData docud,
ON_ClassArray< ON_wString > &  paths,
ON_SimpleArray< unsigned char * > &  embedded_files_as_buffers,
ON_SimpleArray< size_t > &  buffer_sizes 
)
static
Deprecated:
This function is deprecated in favor of ON_EmbeddedFile.

◆ GetRDKObjectInformation()

static bool ONX_Model::GetRDKObjectInformation ( const ON_Object object,
ON_wString xml 
)
static
Deprecated:
This function is deprecated. Please use GetDecalIterator(), AddDecal() and GetDecal() instead.

◆ ImageFromFileContent()

ON_ModelComponentReference ONX_Model::ImageFromFileContent ( const ON_ContentHash image_file_content_hash) const

◆ ImageFromFileFullPath()

ON_ModelComponentReference ONX_Model::ImageFromFileFullPath ( const wchar_t *  image_file_full_path_name) const

◆ ImageFromFileReference()

ON_ModelComponentReference ONX_Model::ImageFromFileReference ( const ON_FileReference file_reference) const

◆ ImageFromId()

ON_ModelComponentReference ONX_Model::ImageFromId ( ON_UUID  image_id) const

◆ ImageFromIndex()

ON_ModelComponentReference ONX_Model::ImageFromIndex ( int  image_model_index) const

Description: Get an image from its model index. Parameters: image_model_index - [in] Returns: An ON_ModelComponentReference to the image. Remarks: Model index and Manifest() manifest item index are the same.

◆ IncrementalReadBegin()

bool ONX_Model::IncrementalReadBegin ( ON_BinaryArchive archive,
bool  bManageComponents,
unsigned int  table_filter,
ON_TextLog error_log 
)

Description: Reads everything up to the object table.

Parameters: 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

Returns: If the input is valid and everything before the model object table is successfully read, then true is returned. Otherwise false is returned.

Example:

/ for ASCII file names const char* sFileName = ....; FILE* fp = ON::OpenFile( sFileName, "rb");

/ for UNICODE file names const wchar_t* wsFileName = ....; FILE* fp = ON::OpenFile( wsFileName, L"rb");

bool bModelRead = false; bool bModelIsValid = false;

ON_TextLog error_log;

if ( 0 != fp ) { ON_BinaryFile archive( ON::archive_mode::read3dm, fp ); ONX_Model model;

/ Read settings, layer information, and other tables / with information that is referenced by model object / attributes. bModelRead = model.IncrementalReadBegin( archive, error_log );

if ( bModelRead ) { object_filter = ON::mesh_object ///< read meshes | ON::curve_object ///< and curves ; for(;;) { / read the next model object ON_ModelGeometryComponent* pModelObject = model.IncrementalReadModelObject(object_filter,0); if ( 0 == pModelObject ) break;

... ///< work with this model object

/ done with this object. pModelObject = 0; model.m_object_table.Remove(); }
} ON::CloseFile( fp ); } See Also: ONX_Model::IsValid ONX_Model::Write ONX_Model::m_crc_error_count

◆ IncrementalReadFinish()

bool ONX_Model::IncrementalReadFinish ( ON_BinaryArchive archive,
bool  bManageComponents,
unsigned int  table_filter,
ON_TextLog error_log 
)

Description: Reads everything up to the object table.

Parameters: 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

Returns: If the input is valid and everything before the model object table is successfully read, then true is returned. Otherwise false is returned.

See Also: ONX_Model::IsValid ONX_Model::Write ONX_Model::m_crc_error_count

◆ IncrementalReadModelGeometry()

bool ONX_Model::IncrementalReadModelGeometry ( ON_BinaryArchive archive,
bool  bManageModelGeometryComponent,
bool  bManageGeometry,
bool  bManageAttributes,
unsigned int  model_object_type_filter,
ON_ModelComponentReference model_geometry_reference 
)

Description: Reads the next item in the model geometry table.

Parameters: 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.
Returns: True Successful. If model_geometry_reference.IsEmpty() is true, then no more geometry objects are available and you should call IncrementalReadFinish(). False An error occurred and reading should terminate. Remarks: You must call IncrementalReadBegin() before making any calls to IncrementalReadModelObject().

◆ IsRDKDocumentInformation()

static bool ONX_Model::IsRDKDocumentInformation ( const ONX_Model_UserData docud)
static

END model text dump tools BEGIN Rendering information

Deprecated:
This function is deprecated.

◆ IsRDKObjectInformation()

static bool ONX_Model::IsRDKObjectInformation ( const ON_UserData objectud)
static
Deprecated:
This function is deprecated.

◆ LayerFromAttributes()

ON_ModelComponentReference ONX_Model::LayerFromAttributes ( const ON_3dmObjectAttributes attributes) const

◆ LayerFromId()

ON_ModelComponentReference ONX_Model::LayerFromId ( ON_UUID  layer_model_id) const

◆ LayerFromIndex()

ON_ModelComponentReference ONX_Model::LayerFromIndex ( int  layer_model_index) const

Description: Get a layer from its model index. Parameters: layer_model_index - [in] Returns: An ON_ModelComponentReference to the layer. Remarks: Model index and Manifest() manifest item index are the same.

◆ LayerFromName()

ON_ModelComponentReference ONX_Model::LayerFromName ( ON_UUID  layer_parent_id,
const wchar_t *  layer_name 
) const

◆ LayerFromNameHash()

ON_ModelComponentReference ONX_Model::LayerFromNameHash ( const ON_NameHash layer_model_name_hash) const

◆ LinePatternFromAttributes()

ON_ModelComponentReference ONX_Model::LinePatternFromAttributes ( const ON_3dmObjectAttributes attributes) const

Description: Get linetype from object attributes. Parameters: attributes - [in] object attributes. line_pattern - [out] linetype

◆ LinePatternFromId()

ON_ModelComponentReference ONX_Model::LinePatternFromId ( ON_UUID  line_pattern_model_id) const

◆ LinePatternFromIndex()

ON_ModelComponentReference ONX_Model::LinePatternFromIndex ( int  line_pattern_model_index) const

Description: Get a line pattern from its model index. Parameters: line_pattern_model_index - [in] Returns: An ON_ModelComponentReference to the line pattern. Remarks: Model index and Manifest() manifest item index are the same.

◆ LinePatternFromLayerIndex()

ON_ModelComponentReference ONX_Model::LinePatternFromLayerIndex ( int  layer_index) const

◆ LinePatternFromName()

ON_ModelComponentReference ONX_Model::LinePatternFromName ( const wchar_t *  line_pattern_name) const

◆ LinePatternFromNameHash()

ON_ModelComponentReference ONX_Model::LinePatternFromNameHash ( ON_NameHash  line_pattern_model_name_hash) const

◆ Manifest()

const ON_ComponentManifest& ONX_Model::Manifest ( ) const

Description: A manifest of every model component in this ONX_Model. Remarks: 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 original component Id or Name was not set and a value was automatically assigned.
  • The original component Id or Name was not unique and was modified when the component was added to the model.
  • Generally the original component index differs from the manifest=model component index.

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.

◆ MaterialFromAttributes()

ON_ModelComponentReference ONX_Model::MaterialFromAttributes ( const ON_3dmObjectAttributes attributes) const

Description: Get material from object attributes. Parameters: attributes - [in] object attributes.

◆ MaterialFromId()

ON_ModelComponentReference ONX_Model::MaterialFromId ( ON_UUID  material_id) const

Description: Get material from id. Parameters: material_id - [in] id.

◆ MaterialFromIndex()

ON_ModelComponentReference ONX_Model::MaterialFromIndex ( int  material_index) const

Description: Get material from index. Parameters: material_index - [in] index.

◆ MaterialFromLayerIndex()

ON_ModelComponentReference ONX_Model::MaterialFromLayerIndex ( int  layer_index) const

Description: Get material from layer index. Parameters: layer_index - [in] layer index.

◆ ModelContentVersionNumber()

ON__UINT64 ONX_Model::ModelContentVersionNumber ( ) const

Description: This number changes every time the content of the ONX_Model is modified.

◆ ModelGeometryBoundingBox()

ON_BoundingBox ONX_Model::ModelGeometryBoundingBox ( ) const

END model definitions Returns: Bounding box of every object in m_object_table[].

◆ ModelGeometryComponentFromId()

const ON_ModelGeometryComponent& ONX_Model::ModelGeometryComponentFromId ( ON_UUID  model_geometry_component_id) const

Description: Find a model geometry component from Id Parameters: model_geometry_component_id - [in] Returns: If there is a model geometry component with the id, it is returned. Otherwise, ON_ModelGeometryComponent::Unset is returned.

◆ ModelGeometryFromId()

ON_ModelComponentReference ONX_Model::ModelGeometryFromId ( ON_UUID  model_geometry_component_id) const

Description: Find a model geometry component from Id Parameters: model_geometry_component_id - [in] Returns: If there is a model geometry component with the id, it is returned. Otherwise, ON_ModelComponentReference::Empty is returned.

◆ ModelToOriginalMap()

const ON_ManifestMap& ONX_Model::ModelToOriginalMap ( ) const

Returns: A map from manifest=model index and id to original component index and id. Remarks: ON_ManifestMapItem Source = model-manifest index and id. ON_ManifestMapItem Destination = original component index and id.

◆ OriginalToModelMap()

const ON_ManifestMap& ONX_Model::OriginalToModelMap ( ) const

Returns: A map from original component index and id to manifest=model index and id. Remarks: ON_ManifestMapItem Source = original component index and id. ON_ManifestMapItem Destination = model-manifest index and id.

◆ Read() [1/6]

bool ONX_Model::Read ( const char *  filename,
ON_TextLog error_log = nullptr 
)

◆ Read() [2/6]

bool ONX_Model::Read ( const char *  filename,
unsigned int  table_filter,
unsigned int  model_object_type_filter,
ON_TextLog error_log 
)

◆ Read() [3/6]

bool ONX_Model::Read ( const wchar_t *  filename,
ON_TextLog error_log = nullptr 
)

◆ Read() [4/6]

bool ONX_Model::Read ( const wchar_t *  filename,
unsigned int  table_filter,
unsigned int  model_object_type_filter,
ON_TextLog error_log 
)

◆ Read() [5/6]

bool ONX_Model::Read ( ON_BinaryArchive archive,
ON_TextLog error_log = nullptr 
)

◆ Read() [6/6]

bool ONX_Model::Read ( ON_BinaryArchive archive,
unsigned int  table_filter,
unsigned int  model_object_type_filter,
ON_TextLog error_log 
)

Description: Reads an openNURBS archive and saves the information in this model Parameters: 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. Returns: true if archive is read with no error. False if errors occur. Error details are logged in error_log. If crc errors are in the archive, then ONX_Model::m_crc_error_count is set to the number of crc errors. Example:

/ for ASCII file names const char* sFileName = ....; FILE* fp = ON::OpenFile( sFileName, "rb");

/ for UNICODE file names const wchar_t* wsFileName = ....; FILE* fp = ON::OpenFile( wsFileName, L"rb");

bool bModelRead = false; bool bModelIsValid = false;

ON_TextLog error_log; ONX_Model model;

if ( 0 != fp ) { ON_BinaryFile archive( ON::archive_mode::read3dm, fp ); bModelRead = model.Read( archive, error_log ); ON::CloseFile( fp ); }

if ( bModelRead ) { bModelIsValid = model.Validate(error_log); }

See Also: ONX_Model::IsValid ONX_Model::Write ONX_Model::m_crc_error_count

◆ RemoveModelComponent()

ON_ModelComponentReference ONX_Model::RemoveModelComponent ( ON_ModelComponent::Type  component_type,
ON_UUID  component_id 
)

◆ RenderLightBoundingBox()

ON_BoundingBox ONX_Model::RenderLightBoundingBox ( ) const

Returns: Bounding box of every render light in m_light_table[].

◆ RenderMaterialFromAttributes()

ON_DEPRECATED ON_ModelComponentReference ONX_Model::RenderMaterialFromAttributes ( const ON_3dmObjectAttributes ) const

◆ RenderMaterialFromId()

ON_DEPRECATED ON_ModelComponentReference ONX_Model::RenderMaterialFromId ( ON_UUID  ) const

◆ RenderMaterialFromIndex()

ON_DEPRECATED ON_ModelComponentReference ONX_Model::RenderMaterialFromIndex ( int  ) const

◆ RenderMaterialFromLayerIndex()

ON_DEPRECATED ON_ModelComponentReference ONX_Model::RenderMaterialFromLayerIndex ( int  ) const

These methods are deprecated due to the use of the phrase 'RenderMaterial' which now refers to materials provided by the RDK. The materials used by these methods are plain ON_Materials.

◆ Reset()

void ONX_Model::Reset ( )

◆ SetCurrentDimensionStyleId()

bool ONX_Model::SetCurrentDimensionStyleId ( ON_UUID  dimension_style_id)

Parameters: dimension_style_id - [in] Id of a dimension style in this model, a system dimension style, or ON_nil_uuid. Returns: true if dimension_style_id is valid and is set.

◆ SetDocumentUserString()

bool ONX_Model::SetDocumentUserString ( const wchar_t *  key,
const wchar_t *  string_value 
)

BEGIN model document level user string tools Description: Attach a user string to the document. Parameters: key - [in] id used to retrieve this string. string_value - [in] If nullptr, the string with this id will be removed. Returns: True if successful.

◆ UsesIDef()

int ONX_Model::UsesIDef ( const ON_InstanceRef iref,
ON_UUID  idef_uuid 
) const

Description: See if the instance reference iref refers to an instance definition. Parameters: iref - [in] idef_uuid - [in] id of idef we are looking for Returns: @untitled table 0 iref does not use idef 1 iref directly references idef >1 iref has a nested reference to idef (nesting depth returned) -1 iref.m_instance_definition_uuid is not valid -2 invalid idef found

◆ ValdateComponentIdAndName()

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

◆ WireframeColorFromAttributes()

ON_Color ONX_Model::WireframeColorFromAttributes ( const ON_3dmObjectAttributes attributes) const

Description: Get wireframe drawing color from object attributes. Parameters: attributes - [in] object attributes. Returns: Wireframe drawing color.

◆ Write() [1/3]

bool ONX_Model::Write ( const char *  filename,
int  version = 0,
ON_TextLog error_log = nullptr 
) const

Description: Writes contents of this model to an openNURBS archive.

Parameters: 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.

Returns: True if archive is written with no error. False if errors occur. Error details are logged in error_log.

◆ Write() [2/3]

bool ONX_Model::Write ( const wchar_t *  filename,
int  version = 0,
ON_TextLog error_log = nullptr 
) const

Description: Writes contents of this model to an openNURBS archive.

Parameters: 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.

Returns: True if archive is written with no error. False if errors occur. Error details are logged in error_log.

◆ Write() [3/3]

bool ONX_Model::Write ( ON_BinaryArchive archive,
int  version = 0,
ON_TextLog error_log = nullptr 
) const

Description: Writes contents of this model to an openNURBS archive.

Parameters: 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.

Returns: True if archive is written with no error. False if errors occur. Error details are logged in error_log.

Example:

      model = ...;
      if ( model.IsValid( error_log ) )
      {
        const wchar_t* wsFileName = ....;
        FILE* fp = ON::OpenFile( wsFileName, L"wb");

        bool ok = false;
        if ( 0 != fp )
        {
          const char* sStartSectionComment = "...";
          int version = 5; ///< 2, 3, 4 or 5 are valid
          ON_BinaryFile archive( ON::archive_mode::write3dm, fp );
          archive.SetArchiveFullPath(wsFileName);
          ok = model.write( archive, 
                            version, 
                            sStartSectionComment, 
                            error_log );
          ON::CloseFile( fp );
        }
     }

Friends And Related Function Documentation

◆ ONX_ModelComponentIterator

friend class ONX_ModelComponentIterator
friend

◆ ONX_ModelPrivate

friend class ONX_ModelPrivate
friend

< Private extension.

Member Data Documentation

◆ m_3dm_file_byte_count

ON__UINT64 ONX_Model::m_3dm_file_byte_count = 0

◆ m_3dm_file_version

int ONX_Model::m_3dm_file_version = 0

3dm archive start section information

BEGIN model definitions

◆ m_3dm_opennurbs_version

unsigned int ONX_Model::m_3dm_opennurbs_version = 0

◆ m_properties

ON_3dmProperties ONX_Model::m_properties

Properties include revision history, notes, information about the application that created the file, and an optional preview image.

◆ m_settings

ON_3dmSettings ONX_Model::m_settings

Settings include tolerance, and unit system, and defaults used for creating views and objects.

◆ m_sStartSectionComments

ON_String ONX_Model::m_sStartSectionComments

◆ m_userdata_table

ON_SimpleArray<ONX_Model_UserData*> ONX_Model::m_userdata_table