Properties
Number of items in the instance definitions table, excluding deleted definitions.
Overrides: CommonComponentTable<T>.ComponentType
Indexers
this[]
#Conceptually, the InstanceDefinition table is an array of Instance definitions. The operator[] can be used to get individual instance definition. An instance definition is either active or deleted and this state is reported by IsDeleted or will be null if it has been purged from the document.
Returns: The instance definition at the specified index.
Methods
Adds an instance definition to the instance definition table.
public int Add()
name,
The definition name.
description,
The definition description.
basePoint,
A base point.
geometry,
An element.
attributes
An attribute.
Returns: >=0 index of instance definition in the instance definition table. -1 on failure.
Adds an instance definition to the instance definition table, optionally replacing an existing definition of the same name.
public int Add()
name,
The definition name.
description,
The definition description.
basePoint,
A base point.
geometry,
An array, a list or any enumerable set of geometry.
attributes,
An array, a list or any enumerable set of attributes.
overrideExisting
If true and a definition with this name exists, its geometry and description are replaced. The definition keeps its index, id, name, URL and user data, and every existing instance reference keeps its transform. Linked and reference definitions cannot be replaced this way, and -1 is returned for those, as it is for geometry that would make the definition reference itself. If false, a name already in use is an error: -1 is returned and a message naming the definition is printed to the command line.
Returns: >=0 index of instance definition in the instance definition table. -1 on failure.
Adds an instance definition to the instance definition table.
public int Add()
name,
The definition name.
description,
The definition description.
basePoint,
A base point.
geometry,
An array, a list or any enumerable set of geometry.
attributes
An array, a list or any enumerable set of attributes.
Returns: >=0 index of instance definition in the instance definition table. -1 on failure.
Adds an instance definition to the instance definition table.
public int Add()
name,
The definition name.
description,
The definition description.
basePoint,
A base point.
geometry
An array, a list or any enumerable set of geometry.
Returns: >=0 index of instance definition in the instance definition table. -1 on failure.
Adds an instance definition to the instance definition table, optionally replacing an existing definition of the same name.
public int Add()
name,
The definition name.
description,
The definition description.
url,
A URL or hyperlink. When overriding, null leaves the existing value unchanged and an empty string clears it.
urlTag,
A description of the URL or hyperlink. When overriding, null leaves the existing value unchanged and an empty string clears it.
basePoint,
A base point.
geometry,
An array, a list or any enumerable set of geometry.
attributes,
An array, a list or any enumerable set of attributes.
overrideExisting
If true and a definition with this name exists, its geometry, description and URL are replaced. The definition keeps its index, id, name and user data, and every existing instance reference keeps its transform. Linked and reference definitions cannot be replaced this way, and -1 is returned for those, as it is for geometry that would make the definition reference itself. If false, a name already in use is an error: -1 is returned and a message naming the definition is printed to the command line.
Returns: >=0 index of instance definition in the instance definition table. -1 on failure.
Adds an instance definition to the instance definition table.
public int Add()
name,
The definition name.
description,
The definition description.
url,
A URL or hyperlink.
urlTag,
A description of the URL or hyperlink.
basePoint,
A base point.
geometry,
An array, a list or any enumerable set of geometry.
attributes
An array, a list or any enumerable set of attributes.
Returns: >=0 index of instance definition in the instance definition table. -1 on failure.
Clear
Marks all items as deleted.
public void Clear()
Purge deleted instance definition information that is not in use. This function is time consuming and should be used in a thoughtful manner.
public void Compact()
ignoreUndoReferences
If false, then deleted instance definition information that could possibly be undeleted by the Undo command will not be deleted. If true, then all deleted instance definition information is deleted.
Creates an instance definition by reading a file, the way the Insert command does when inserting a file as a block. No instance reference is created.
public int CreateFromFile()
filename,
The name of the file to read. This can be any type of file that Rhino or a plug-in can read.
name,
The name of the instance definition to create. This must be a valid name.
updateType,
The type of instance definition to create.
layerStyle,
How layers from the file appear in the model. This is used only when updateType is InstanceDefinitionUpdateType.Linked.
conflictResolution,
What to do when the model already contains an instance definition named name.
skipNestedLinkedDefinitions
If true, then linked instance definitions nested in the file are not read.
Returns: The index of the new instance definition, or the index of an existing linked instance definition that already references filename. -1 on error.
Creates an instance definition by reading a file, the way the Insert command does when inserting a file as a block. No instance reference is created.
public int CreateFromFile()
filename,
The name of the file to read. This can be any type of file that Rhino or a plug-in can read.
name,
The name of the instance definition to create. This must be a valid name.
description,
The description of the instance definition. If null or empty, then the notes of the file being read, if any, are used.
url,
The URL of the instance definition. If null or empty, then the model URL of the file being read, if any, is used.
urlTag,
The URL description, or hyperlink text, of the instance definition. If null or empty, then the model URL of the file being read, if any, is used.
updateType,
The type of instance definition to create.
layerStyle,
How layers from the file appear in the model. This is used only when updateType is InstanceDefinitionUpdateType.Linked.
conflictResolution,
What to do when the model already contains an instance definition named name.
skipNestedLinkedDefinitions
If true, then linked instance definitions nested in the file are not read.
Returns: The index of the new instance definition, or the index of an existing linked instance definition that already references filename. -1 on error.
Deletes the instance definition. This deletes all references too.
Returns: True on success.
Overrides: CommonComponentTable<T>.Delete
Deletes the instance definition.
public bool Delete()
idefIndex,
zero based index of instance definition to delete. This must be in the range 0 <= idefIndex < InstanceDefinitionTable.Count.
deleteReferences,
true to delete all references to this definition. false to delete definition only if there are no references.
quiet
If true, no warning message box appears if an instance definition cannot be deleted because it is the current layer or it contains active geometry.
Returns: true if successful. false if the instance definition has active references and bDeleteReferences is false.
Destroys all source archive information. Specifically:
- InstanceDefinitionGeometry.SourceArchive is set to the empty string.
- SourceRelativePath is set to false
- The alternative source archive path is set to the empty string.
- Checksum.Zero() is used to private destroy all checksum information.
- InstanceDefinition.UpdateType is set to InstanceDefinitionUpdateType.Static.
public bool DestroySourceArchive()
definition,
The instance definition to be modified.
quiet
If true, then message boxes about erroneous parameters will not be shown.
Returns: Returns true if the definition was successfully modified otherwise returns false.
Exports the block definition's component objects to one of the file formats supported by Rhino.
Finds the instance definition with a given id.
public InstanceDefinition Find()
instanceId,
Unique id of the instance definition to search for.
ignoreDeletedInstanceDefinitions
true means don't search deleted instance definitions.
Returns: The specified instance definition, or null if nothing matching was found.
Finds the instance definition with a given name.
public InstanceDefinition Find()
instanceDefinitionName,
name of instance definition to search for (ignores case)
ignoreDeletedInstanceDefinitions
true means don't search deleted instance definitions.
obsoleteignoreDeletedInstanceDefinitions is now redundant. Remove the second argument. Definitions are now always deleted permanently.
Returns: The specified instance definition, or null if nothing matching was found.
Finds the instance definition with a given name.
Returns: The specified instance definition, or null if nothing matching was found.
FindId
Uses the guid to find a model component. Deleted objects cannot be found by id. The guid is the value that is stored in the .Id property. In a single document, no two active objects have the same guid. If an object is replaced with a new object, then the guid persists. For example, if the _Move command moves an object, then the moved object inherits its guid from the starting object. If the Copy command copies an object, then the copy gets a new guid. This guid persists through file saving/opening operations. This function will not find grip objects.
Returns: Reference to the rhino object with the objectId or null if no such object could be found.
Implements: FindId
Overrides: CommonComponentTable<T>.GetEnumerator
Gets an array of instance definitions.
Returns: An array of instance definitions. This can be empty, but not null.
Gets unused instance definition name used as default when creating new instance definitions.
Returns: An unused instance definition name string.
Gets unused instance definition name used as default when creating new instance definitions.
[CLSCompliant(false)]
public string GetUnusedInstanceDefinitionName()
root,
The returned name is 'root nn' If root is empty, then 'Block' (localized) is used.
defaultSuffix
Unique names are created by appending a decimal number to the localized term for "Block" as in "Block 01", "Block 02", and so on. When defaultSuffix is supplied, the search for an unused name begins at "Block suffix".
obsoleteThe defaultSuffix parameter is now ignored. Remove the second argument.
Returns: An unused instance definition name string.
Gets unused instance definition name used as default when creating new instance definitions.
Returns: An unused instance definition name string.
Get the index of the instance definition with a given id.
Returns: index > -1 if instance definition was found.
Obsolete method that always returns false. Marks the source path for a linked instance definition as relative or absolute.
public bool MakeSourcePathRelative()
idef,
The instance definition to be marked.
relative,
If true, the path should be considered as relative.
If false, the path should be considered as absolute.
quiet
If true, then message boxes about erroneous parameters will not be shown.
obsoleteSource paths are always absolute at runtime. They cannot be changed.
Returns: true if the instance definition could be modified.
Modifies the instance definition name and description. Does not change instance definition ID or geometry.
public bool Modify()
idef,
The instance definition to be modified.
newName,
The new name.
newDescription,
The new description string.
quiet
If false, information message boxes pop up when illegal changes are attempted.
Returns: true if successful.
Modifies the instance definition name, description, and url. Does not change instance definition ID or geometry.
public bool Modify()
idef,
The instance definition to be modified.
newName,
The new name.
newDescription,
The new description string.
newUrl,
The new URL or hyperlink.
newUrlTag,
The new description of the URL or hyperlink.
quiet
If false, information message boxes pop up when illegal changes are attempted.
Returns: true if successful.
Modifies the instance definition name and description. Does not change instance definition ID or geometry.
Returns: true if successful.
Modifies the instance definition name, description, and url. Does not change instance definition ID or geometry.
public bool Modify()
idefIndex,
The index of the instance definition to be modified.
newName,
The new name.
newDescription,
The new description string.
newUrl,
The new URL or hyperlink.
newUrlTag,
The new description of the URL or hyperlink.
quiet
If false, information message boxes pop up when illegal changes are attempted.
Returns: true if successful.
Modifies the instance definition user data. Does not change instance definition ID or geometry.
Returns: true if successful.
Modifies the instance definition geometry and replaces all references to the current definition with references to the new definition.
public bool ModifyGeometry()
idefIndex,
The index of the instance definition to be modified.
newGeometry,
The new geometry.
newAttributes
The new attributes.
Returns: true if operation succeeded.
Modifies the insertion plane of an instance definition. The definition's geometry is re-origined so that the supplied plane becomes the new insertion plane - its origin is the new insertion point and its axes become the definition's axes. Existing instance references are not modified, so they will appear to move. Only embedded instance definitions are supported; the function returns false for linked definitions.
Returns: true if operation succeeded.
Modifies the insertion point of an instance definition. The definition's geometry is re-origined so that the supplied point becomes the new insertion point - the point that aligns with the insertion location when the block is inserted. Existing instance references are not modified, so they will appear to move. Only embedded instance definitions are supported; the function returns false for linked definitions.
Returns: true if operation succeeded.
If the instance definition is linked or embedded, use SetSource to specify the source archive.
public bool ModifySourceArchive()
idefIndex,
The index of the instance definition to be modified.
sourceArchive,
The new source archive file name.
updateType,
quiet
If true, then message boxes about erroneous parameters will not be shown.
Returns: Returns true if the definition was successfully modified otherwise returns false.
If the instance definition is linked or embedded, use SetSource to specify the source archive.
public bool ModifySourceArchive()
idefIndex,
The index of the instance definition to be modified.
sourceArchive,
The new source archive file name.
updateType,
layerStyle,
The layer style to apply when
updateType is InstanceDefinitionUpdateType.Linked. Pass InstanceDefinitionLayerStyle.None to use the default layer style, which is InstanceDefinitionLayerStyle.Reference. This parameter is ignored for all other update types.quiet
If true, then message boxes about erroneous parameters will not be shown.
Remarks: A linked instance definition does not remember its layer style once it has been changed to another update type. Use this overload to restore the layer style when changing an instance definition back to InstanceDefinitionUpdateType.Linked.
Returns: Returns true if the definition was successfully modified otherwise returns false.
If the instance definition is linked or embedded, use SetSource to specify the source archive.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ModifySourceArchive()
idefIndex,
The index of the instance definition to be modified.
sourceArchive,
The new source archive file name.
updateType,
quiet
If true, then message boxes about erroneous parameters will not be shown.
obsoleteUse the overload taking a FileReference.
Returns: Returns true if the definition was successfully modified otherwise returns false.
Purges an instance definition and its definition geometry.
Returns: True if successful. False if the instance definition cannot be purged because it is in use by reference objects or undo information.
Purges any unused instance definitions.
Returns: The number of unused instance definitions that were purged.
Reload linked block definitions and update the Rhino display.
Returns: Returns true if the linked file was successfully read and updated.
Undeletes an instance definition that has been deleted by Delete()
Returns: true if successful
Restores the instance definition to its previous state, if the instance definition has been modified and the modification can be undone.
Returns: true if operation succeeded.
Read the objects from a file and use them as the instance's definition geometry.
public bool UpdateLinkedInstanceDefinition()
idefIndex,
zero based index of instance definition to delete. This must be in the range 0 <= idefIndex < InstanceDefinitionTable.Count.
filename,
name of file (can be any type of file that Rhino or a plug-in can read)
updateNestedLinks,
If true and the instance definition references to a linked instance definition, that needs to be updated, then the nested definition is also updated. If false, nested updates are skipped.
quiet