Rhino C++ API
8.14
|
#include <rhinoSdkFileOptions.h>
Static Public Attributes | |
static const CRhinoFileReadOptions | ImportModelDefaults |
static const CRhinoFileReadOptions | ImportReferenceModelDefaults |
static const CRhinoFileReadOptions | OpenModelDefaults |
static const CRhinoFileReadOptions | OpenTemplateDefaults |
static const CRhinoFileReadOptions | Unset |
Friends | |
class | CRhFileReadOptions |
|
strong |
Enumerator | |
---|---|
ImportMode | If you need to make any additions or changes to these enum values, then please read comment in
|
OpenMode | OpenMode: true means we are reading the information into an empty document. This means you need to consider things like:
|
NewMode | NewMode: (default = false) true means we are reading template information in something like a OnFileNew event. |
InsertMode | InsertMode: true means we are reading information that will be used to create an instance definition or some other type of "inserting" that is supported by Rhino's "Insert" command. |
ImportReferenceMode | ImportReferenceMode: (default = false) true means we are reading information for a work session reference model or a linked instance definition. |
BatchMode | BatchMode: (default = false) true means you cannot ask questions during reading. (no dialogs, no "getters", etc.) |
UseScaleGeometry | UseScaleGeometry: (default = true) If this parameter is true, then no questions are asked when unit conversion scaling is optional and the setting specified by ScaleGeometry is used. |
ScaleGeometry | ScaleGeometry: (default = true) true: If ImportMode is true and the geometry in the file being read has a unit system different from the model's unit system, then apply the unit conversion scale to the file's geometry before adding it to the model. false: Do not scale. Once case where this happens is when an instance definition is read from a file and the model space instance references have been scaled. In case the instance definition geometry cannot be scaled or the net result is that the size of the instance reference object is scaled by the square of the scale factor. |
ScriptUpdateEmbededInstanceDefinitions | ScriptUpdateEmbededInstanceDefinitions: (default = true) When an embedded instance definition is out of date, settings in document properties and on the instance definition control if the idef is not updated, automatically updated, or the user is asked if they want to update. In the case where the settings indicate the user should be asked, but BatchMode is true (and we can't ask), we need to have an automatic way to decide what to do. In this case (BatchMode = true and doc/idef settings indicate user should be asked, the value of ScriptUpdateEmbededInstanceDefinitions mode is used to decide if the out-of-date instance definitions should be updated. If this is confusing, then use the default (=true) setting. |
UpdatingExistingInstanceDefinitions | UpdatingExistingInstanceDefinitions: (default = false) Set to true when an existing instance definition is being updated and when instance definition name collisions occur, the existing instance definition should be silently updated. |
ModeCount |
CRhinoFileReadOptions::CRhinoFileReadOptions | ( | ) |
plug-in developers: Avoid creating local CRhinoFileReadOptions classes Instead use const CRhinoFileReadOptions& RhinoApp().FileReadOptions() when you need the current file reading options.
CRhinoFileReadOptions::CRhinoFileReadOptions | ( | bool | bImport | ) |
CRhinoFileReadOptions::CRhinoFileReadOptions | ( | const CRhinoFileReadOptions & | ) |
CRhinoFileReadOptions::~CRhinoFileReadOptions | ( | ) |
const class ON_ManifestMap& CRhinoFileReadOptions::ArchiveToModelIdentificationMap | ( | ) | const |
Description: ArchiveToModelIdentificationMap() returns a mapping from archive (file) identification (component type, index, id) to model component identification.
CRhinoDoc* CRhinoFileReadOptions::DestinationDocument | ( | ) | const |
Returns: CRhinoDoc::FromRuntimeSerialNumber(DestinationDocumentSerialNumber()); Remarks: You must check for a nullptr before dereferencing the returned pointer.
unsigned int CRhinoFileReadOptions::DestinationDocumentSerialNumber | ( | ) | const |
Returns: The runtime serial number of the CRhinoDoc that is the destination of the information read from the file.
Example:
CRhinoDoc* doc = CRhinoDoc::FromRuntimeSerialNumber(fro.DestinationDocumentSerialNumber()); if (nullptr == doc) ... no destination document ... else ...
int CRhinoFileReadOptions::ExistingLayerNameMatchingStyle | ( | ) | const |
Description: When some sort if import is happening (import, paste, insert, ...) this setting controls how Rhino looks for maching existing layers. The Returns: 0: Use full path layer name from file. 1: If there is already an active layer with the same short name, then use it. For example, if the current model has a layer tree that looks like X Y Z
and the file being read has a layer tree that looks like P Q X Y Z
then the file object on file layer P::X ends up on model layer X, the file objects on file layer Y end up on on model layer X::Y and the file objects on file layer Y::Z end up on model layer X::Z. Remarks: When a worksession reference model is being read, 0 is always returned. When a linked instance definition reference model is being read, the value of ON_InstanceDefinition::m_idef_layer_style determines what value this function returns. Otherwise, the value returned by RhinoApp().AppSettings().ImportFileLayerMatchingOption() determines what value this function returns.
bool CRhinoFileReadOptions::GetFileAlias | ( | ON_wString & | file_alias | ) | const |
Description: The file alias is generally the same as the file name with extension, but sometimes includes some portion of the directory path to avoid confusion when ther are several files in play with the same name. This string is used in user interface to identify the file when the absolute path name is too long to be useful and can be found someplace else in the user interface. Parameters: file_alias - [out] Returns: True if an alias existed.
bool CRhinoFileReadOptions::GetFileName | ( | ON_wString & | file_name | ) | const |
Parameters: file_name - [out] The file name, including the extension. Does not include drive or directory information. Returns: True if the value was returned.
bool CRhinoFileReadOptions::GetFullPath | ( | ON_wString & | full_path | ) | const |
Parameters: full_path - [out] Absolute path to the file, including the drive, directory and file name with extension. Returns: True if the full path is available. False if not.
* int CRhinoFileReadOptions::GetMissingLinkedFileQueryAction | ( | ) | const |
linked blocks to FileReadOptions rh-28779 Description: Sets or returns the current answer to the question of Ignoring missing linked block files asked while reading a 3dm file. In particular, if a user has already answered yes to all (rc_yes_to_all) no to all (rc_no_to_all), don't ask again.
Description: This function is provided for plug-ins to use when their CRhinoPlugIn::ReadDocument() function is called and they need to convert Rhino document item ids used in a .3dm file that was just read into the Rhino document item ids used in the runtime model.
When a file is read, sometimes is is necessary to change the id of an item in a file to a new id in the runtime model. This often happens when one file is being imported into an existing document and an id found in the file is already in use in the existing document. An "item" can be anything in a table, like a layer, material, dimension style, geometry object, instance definition, and so on. Parameters: file_item_id - [in] id used for the item in the .3dm file being read. model_item_id - [out] id used to for the item in the runtime model See Also: CRhinoFileReadOptions::ArchiveToModelIdentificationMap()
bool CRhinoFileReadOptions::GetReferenceModelComponentName | ( | const wchar_t * | original_name, |
ON_wString & | reference_component_name | ||
) | const |
Description: When reference information is imported, name of model components like annotation styles, hatch patterns, block definitions, ..., have a reference prefix prepended to the original name. Parameters: original_name - [in] reference_component_name - [out] both parameters can be the same string. Example: If a block definition named "X" is in a reference file named C.3dm, then the reference_component_name will be "C.3dm : X". If the component is being read from a nested linked instance definition, the reference_component_name will be something like "A.3dm>B.3dm>C.3dm : X"
Returns: True if reference_component_name name was modified by prepending a prefix. False if reference_component_name is identical to original_name.
unsigned int CRhinoFileReadOptions::InstanceDefinitionSerialNumber | ( | ) | const |
Returns: 0: Reading the active model. >0: Serial number of an instance definition based on the contents of the file being read. When an instance definition is being created, the instance definition may be of any type (static_def, linked_and_embedded_def, or linked_def). When an instance definition is being updated, the instance definition can be linked_and_embedded_def, or linked_def.
ON_InstanceDefinition::eLinkedComponentAppearance CRhinoFileReadOptions::LinkedInstanceDefinitionLayerStyle | ( | ) | const |
Returns: 0: unset 1: active Use short name to find a matching active layer. If none is found, then create the layer using the full path as an active layer (no grandparent layer). 2: reference Put the idef Remarks: When a linked instance definition is being read in an active model, then this returns the value of ON_InstanceDefinition.m_idef_layer_style for the idef. Note that simple layer names
unsigned int CRhinoFileReadOptions::LinkedInstanceDefinitionSerialNumber | ( | ) | const |
Returns: 0: Not reading a linked instance definition. >0: Serial number of a linked instance definition being read or one that is being updated. For example, if a linked and embedded idef is being updated and it is nested inside of a linked idef, then this function will return the serial number of the linked idef.
RhinoYesNoResponse CRhinoFileReadOptions::LookForMissingFile | ( | ) | const |
bool CRhinoFileReadOptions::Merge | ( | ) | const |
Returns: true: The information being read is being merged into the existing document. This happens in a number of cases including but not limited to reading work session reference files, reading instance definitions, anything done by the Insert command, harvesting various things like materials, page layouts, annotation styles and hatch patterns from files. false: The information being read is being used to create a new document. Remarks: This is identical to the Mode(CRhinoFileReadOptions::ModeFlag::ImportMode) setting.
bool CRhinoFileReadOptions::Mode | ( | ModeFlag | mode_to_check | ) | const |
Description: Check which modes are enabled for file reading.
More than one mode can be enabled for a file read. Parameters: mode_to_check - [in] Example: bool bImportMode = file_options.Mode(CRhinoFileReadOptions::ModeFlag::ImportMode ); bool bOpenMode = file_options.Mode(CRhinoFileReadOptions::ModeFlag::OpenMode ); bool bNewMode = file_options.Mode(CRhinoFileReadOptions::ModeFlag::NewMode ); bool bBatchMode = file_options.Mode(CRhinoFileReadOptions::ModeFlag::BatchMode ); Returns: TRUE if mode_to_check is active. See Also: ReadingTemplateFile(), ReadingPrimaryFile(), ReadingTemplateFile()
ON_UnitSystem CRhinoFileReadOptions::ModelUnitSystem | ( | ) | const |
Returns: The model space unit system used by the model the file is being read into. Remarks: When the ScaleGeometry mode setting is false, do not apply unit system scaling.
double CRhinoFileReadOptions::ModelUnitSystemScale | ( | ON::LengthUnitSystem | file_unit_system | ) | const |
Parameters: file_unit_system - [in] unit system for an object read from the file Returns: The unit system conversion scale factor to apply to model space objects from the file. Remarks: When the ScaleGeometry mode setting is false, do not apply unit system scaling.
double CRhinoFileReadOptions::ModelUnitSystemScale | ( | ON_UnitSystem | file_unit_system | ) | const |
Parameters: file_unit_system - [in] unit system for an object read from the file Returns: The unit system conversion scale factor to apply to model space objects from the file. Remarks: When the ScaleGeometry mode setting is false, do not apply unit system scaling.
bool CRhinoFileReadOptions::NoUserInterfaceQuestions | ( | ) | const |
Returns: true: You may not ask any questions while the the file is being read. Specifically, no dialogs and no "getter" prompts are permitted. This happens in a number of cases including situations where files are being "batch mode" processed and users will be grumpy if they start a long job, go home, and return the next morning to discover their job didn't finish because you interrupted the reading to ask a question. false: You may ask the user questions. Remarks: This is identical to the Mode(CRhinoFileReadOptions::ModeFlag::BatchMode) setting.
CRhinoFileReadOptions& CRhinoFileReadOptions::operator= | ( | const CRhinoFileReadOptions & | ) |
ON_ArchivableDictionary& CRhinoFileReadOptions::OptionsDictionary | ( | ) |
Description: Additional options relative to the specific file format the read operation will be about. Returns: return a ON_ArchivableDictionary reference with the options.
* const ON_ArchivableDictionary& CRhinoFileReadOptions::OptionsDictionary | ( | ) | const |
Description: Additional options relative to the specific file format the current read operation is about. Returns: return a const ON_ArchivableDictionary reference with the options.
ON_UUID CRhinoFileReadOptions::ReaderId | ( | ) | const |
Returns: id that identifies what is doing the reading. If RhinoApp().IsRhinoUUID(id) is true, then Rhino is reading a Rhino model (typically .3dm file).
If id is not nill and RhinoApp().IsRhinoUUID(id) is false, then the id identifies the CRhinoPlugIn that is reading the file.
bool CRhinoFileReadOptions::ReadingPrimaryFile | ( | ) | const |
Returns: True means an empty document is being filled with the contents of the file during something like an "Open" Remarks: Exactly one of ReadingTemplateFile(), ReadingPrimaryFile(), or ReadingSecondaryFile() is true.
bool CRhinoFileReadOptions::ReadingReferenceModel | ( | ) | const |
Returns: True if a reference model is being read. This is always the case for worksession reference models and linked instance definitions. It may happen in other less common situations.
bool CRhinoFileReadOptions::ReadingRhinoModel | ( | ) | const |
Returns: True if a Rhino model (typically a .3dm file) is being read. False otherwise.
bool CRhinoFileReadOptions::ReadingSecondaryFile | ( | ) | const |
Returns: True means something like an import or insert or worksession reference file is being read into an existing document. Remarks: Exactly one of ReadingTemplateFile(), ReadingPrimaryFile(), or ReadingSecondaryFile() is true.
int CRhinoFileReadOptions::ReadingStatus | ( | ) | const |
Returns: 0: no stuatus 1: reading in progress 2: reading initial file successful 3: updating linked idefs found in this file 99: reading finished successfully 100: reading failed.
bool CRhinoFileReadOptions::ReadingTemplateFile | ( | ) | const |
Returns: True if a template file is being read during something like a "New" Remarks: Exactly one of ReadingTemplateFile(), ReadingPrimaryFile(), or ReadingSecondaryFile() is true.
const ON_wString CRhinoFileReadOptions::ReferanceModelComponentNamePrefix | ( | bool | bAppendReferenceNameSeparator | ) | const |
Parameters: bAppendReferenceNameSeparator - [in] If true and the reference prefix is not empty, then ON_ModelComponent::NameReferenceDelimiter (" : ") is append to the returned string. Returns: If a reference model is being read, the prefix for reference model components. Otherwise, empty string.
ON_UUID CRhinoFileReadOptions::ReferenceModelGrandParentLayerId | ( | ) | const |
Description: Information that ultimately is part of a work session reference model or linked instance definition model is being read, all layers are added as sub-layers of a grand-parent layer. When the information being read is destined for the active model, no grand parent layer is used. Returns: nil: no grand parent layer is in use. non-nil: id of grand parent layer.
unsigned int CRhinoFileReadOptions::RhinoArchiveOpenNURBSVersion | ( | ) | const |
Returns: 0: Not reading a Rhino file. >0: opernnurbs version Remarks: The hight bit of the version number is typically set. Do not cast this value as an int.
unsigned int CRhinoFileReadOptions::RhinoArchiveVersion | ( | ) | const |
Returns: 0: Not reading a Rhino file. 1: Reading a Rhino 1 file. 2: Reading a Rhino 2 file. 3: Reading a Rhino 3 file. 4: Reading a Rhino 4 file. 5: Reading a 32-bit Rhino 5 file (file size limited to 4GB) 50: Reading a 64-bit Rhino 5 file 60: Reading a Rhino 6 file ...
bool CRhinoFileReadOptions::SetDestinationDocument | ( | const CRhinoDoc * | destination_document | ) |
Parameters: destination_document - [in] The CRhinoDoc that is the destination of the information read from the file. Returns: True if the destination document was set. False if the caller attempted to change the destination from one document to another.
void CRhinoFileReadOptions::SetLookForMissingFile | ( | RhinoYesNoResponse | look_for_missing_file | ) |
* void CRhinoFileReadOptions::SetMissingLinkedFileQueryAction | ( | int | action | ) |
void CRhinoFileReadOptions::SetMode | ( | ModeFlag | mode_to_set, |
bool | bEnabled | ||
) |
Description: Set modes for file reading.
More than one mode can be enabled for a file read. Parameters: mode_to_set - [in] bEnabled - [in] Example: / set batch import mode file_options.SetMode(CRhinoFileReadOptions::ModeFlag::ImportMode, TRUE ); file_options.SetMode(CRhinoFileReadOptions::ModeFlag::BatchMode, TRUE );
ON_UnitSystem CRhinoFileReadOptions::SourceModelUnitSystem | ( | ) | const |
Returns: The model space unit system used by the model the file is being read out of (in the case of import, insert etc). Remarks: When the ScaleGeometry mode setting is false, do not apply unit system scaling.
unsigned int CRhinoFileReadOptions::WorkSessionReferenceModelSerialNumber | ( | ) | const |
Returns: 0: Information being read will be added to the active model. >0: Serial number of a work session reference model based on the contents of the file being read.
|
friend |
|
static |
|
static |
|
static |
|
static |
|
static |