This is the same as InstanceDefinitionGeometry, but in a Rhino document.

Properties

ArchiveFileStatus

#Since v5.2
public InstanceDefinitionArchiveFileStatus ArchiveFileStatus { get; }
Returns the archive file status of a linked instance definition.

ComponentStatus

public virtual ComponentStatus ComponentStatus { get; set; }
Gets or sets the component status of the model component.
inherited fromModelComponent

ComponentType

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

DeletedName

public string DeletedName { get; }
Gets the name of a component that is deleted.
inherited fromModelComponent

Description

public string Description { get; set; }
Gets or sets the description of the definition.
inherited fromInstanceDefinitionGeometry

Disposed

public bool Disposed { get; }
Indicates if this object has been disposed or the document it originally belonged to has been disposed.
inherited fromCommonObject

HasId

public bool HasId { get; }
Returns a value indicating whether the component has an ID.
inherited fromModelComponent

HasIndex

public bool HasIndex { get; }
Returns a value indicating whether the component has an Index.
inherited fromModelComponent

HasName

public bool HasName { get; }
Returns a value indicating whether the component has a Name.
inherited fromModelComponent

HasUserData

public bool HasUserData { get; }
Gets true if this class has any custom information attached to it through UserData.
inherited fromCommonObject

Id

public virtual Guid Id { get; set; }
Gets or sets the ID of the current instance.
inherited fromModelComponent
InvalidOperationExceptionWhen setting the ID failed. This usually happened because the instance ID is already locked.

IdIsLocked

public bool IdIsLocked { get; }
Returns a value indicating whether the component ID is already locked.
inherited fromModelComponent

Index

#Since v5.0
public override int Index { get; }
Index of this instance definition in the index definition table.

IndexIsLocked

public bool IndexIsLocked { get; }
Returns a value indicating whether the component Index is already locked.
inherited fromModelComponent

InstanceDefinitionModelSerialNumber

[CLSCompliant(false)] public virtual uint InstanceDefinitionModelSerialNumber { get; }
When a component is in a model as part of the information required for a linked instance definition, this value identifies the linked instance definition reference model.
inherited fromModelComponent
Remarks: Reference components are not saved in .3dm archives. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

IsComponentStatusLocked

public bool IsComponentStatusLocked { get; }
The component status itself can be locked. This returns an indication.
inherited fromModelComponent

IsDeleted

#ExampleSince v5.0
public override bool IsDeleted { get; }
Returns true if this instance definition is deleted. Deleted object are not saved to a file archive.

IsDocumentControlled

public virtual bool IsDocumentControlled { get; }
If true this object may not be modified. Any properties or functions that attempt to modify this object when it is set to "IsReadOnly" will throw a NotSupportedException.
inherited fromCommonObject

IsLinkedType

public bool IsLinkedType { get; }
Returns true if this instance definition is linked to an external source archive, that is, if its InstanceDefinitionGeometry.UpdateType is InstanceDefinitionUpdateType.Linked or InstanceDefinitionUpdateType.LinkedAndEmbedded.
inherited fromInstanceDefinitionGeometry

IsReference

#ExampleSince v5.0
public override bool IsReference { get; }
An object from a work session reference model is reference a reference object and cannot be modified. An object is a reference object if, and only if, it is on a reference layer.

IsSystemComponent

public bool IsSystemComponent { get; }
True if this model component is a system constant.

An incomplete list of system constant model components is below:

  • ON_ModelComponent::Unset

  • ON_InstanceDefinition::Empty

  • ON_Linetype::Unset
  • ON_Linetype::Continuous
  • ON_Linetype::ByLayer
  • ON_Linetype::ByParent

  • ON_Layer::Unset
  • ON_Layer::Default

  • ON_TextStyle::Unset
  • ON_TextStyle::Default
  • ON_TextStyle::ByLayer
  • ON_TextStyle::ByParent

  • ON_DimStyle::Unset
  • ON_DimStyle::Default
  • ON_DimStyle::DefaultInchDecimal
  • ON_DimStyle::DefaultInchFractional
  • ON_DimStyle::DefaultFootInchArchitecture
  • ON_DimStyle::DefaultMillimeterSmall
  • ON_DimStyle::DefaultMillimeterLarge
  • ON_DimStyle::DefaultMillimeterArchitecture
inherited fromModelComponent

IsTenuous

#Since v5.0
public bool IsTenuous { get; }
True if this instance definition is from a linked file. It will be saved only if it is referenced by an instance reference object that is in the active geometry list and is being saved. Note that there can be multiple linked instance definitions with references to tenuous instance definitions.

IsValid

public virtual bool IsValid { get; }
Tests an object to see if it is valid.
inherited fromCommonObject

LayerStyle

#Since v7.8
public InstanceDefinitionLayerStyle LayerStyle { get; set; }
Specifies how model components (layers, materials, dimension styles, etc.) from linked instance definition files appear in the active model.

ModelSerialNumber

[CLSCompliant(false)] public virtual uint ModelSerialNumber { get; }
A value identifying the model that manages this component.
inherited fromModelComponent
Remarks: If the component is being managed by a model, this value identifies the model. In Rhino, this value is the document runtime serial number. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

Name

public virtual string Name { get; set; }
Gets or sets the name
inherited fromModelComponent
InvalidOperationExceptionWhen setting the Name failed. This usually happens because the instance Name is already locked.

NameIsLocked

public bool NameIsLocked { get; }
Returns a value indicating whether the component Name is already locked.
inherited fromModelComponent

ObjectCount

#Since v5.0
public int ObjectCount { get; }
Number of objects this definition uses. This counts the objects that are used to define the geometry. This does NOT count the number of references to this instance definition.

ReferenceModelSerialNumber

[CLSCompliant(false)] public virtual uint ReferenceModelSerialNumber { get; }
When a component is in a model for reference, this value identifies the reference model.
inherited fromModelComponent
Remarks: Reference components are not saved in .3dm archives. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

SkipNestedLinkedDefinitions

#Since v7.8
public bool SkipNestedLinkedDefinitions { get; set; }
This property applies when an instance definition is linked. If true, when reading the file that defines the content of the linked instance definition, skip any linked instance definitions found in that file. If false, when reading the file that defines the content of the linked instance definition, recursively load linked instance definitions found in that file.

SourceArchive

#Since v5.0
public string SourceArchive { get; }
Gets the full file path for linked instance definitions.

SourceArchiveRelativePath

public string SourceArchiveRelativePath { get; }
Gets the source archive path for linked instance definitions relative to the file that contains this definition. Empty if the definition is not linked or no relative path is stored.
inherited fromInstanceDefinitionGeometry

UnitSystem

#Since v7.0
public UnitSystem UnitSystem { get; set; }
Gets the unit system of the instance definition. If the instance definition was imported from another 3dm file, the unit system may differ from that of the document.

UpdateType

#Since v5.0
public InstanceDefinitionUpdateType UpdateType { get; }

Url

public string Url { get; set; }
Gets or sets the URL or hyperlink of the definition.
inherited fromInstanceDefinitionGeometry

UrlDescription

public string UrlDescription { get; set; }
Gets or sets the description of the URL or hyperlink of the definition.
inherited fromInstanceDefinitionGeometry

UserData

public UserDataList UserData { get; }
List of custom information that is attached to this class.
inherited fromCommonObject

UserDictionary

public ArchivableDictionary UserDictionary { get; }
Dictionary of custom information attached to this class. The dictionary is actually user data provided as an easy to use shareable set of information.
inherited fromCommonObject

UserStringCount

public int UserStringCount { get; }
Gets the amount of user strings.
inherited fromInstanceDefinitionGeometry

Methods

ClearId

public void ClearId()
Resets the HasId property of the model component to false, if possible.
inherited fromModelComponent
InvalidOperationExceptionIf the ID is locked.

ClearIndex

public void ClearIndex()
Resets the HasIndex property of the model component to false, if possible.
inherited fromModelComponent
InvalidOperationExceptionIf the index is locked.

ClearName

public void ClearName()
Resets the HasName property of the model component to false, if possible.
inherited fromModelComponent
InvalidOperationExceptionIf the name is locked.

ConstructConstObject

protected void ConstructConstObject(object parentObject, int subobjectIndex)
Assigns a parent object and a sub-object index to this.
inherited fromCommonObject
parentObject (object)The parent object.
subobjectIndex (int)The sub-object index.

CreatePreviewBitmap

#Since v6.0
public Bitmap CreatePreviewBitmap(DefinedViewportProjection definedViewportProjection, DisplayMode displayMode, Size bitmapSize, bool applyDpiScaling)
Creates a preview bitmap of the instance definition.
definedViewportProjection (DefinedViewportProjection)The view projection.
displayMode (DisplayMode)The display mode.
bitmapSize (Size)The bitmap size in pixels.
applyDpiScaling (bool)Specify true to apply DPI scaling (Windows-only).
The preview bitmap if successful, null otherwise.

CreatePreviewBitmap

#Since v5.0
public Bitmap CreatePreviewBitmap(DefinedViewportProjection definedViewportProjection, DisplayMode displayMode, Size bitmapSize)
Creates a preview bitmap of the instance definition.
definedViewportProjection (DefinedViewportProjection)The view projection.
displayMode (DisplayMode)The display mode.
bitmapSize (Size)The bitmap size in pixels.
The preview bitmap if successful, null otherwise.

CreatePreviewBitmap

#Since v6.0
public Bitmap CreatePreviewBitmap(DefinedViewportProjection definedViewportProjection, Size bitmapSize, bool applyDpiScaling)
Creates a wireframe preview bitmap of the instance definition.
definedViewportProjection (DefinedViewportProjection)The view projection.
bitmapSize (Size)The bitmap size in pixels.
applyDpiScaling (bool)Specify true to apply DPI scaling (Windows-only).
The preview bitmap if successful, null otherwise.

CreatePreviewBitmap

#Since v5.0
public Bitmap CreatePreviewBitmap(DefinedViewportProjection definedViewportProjection, Size bitmapSize)
Creates a wireframe preview bitmap of the instance definition.
definedViewportProjection (DefinedViewportProjection)The view projection.
bitmapSize (Size)The bitmap size in pixels.
The preview bitmap if successful, null otherwise.

CreatePreviewBitmap

#Since v6.21
public Bitmap CreatePreviewBitmap(Guid definitionObjectId, DefinedViewportProjection viewportProjection, DisplayMode displayMode, Size bitmapSize, bool applyDpiScaling)
Creates a preview bitmap of the instance definition.
definitionObjectId (Guid)Id of one of this definition's objects to draw selected.
viewportProjection (DefinedViewportProjection)The view projection.
displayMode (DisplayMode)The display mode.
bitmapSize (Size)The bitmap size in pixels.
applyDpiScaling (bool)Specify true to apply DPI scaling (Windows-only).
The preview bitmap if successful, null otherwise.

CreatePreviewBitmap

#Since v8.10
public Bitmap CreatePreviewBitmap(Guid displayModeId, DefinedViewportProjection viewportProjection, IsometricCamera isometricCamera, bool drawDecorations, Size bitmapSize, bool applyDpiScaling)
Creates a preview bitmap of the instance definition.
displayModeId (Guid)The id of the display mode to draw with.
viewportProjection (DefinedViewportProjection)The view projection.
isometricCamera (IsometricCamera)The isometric camera angle.
drawDecorations (bool)Specify true to draw viewport decorations, such as grid and axes.
bitmapSize (Size)The bitmap size in pixels.
applyDpiScaling (bool)Specify true to apply DPI scaling (Windows-only).
The preview bitmap if successful, null otherwise.

DataCRC

[CLSCompliant(false)] public uint DataCRC(uint currentRemainder)
Increments the Cyclic Redundancy Check value by this instance.
inherited fromModelComponent
currentRemainder (uint)The current remainder value.
The updated remainder value.

DeleteAllUserStrings

public void DeleteAllUserStrings()
Deletes all user strings attached to this geometry.
inherited fromInstanceDefinitionGeometry

DeleteUserString

public bool DeleteUserString(string key)
Deletes the user string with the specified key from this geometry.
inherited fromInstanceDefinitionGeometry
key (string)The key of the user string to delete.
True if the user string was deleted or did not exist; otherwise, false.

Dispose

public void Dispose()
Actively reclaims unmanaged resources that this instance uses.
inherited fromCommonObject

Dispose

protected virtual void Dispose(bool disposing)
For derived class implementers.

This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.

You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.

Also, you must call the base virtual method within your overriding method.

inherited fromCommonObject
disposing (bool)true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.

EnsurePrivateCopy

public void EnsurePrivateCopy()
If you want to keep a copy of this class around by holding onto it in a variable after a command completes, call EnsurePrivateCopy to make sure that this class is not tied to the document. You can call this function as many times as you want.
inherited fromCommonObject

Equals

#
public override bool Equals(object obj)
Equality is checked against InstanceDefinition.Id
obj (object)
True if obj.Id equals Id
Object.Equals

GetContainers

#Since v5.0
public InstanceDefinition[] GetContainers()
Gets a list of all the InstanceDefinitions that contain a reference this InstanceDefinition.
An array of instance definitions. The returned array can be empty, but not null.

GetHashCode

#
public override int GetHashCode()
Use Id.GetHashCode()

GetObjectData

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
inherited fromCommonObject
info (SerializationInfo)The System.Runtime.Serialization.SerializationInfo to populate with data.
context (StreamingContext)The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.

GetObjectIds

[ConstOperation] public Guid[] GetObjectIds()
Returns the unique identifiers of all objects that are part of this instance definition's geometry table.
inherited fromInstanceDefinitionGeometry
An array of Guid values representing the object IDs in the instance geometry table.

GetObjects

#ExampleSince v5.0
public RhinoObject[] GetObjects()
Gets an array with the objects that belong to this instance definition.
An array of Rhino objects. The returned array can be empty, but not null.

GetReferences

#Since v5.0
public InstanceObject[] GetReferences(int wheretoLook)
Gets a list of the CRhinoInstanceObjects (inserts) that contains a reference this instance definition.
wheretoLook (int)

0 = get top level references in active document.

1 = get top level and nested references in active document.

2 = check for references from other instance definitions.

An array of instance objects. The returned array can be empty, but not null.

GetUserString

public string GetUserString(string key)
Gets user string from this geometry.
inherited fromInstanceDefinitionGeometry
key (string)id used to retrieve the string.
string associated with the key if successful. null if no key was found.

GetUserStrings

public NameValueCollection GetUserStrings()
Gets a copy of all (user key string, user value string) pairs attached to this geometry.
inherited fromInstanceDefinitionGeometry
A new collection.

InUse

#Since v5.0
public bool InUse(int wheretoLook)
Determines whether the instance definition is referenced.
wheretoLook (int)

0 = check for top level references in active document.

1 = check for top level and nested references in active document.

2 = check for references in other instance definitions.

true if the instance definition is used; otherwise false.

IsValidWithLog

public bool IsValidWithLog(out string log)
Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
inherited fromCommonObject
log (out string)A textual log. This out parameter is assigned during this call.
true if this object is valid; false otherwise.

LockId

public void LockId()
Locks the component Id property.
inherited fromModelComponent

LockIndex

public void LockIndex()
Locks the component Index property.
inherited fromModelComponent

LockName

public void LockName()
Locks the component Name property.
inherited fromModelComponent

NonConstOperation

protected virtual void NonConstOperation()
For derived classes implementers.

Defines the necessary implementation to free the instance from being constant.

inherited fromCommonObject

Object

#Since v5.0
public RhinoObject Object(int index)
returns an object used as part of this definition.
index (int)0 <= index < ObjectCount.
Returns an object that is used to define the geometry. Does NOT return an object that references this definition.count the number of references to this instance.

OnSwitchToNonConst

protected virtual void OnSwitchToNonConst()
Is called when a non-constant operation first occurs.
inherited fromCommonObject

SetUserString

public bool SetUserString(string key, string value)
Attach a user string (key,value combination) to this geometry.
inherited fromInstanceDefinitionGeometry
key (string)id used to retrieve this string.
value (string)string associated with key.
true on success.

ToJSON

public string ToJSON(SerializationOptions options)
Create a JSON string representation of this object
inherited fromCommonObject
options (SerializationOptions)

ToString

public override string ToString()
Returns the name of the model component type, and then its name and index.
inherited fromModelComponent
Remarks: This is provided as a visual aid. Do not rely on this for serialization.
Object.ToString

UseCount

#Since v7.4
public int UseCount()
Returns the number of references of this instance definition in the model. Both top-level references and nested instances are included in the count.
The number of references of this instance definition in the model.

UseCount

#Since v7.4
public int UseCount(out int topLevelReferenceCount, out int nestedReferenceCount)
Returns the number of references of this instance definition in the model. Both top-level references and nested instances are included in the count.
topLevelReferenceCount (out int)The number of top-level references.
nestedReferenceCount (out int)The number of nested instances.
The number of references of this instance definition in the model.

UsesDefinition

#Since v5.0
public int UsesDefinition(int otherIdefIndex)
Determines if this instance definition contains a reference to another instance definition.
otherIdefIndex (int)index of another instance definition.
0 no 1 other_idef_index is the index of this instance definition >1 This InstanceDefinition uses the instance definition and the returned value is the nesting depth.

UsesLayer

#Since v8.7
public bool UsesLayer(int layerIndex)
Returns true if some object in the instance definition is on the layer with the specified layer index.
layerIndex (int)The index of layer to search for.
True if there is an object in the instance definition that is on the layer.

UsesLinetype

#Since v8.7
public bool UsesLinetype(int linetypeIndex)
Returns true if some object in the instance definition references the linetype with the specified linetype index.
linetypeIndex (int)The index of linetype to search for.
True if there is an object in the instance definition that references that linetype.