Properties

ActiveCount

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

ComponentType

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

Count

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

Document

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

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

Methods

Add

#Since v5.0
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.
)
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#Since v9.0
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.
)
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#ExampleSince v5.0
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.
)
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#ExampleSince v5.0
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.
)
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#Since v9.0
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.
)
>=0 index of instance definition in the instance definition table. -1 on failure.

Add

#Since v7.0
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.
)
>=0 index of instance definition in the instance definition table. -1 on failure.

Clear

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

Compact

#Since v5.9
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.
)

CreateFromFile

#Since v9.0
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.
)
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
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.
)
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
Deletes the instance definition. This deletes all references too.
public override bool Delete(
item
The item to delete.
)
True on success.

Delete

#Since v5.0
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.
)
true if successful. false if the instance definition has active references and bDeleteReferences is false.

DestroySourceArchive

#Since v6.0
Destroys all source archive information. Specifically:
public bool DestroySourceArchive(
definition,
The instance definition to be modified.
quiet
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
Exports the block definition's component objects to one of the file formats supported by Rhino.
public bool Export(
idefIndex,
Index of the instance definition to export.
filename
Name of the file to create.
)

Find

#Since v5.0
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.
)
The specified instance definition, or null if nothing matching was found.

Find

#ExampleSince v5.0 Obsolete v6.0
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.
The specified instance definition, or null if nothing matching was found.

Find

#ExampleSince v6.0
Finds the instance definition with a given name.
public InstanceDefinition Find(
instanceDefinitionName
name of instance definition to search for (ignores case)
)
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.
public virtual T FindId(
id
ID of model component to search for.
)
inherited fromCommonComponentTable<T>
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
Gets an array of instance definitions.
public InstanceDefinition[] GetList(
ignoreDeleted
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
Gets unused instance definition name used as default when creating new instance definitions.
public string GetUnusedInstanceDefinitionName()
An unused instance definition name string.

GetUnusedInstanceDefinitionName

#Since v5.0 Obsolete v6.0
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.
An unused instance definition name string.

GetUnusedInstanceDefinitionName

#Since v5.0
Gets unused instance definition name used as default when creating new instance definitions.
public string GetUnusedInstanceDefinitionName(
root
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
Get the index of the instance definition with a given id.
public int InstanceDefinitionIndex(
instanceId,
Unique id of the instance definition to search for
ignoreDeletedInstanceDefinitions
true means don't search deleted instance definitions.
)
index > -1 if instance definition was found.

MakeSourcePathRelative

#Since v5.0 Obsolete v6.0
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.
true if the instance definition could be modified.

Modify

#Since v5.0
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.
)
true if successful.

Modify

#Since v7.16
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.
)
true if successful.

Modify

#ExampleSince v5.0
Modifies the instance definition name and description. 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.
quiet
If false, information message boxes pop up when illegal changes are attempted.
)
true if successful.

Modify

#Since v7.16
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.
)
true if successful.

Modify

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

ModifyGeometry

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

ModifyGeometry

#Since v5.0
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.
)
true if operation succeeded.

ModifyGeometry

#Since v5.0
public bool ModifyGeometry(
idefIndex,
newGeometry
)

ModifyInsertionPlane

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

ModifyInsertionPoint

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

ModifySourceArchive

#Since v6.0
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 true if the definition was successfully modified otherwise returns false.

ModifySourceArchive

#Since v9.0
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 true if the definition was successfully modified otherwise returns false.

ModifySourceArchive

#Since v6.0 Obsolete v6.0
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 true if the definition was successfully modified otherwise returns false.

Purge

#Since v5.9
Purges an instance definition and its definition geometry.
public bool Purge(
idefIndex
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
Purges any unused instance definitions.
public int PurgeUnused()
The number of unused instance definitions that were purged.

RefreshLinkedBlock

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

Undelete

#Since v5.9
Undeletes an instance definition that has been deleted by Delete()
public bool Undelete(
idefIndex
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
Restores the instance definition to its previous state, if the instance definition has been modified and the modification can be undone.
public bool UndoModify(
idefIndex
The index of the instance definition to be restored.
)
true if operation succeeded.

UpdateLinkedInstanceDefinition

#Since v5.9
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
)