GetAttributeDefinitions Method (IBlockDefinition)

GetAttributeDefinitions Method (IBlockDefinition) | Send Feedback
See Also Example

AttributeDefinitionArray[out]
  Array of BlockAttribute definitions

Gets the BlockAttribute definitions for the Block definition.

# Syntax

Visual Basic |
--- | ---
    Function GetAttributeDefinitions() As System.Object

C# |
--- | ---
    System.object GetAttributeDefinitions()

JavaScript |
--- | ---
    GetAttributeDefinitions() : Array

COM native C++ |
--- | ---
    HRESULT GetAttributeDefinitions(
       VARIANT* AttributeDefinitionArray
    )

C++ |
--- | ---
    DSRESULT GetAttributeDefinitions(
       dsObjectPtrArray* AttributeDefinitionArray
    )

#### Parameters

AttributeDefinitionArray[out] or Return Value
  Array of BlockAttribute definitions

# Example

This code snippet shows how to write the captions, names, and values of the BlockAttribute definitions to a file.

#### COM native C++

void CAddinDumpManager::DumpAttributeDefinitions( CStdioFile& fileOutput, LPCWSTR tabStr, IBlockDefinitionPtr blkDefs )
{
CString strPrint;
_variant_t pVariantArrayAD = blkDefs->GetAttributeDefinitions();
if( V_VT( &pVariantArrayAD ) != VT_EMPTY )
{
IAttributeDefinitionPtr *blkAttDefs = NULL;
int countOfAttDefs = 0;
TypeConverter::convertVariantArrayToPtrArray<IAttributeDefinitionPtr, IAttributeDefinition>( pVariantArrayAD, blkAttDefs, countOfAttDefs );

strPrint.Format( L"\tAttribute definitions (%d):\r\n", countOfAttDefs );
fileOutput.WriteString( strPrint );

if( blkAttDefs && countOfAttDefs > 0)
{
for( int i = 0; i < countOfAttDefs; ++i )
{
bstr_t AttDefCaption= blkAttDefs[i]->GetCaption();
strPrint.Format( L"\tCaption: %s\r\n", AttDefCaption.operator const wchar_t*() );
fileOutput.WriteString( strPrint );

bstr_t AttDefName= blkAttDefs[i]->GetName();
strPrint.Format( L"\tName: %s\r\n", AttDefName.operator const wchar_t*() );
fileOutput.WriteString(strPrint);

bstr_t AttDefValue= blkAttDefs[i]->GetValue();
strPrint.Format( L"\tValue: %s\r\n", AttDefValue.operator const wchar_t*() );
fileOutput.WriteString( strPrint );

}
delete[] blkAttDefs;
}
else
fileOutput.WriteString( L"\tERROR GetAttributeDefinitions\r\n" );
}
else
fileOutput.WriteString( L"\tERROR GetAttributeDefinitions\r\n" );
}

# 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

####

IBlockDefinition Interface
IBlockDefinition Members

# Availability

DraftSight V1R1