GetID Method (IBlockInstance)

GetID Method (IBlockInstance) | Send Feedback
See Also Example

BlockID[out]
  ID of the Block instance

Gets the ID of the Block instance.

# Syntax

Visual Basic |
--- | ---
    Function GetID() As System.Integer

C# |
--- | ---
    System.int GetID()

JavaScript |
--- | ---
    GetID() : Number

COM native C++ |
--- | ---
    HRESULT GetID(
       LONG* BlockID
    )

C++ |
--- | ---
    DSRESULT GetID(
       long* BlockID
    )

#### Parameters

BlockID[out] or Return Value
  ID of the Block instance

# Example

This code snippet shows how to get the ID and working space of a Block instance. This code snippet also shows how to determine if the working space is a model or sheet.

#### COM native C++

//Get Block instance ID
bstr_t blkInstanceID = blkIns->GetID();

//Get working space
dsObjectType_e oType;
IDispatch pWorkingSpace;
blkIns->GetWorkingSpace( &oType, &pWorkingSpace );

//If working space is a model
if( dsModelType == oType )
{

IModel modelSpace ( pWorkingSpace );
. . .

}
else
{
//If working space is a sheet
if( dsSheetType == oType )
{
ISheetPtr sheet( pWorkingSpace );

. . .

}

}

# Example

Get and Set Block Definitions, Block Instances, and BlockAttribute Instances (C#)
Get and Set Block Definitions, Block Instances, and BlockAttribute Instances (VB.NET)
Get and Set Block Definitions, Block Instances, and BlockAttribute Instances (VBA)

# See Also

####

IBlockInstance Interface
IBlockInstance Members

# Availability

DraftSight V1R1