Properties

ActiveCount

#Since v5.0
public int ActiveCount { get; }
Number of items in the instance definitions table, excluding deleted definitions.

ComponentType

#Since v6.0
public override ModelComponentType ComponentType { get; }

Count

#Since v5.0
public override int Count { get; }
Number of items in the instance definitions table.

Document

#Since v5.0
public RhinoDoc Document { get; }
Document that owns this table.

Indexers

this[]

#
public InstanceDefinition this[int index] { get; }
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.
index (int)zero based array index.
The instance definition at the specified index.

Methods

Add

#Since v5.0
public int Add(string name, string description, Point3d basePoint, GeometryBase geometry, ObjectAttributes attributes)
Adds an instance definition to the instance definition table.
name (string)The definition name.
description (string)The definition description.
basePoint (Point3d)A base point.
geometry (GeometryBase)An element.
attributes (ObjectAttributes)An attribute.
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#Since v9.0
public int Add(string name, string description, Point3d basePoint, IEnumerable<GeometryBase> geometry, IEnumerable<ObjectAttributes> attributes, bool overrideExisting)
Adds an instance definition to the instance definition table, optionally replacing an existing definition of the same name.
name (string)The definition name.
description (string)The definition description.
basePoint (Point3d)A base point.
geometry (IEnumerable<GeometryBase>)An array, a list or any enumerable set of geometry.
attributes (IEnumerable<ObjectAttributes>)An array, a list or any enumerable set of attributes.
overrideExisting (bool)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.
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#ExampleSince v5.0
public int Add(string name, string description, Point3d basePoint, IEnumerable<GeometryBase> geometry, IEnumerable<ObjectAttributes> attributes)
Adds an instance definition to the instance definition table.
name (string)The definition name.
description (string)The definition description.
basePoint (Point3d)A base point.
geometry (IEnumerable<GeometryBase>)An array, a list or any enumerable set of geometry.
attributes (IEnumerable<ObjectAttributes>)An array, a list or any enumerable set of attributes.
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#ExampleSince v5.0
public int Add(string name, string description, Point3d basePoint, IEnumerable<GeometryBase> geometry)
Adds an instance definition to the instance definition table.
name (string)The definition name.
description (string)The definition description.
basePoint (Point3d)A base point.
geometry (IEnumerable<GeometryBase>)An array, a list or any enumerable set of geometry.
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#Since v9.0
public int Add(string name, string description, string url, string urlTag, Point3d basePoint, IEnumerable<GeometryBase> geometry, IEnumerable<ObjectAttributes> attributes, bool overrideExisting)
Adds an instance definition to the instance definition table, optionally replacing an existing definition of the same name.
name (string)The definition name.
description (string)The definition description.
url (string)A URL or hyperlink. When overriding, null leaves the existing value unchanged and an empty string clears it.
urlTag (string)A description of the URL or hyperlink. When overriding, null leaves the existing value unchanged and an empty string clears it.
basePoint (Point3d)A base point.
geometry (IEnumerable<GeometryBase>)An array, a list or any enumerable set of geometry.
attributes (IEnumerable<ObjectAttributes>)An array, a list or any enumerable set of attributes.
overrideExisting (bool)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.
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#Since v7.0
public int Add(string name, string description, string url, string urlTag, Point3d basePoint, IEnumerable<GeometryBase> geometry, IEnumerable<ObjectAttributes> attributes)
Adds an instance definition to the instance definition table.
name (string)The definition name.
description (string)The definition description.
url (string)A URL or hyperlink.
urlTag (string)A description of the URL or hyperlink.
basePoint (Point3d)A base point.
geometry (IEnumerable<GeometryBase>)An array, a list or any enumerable set of geometry.
attributes (IEnumerable<ObjectAttributes>)An array, a list or any enumerable set of attributes.
>=0 index of instance definition in the instance definition table. -1 on failure.

Clear

public void Clear()
Marks all items as deleted.
inherited fromCommonComponentTable<T>

Compact

#Since v5.9
public void Compact(bool ignoreUndoReferences)
Purge deleted instance definition information that is not in use. This function is time consuming and should be used in a thoughtful manner.
ignoreUndoReferences (bool)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.

CreateFromFile

#Since v9.0
public int CreateFromFile(string filename, string name, InstanceDefinitionUpdateType updateType, InstanceDefinitionLayerStyle layerStyle, InstanceDefinitionNameConflictResolution conflictResolution, bool skipNestedLinkedDefinitions)
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.
filename (string)The name of the file to read. This can be any type of file that Rhino or a plug-in can read.
name (string)The name of the instance definition to create. This must be a valid name.
updateType (InstanceDefinitionUpdateType)The type of instance definition to create.
layerStyle (InstanceDefinitionLayerStyle)How layers from the file appear in the model. This is used only when updateType is InstanceDefinitionUpdateType.Linked.
conflictResolution (InstanceDefinitionNameConflictResolution)What to do when the model already contains an instance definition named name.
skipNestedLinkedDefinitions (bool)If true, then linked instance definitions nested in the file are not read.
The index of the new instance definition, or the index of an existing linked instance definition that already references filename. -1 on error.

CreateFromFile

#Since v9.0
public int CreateFromFile(string filename, string name, string description, string url, string urlTag, InstanceDefinitionUpdateType updateType, InstanceDefinitionLayerStyle layerStyle, InstanceDefinitionNameConflictResolution conflictResolution, bool skipNestedLinkedDefinitions)
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.
filename (string)The name of the file to read. This can be any type of file that Rhino or a plug-in can read.
name (string)The name of the instance definition to create. This must be a valid name.
description (string)The description of the instance definition. If null or empty, then the notes of the file being read, if any, are used.
url (string)The URL of the instance definition. If null or empty, then the model URL of the file being read, if any, is used.
urlTag (string)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 (InstanceDefinitionUpdateType)The type of instance definition to create.
layerStyle (InstanceDefinitionLayerStyle)How layers from the file appear in the model. This is used only when updateType is InstanceDefinitionUpdateType.Linked.
conflictResolution (InstanceDefinitionNameConflictResolution)What to do when the model already contains an instance definition named name.
skipNestedLinkedDefinitions (bool)If true, then linked instance definitions nested in the file are not read.
The index of the new instance definition, or the index of an existing linked instance definition that already references filename. -1 on error.

Delete

#Since v6.0
public override bool Delete(InstanceDefinition item)
Deletes the instance definition. This deletes all references too.
item (InstanceDefinition)The item to delete.
True on success.

Delete

#Since v5.0
public bool Delete(int idefIndex, bool deleteReferences, bool quiet)
Deletes the instance definition.
idefIndex (int)zero based index of instance definition to delete. This must be in the range 0 <= idefIndex < InstanceDefinitionTable.Count.
deleteReferences (bool)true to delete all references to this definition. false to delete definition only if there are no references.
quiet (bool)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.
true if successful. false if the instance definition has active references and bDeleteReferences is false.

DestroySourceArchive

#Since v6.0
public bool DestroySourceArchive(InstanceDefinition definition, bool quiet)
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.
definition (InstanceDefinition)The instance definition to be modified.
quiet (bool)If true, then message boxes about erroneous parameters will not be shown.
Returns true if the definition was successfully modified otherwise returns false.

Export

#Since v9.0
public bool Export(int idefIndex, string filename)
Exports the block definition's component objects to one of the file formats supported by Rhino.
idefIndex (int)Index of the instance definition to export.
filename (string)Name of the file to create.

Find

#Since v5.0
public InstanceDefinition Find(Guid instanceId, bool ignoreDeletedInstanceDefinitions)
Finds the instance definition with a given id.
instanceId (Guid)Unique id of the instance definition to search for.
ignoreDeletedInstanceDefinitions (bool)true means don't search deleted instance definitions.
The specified instance definition, or null if nothing matching was found.

Find

#ExampleSince v5.0 Obsolete v6.0
public InstanceDefinition Find(string instanceDefinitionName, bool ignoreDeletedInstanceDefinitions)
obsoleteignoreDeletedInstanceDefinitions is now redundant. Remove the second argument. Definitions are now always deleted permanently.
Finds the instance definition with a given name.
instanceDefinitionName (string)name of instance definition to search for (ignores case)
ignoreDeletedInstanceDefinitions (bool)true means don't search deleted instance definitions.
The specified instance definition, or null if nothing matching was found.

Find

#ExampleSince v6.0
public InstanceDefinition Find(string instanceDefinitionName)
Finds the instance definition with a given name.
instanceDefinitionName (string)name of instance definition to search for (ignores case)
The specified instance definition, or null if nothing matching was found.

FindId

public virtual T FindId(Guid id)
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.
inherited fromCommonComponentTable<T>
id (Guid)ID of model component to search for.
Reference to the rhino object with the objectId or null if no such object could be found.
FindId

GetEnumerator

#Since v5.0
public override IEnumerator<InstanceDefinition> GetEnumerator()

GetList

#Since v5.0
public InstanceDefinition[] GetList(bool ignoreDeleted)
Gets an array of instance definitions.
ignoreDeleted (bool)If true then deleted instance definitions are filtered out.
An array of instance definitions. This can be empty, but not null.

GetUnusedInstanceDefinitionName

#Since v5.0
public string GetUnusedInstanceDefinitionName()
Gets unused instance definition name used as default when creating new instance definitions.
An unused instance definition name string.

GetUnusedInstanceDefinitionName

#Since v5.0 Obsolete v6.0
[CLSCompliant(false)] public string GetUnusedInstanceDefinitionName(string root, uint defaultSuffix)
obsoleteThe defaultSuffix parameter is now ignored. Remove the second argument.
Gets unused instance definition name used as default when creating new instance definitions.
root (string)The returned name is 'root nn' If root is empty, then 'Block' (localized) is used.
defaultSuffix (uint)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".
An unused instance definition name string.

GetUnusedInstanceDefinitionName

#Since v5.0
public string GetUnusedInstanceDefinitionName(string root)
Gets unused instance definition name used as default when creating new instance definitions.
root (string)The returned name is 'root nn' If root is empty, then 'Block' (localized) is used.
An unused instance definition name string.

InstanceDefinitionIndex

#Since v6.0
public int InstanceDefinitionIndex(Guid instanceId, bool ignoreDeletedInstanceDefinitions)
Get the index of the instance definition with a given id.
instanceId (Guid)Unique id of the instance definition to search for
ignoreDeletedInstanceDefinitions (bool)true means don't search deleted instance definitions.
index > -1 if instance definition was found.

MakeSourcePathRelative

#Since v5.0 Obsolete v6.0
public bool MakeSourcePathRelative(InstanceDefinition idef, bool relative, bool quiet)
obsoleteSource paths are always absolute at runtime. They cannot be changed.
Obsolete method that always returns false. Marks the source path for a linked instance definition as relative or absolute.
idef (InstanceDefinition)The instance definition to be marked.
relative (bool)

If true, the path should be considered as relative.

If false, the path should be considered as absolute.

quiet (bool)If true, then message boxes about erroneous parameters will not be shown.
true if the instance definition could be modified.

Modify

#Since v5.0
public bool Modify(InstanceDefinition idef, string newName, string newDescription, bool quiet)
Modifies the instance definition name and description. Does not change instance definition ID or geometry.
idef (InstanceDefinition)The instance definition to be modified.
newName (string)The new name.
newDescription (string)The new description string.
quiet (bool)If false, information message boxes pop up when illegal changes are attempted.
true if successful.

Modify

#Since v7.16
public bool Modify(InstanceDefinition idef, string newName, string newDescription, string newUrl, string newUrlTag, bool quiet)
Modifies the instance definition name, description, and url. Does not change instance definition ID or geometry.
idef (InstanceDefinition)The instance definition to be modified.
newName (string)The new name.
newDescription (string)The new description string.
newUrl (string)The new URL or hyperlink.
newUrlTag (string)The new description of the URL or hyperlink.
quiet (bool)If false, information message boxes pop up when illegal changes are attempted.
true if successful.

Modify

#ExampleSince v5.0
public bool Modify(int idefIndex, string newName, string newDescription, bool quiet)
Modifies the instance definition name and description. Does not change instance definition ID or geometry.
idefIndex (int)The index of the instance definition to be modified.
newName (string)The new name.
newDescription (string)The new description string.
quiet (bool)If false, information message boxes pop up when illegal changes are attempted.
true if successful.

Modify

#Since v7.16
public bool Modify(int idefIndex, string newName, string newDescription, string newUrl, string newUrlTag, bool quiet)
Modifies the instance definition name, description, and url. Does not change instance definition ID or geometry.
idefIndex (int)The index of the instance definition to be modified.
newName (string)The new name.
newDescription (string)The new description string.
newUrl (string)The new URL or hyperlink.
newUrlTag (string)The new description of the URL or hyperlink.
quiet (bool)If false, information message boxes pop up when illegal changes are attempted.
true if successful.

Modify

#Since v8.10
public bool Modify(int idefIndex, UserData userData, bool quiet)
Modifies the instance definition user data. Does not change instance definition ID or geometry.
idefIndex (int)The index of the instance definition to be modified.
userData (UserData)The user data to replace.
quiet (bool)If false, information message boxes pop up when illegal changes are attempted.
true if successful.

ModifyGeometry

#Since v5.0
public bool ModifyGeometry(int idefIndex, GeometryBase newGeometry, ObjectAttributes newAttributes)
idefIndex (int)
newGeometry (GeometryBase)
newAttributes (ObjectAttributes)

ModifyGeometry

#Since v5.0
public bool ModifyGeometry(int idefIndex, IEnumerable<GeometryBase> newGeometry, IEnumerable<ObjectAttributes> newAttributes)
Modifies the instance definition geometry and replaces all references to the current definition with references to the new definition.
idefIndex (int)The index of the instance definition to be modified.
newGeometry (IEnumerable<GeometryBase>)The new geometry.
newAttributes (IEnumerable<ObjectAttributes>)The new attributes.
true if operation succeeded.

ModifyGeometry

#Since v5.0
public bool ModifyGeometry(int idefIndex, IEnumerable<GeometryBase> newGeometry)
idefIndex (int)
newGeometry (IEnumerable<GeometryBase>)

ModifyInsertionPlane

#Since v9.0
public bool ModifyInsertionPlane(int idefIndex, Plane plane)
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.
idefIndex (int)The index of the instance definition to be modified.
plane (Plane)The new insertion plane, in the definition's current coordinates.
true if operation succeeded.

ModifyInsertionPoint

#Since v9.0
public bool ModifyInsertionPoint(int idefIndex, Point3d point)
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.
idefIndex (int)The index of the instance definition to be modified.
point (Point3d)The new insertion point, in the definition's current coordinates.
true if operation succeeded.

ModifySourceArchive

#Since v6.0
public bool ModifySourceArchive(int idefIndex, FileReference sourceArchive, InstanceDefinitionUpdateType updateType, bool quiet)
If the instance definition is linked or embedded, use SetSource to specify the source archive.
idefIndex (int)The index of the instance definition to be modified.
sourceArchive (FileReference)The new source archive file name.
updateType (InstanceDefinitionUpdateType)
quiet (bool)If true, then message boxes about erroneous parameters will not be shown.
Returns true if the definition was successfully modified otherwise returns false.

ModifySourceArchive

#Since v9.0
public bool ModifySourceArchive(int idefIndex, FileReference sourceArchive, InstanceDefinitionUpdateType updateType, InstanceDefinitionLayerStyle layerStyle, bool quiet)
If the instance definition is linked or embedded, use SetSource to specify the source archive.
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.
idefIndex (int)The index of the instance definition to be modified.
sourceArchive (FileReference)The new source archive file name.
updateType (InstanceDefinitionUpdateType)
layerStyle (InstanceDefinitionLayerStyle)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 (bool)If true, then message boxes about erroneous parameters will not be shown.
Returns true if the definition was successfully modified otherwise returns false.

ModifySourceArchive

#Since v6.0 Obsolete v6.0
[EditorBrowsable(EditorBrowsableState.Never)] public bool ModifySourceArchive(int idefIndex, string sourceArchive, InstanceDefinitionUpdateType updateType, bool quiet)
obsoleteUse the overload taking a FileReference.
If the instance definition is linked or embedded, use SetSource to specify the source archive.
idefIndex (int)The index of the instance definition to be modified.
sourceArchive (string)The new source archive file name.
updateType (InstanceDefinitionUpdateType)
quiet (bool)If true, then message boxes about erroneous parameters will not be shown.
Returns true if the definition was successfully modified otherwise returns false.

Purge

#Since v5.9
public bool Purge(int idefIndex)
Purges an instance definition and its definition geometry.
idefIndex (int)zero based index of instance definition to delete. This must be in the range 0 <= idefIndex < InstanceDefinitionTable.Count.
True if successful. False if the instance definition cannot be purged because it is in use by reference objects or undo information.

PurgeUnused

#Since v9.0
public int PurgeUnused()
Purges any unused instance definitions.
The number of unused instance definitions that were purged.

RefreshLinkedBlock

#Since v6.0
public bool RefreshLinkedBlock(InstanceDefinition definition)
Reload linked block definitions and update the Rhino display.
definition (InstanceDefinition)Instance definition to reload.
Returns true if the linked file was successfully read and updated.

Undelete

#Since v5.9
public bool Undelete(int idefIndex)
Undeletes an instance definition that has been deleted by Delete()
idefIndex (int)zero based index of instance definition to delete. This must be in the range 0 <= idefIndex < InstanceDefinitionTable.Count.
true if successful

UndoModify

#Since v5.0
public bool UndoModify(int idefIndex)
Restores the instance definition to its previous state, if the instance definition has been modified and the modification can be undone.
idefIndex (int)The index of the instance definition to be restored.
true if operation succeeded.

UpdateLinkedInstanceDefinition

#Since v5.9
public bool UpdateLinkedInstanceDefinition(int idefIndex, string filename, bool updateNestedLinks, bool quiet)
Read the objects from a file and use them as the instance's definition geometry.
idefIndex (int)zero based index of instance definition to delete. This must be in the range 0 <= idefIndex < InstanceDefinitionTable.Count.
filename (string)name of file (can be any type of file that Rhino or a plug-in can read)
updateNestedLinks (bool)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 (bool)