IBlockInstance Interface

IBlockInstance Interface | Send Feedback
See Also Members Example

Allows access to a Block instance.

# Syntax

Visual Basic |
--- | ---
    Public Interface IBlockInstance

C# |
--- | ---
    public interface IBlockInstance

JavaScript |
--- | ---
    Object dsBlockInstance

COM native C++ |
--- | ---
    interface IBlockInstance

C++ |
--- | ---
    class dsBlockInstance

# Example

This code snippet shows how to get the Block instances.

#### COM native C++

_variant_t pVariantArrayBI = blkDefs->GetBlockInstances();
if( V_VT( &pVariantArrayBI ) != VT_EMPTY )
{
IBlockInstancePtr *blkIns = NULL;
int countOfBI = 0;
TypeConverter::convertVariantArrayToPtrArray<IBlockInstancePtr, IBlockInstance>( pVariantArrayBI, blkIns, countOfBI );
}

This code snippet shows how to get the IBlockInstance object if the selected object is an IBlockInstance object.

#### COM native C++

long selCount = dsSelManager->GetSelectedObjectCount( dsSelectionSetType_Current );

if( selCount > 0 )
{
for( long i = 0; i < selCount; ++i )
{
//Get selected object type
dsObjectType_e retObjType;
IDispatchPtr selObj = dsSelManager->GetSelectedObject( dsSelectionSetType_Current, i, &retObjType );

//If selected object is Block instance
if( dsBlockInstanceType == retObjType )
{
IBlockInstancePtr blkIns( selObj );

> . . .

This code snippet shows how to insert a Block instance.

#### COM native C++

> //Insert the existing Block instance or insert Block instance from a DWG file

> bstr_t blockFileName ( L"<path_and_DWG_file_name_OR_existing_Block_name>" );

> double insertX = 0, insertY = 0, insertZ = 0, scaleX = 1, scaleY = 1, scaleZ = 1, rotation = 0;

> BlockInstancePtr blockInstance = sketchMgr->InsertBlock2( blockFileName, insertX, insertY, insertZ, scaleX, scaleY, scaleZ, rotation );

# 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)
Insert Block Instance (C#)
Insert Block Instance (VB.NET)
Insert Block Instance (VBA)
Insert External Reference (C#)
Insert External Reference (VB.NET)
Insert External Reference (VBA)
Insert Block, Notes, and Sketch Entities (JavaScript)

# Accessors

IBlockDefinition::GetBlockInstances

IDocument::GetObjectByHandle

ILeader::GetBlockAnnotation

ISelectionManager::GetSelectedObject

ISelectionManager::GetSelectedObjects

ISketchManager::GetEntities

ISketchManager::InsertBlock2

ISketchManager::InsertExternalReference

# Object Model

BlockInstance

# See Also

####

IBlockInstance Members
Interop.dsAutomation Namespace
IBlockDefinition Interface
IAttributeInstance Interface
IDrawingSupportFiles::LibraryFilesPath Property ()