GetAttributeInstances Method (IBlockInstance) Send Feedback
See Also  Example
AttributeInstanceArray[out]
Array of BlockAttribute instances
Gets the BlockAttribute instances for the Block instance.

Syntax

Visual Basic 
Function GetAttributeInstances() As System.Object
C# 
System.object GetAttributeInstances()
JavaScript 
GetAttributeInstances() : Array
COM native C++ 
HRESULT GetAttributeInstances(
   VARIANT* AttributeInstanceArray
)  
C++ 
DSRESULT GetAttributeInstances(
   dsObjectPtrArray* AttributeInstanceArray
)  

Parameters

AttributeInstanceArray[out] or Return Value
Array of BlockAttribute instances

Example

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

COM native C++

void CAddinDumpManager::DumpAttributeInstances( CStdioFile& fileOutput, LPCWSTR tabStr, IBlockInstancePtr blkIns )
{
    CString strPrint;
   
    _variant_t pVariantArrayAI = blkIns->GetAttributeInstances();
    if( V_VT( &pVariantArrayAI ) != VT_EMPTY )
    {
        IAttributeInstancePtr *AttrIns = NULL;
        int countOfAI = 0;
        TypeConverter::convertVariantArrayToPtrArray<IAttributeInstancePtr, IAttributeInstance>( pVariantArrayAI, AttrIns, countOfAI );

        strPrint.Format(L"%sAttribute instances (%d):\r\n", tabStr, countOfAI);
        fileOutput.WriteString(strPrint);

        if( AttrIns && countOfAI > 0)
        {
            for( int i = 0; i < countOfAI; ++i )
            {
                bstr_t AttInstName = AttrIns[i]->GetName();
                strPrint.Format( L"%s\tName: %s\r\n", tabStr, AttInstName.operator const wchar_t*() );
                fileOutput.WriteString( strPrint );

                bstr_t AttInstValue = AttrIns[i]->GetValue();
                strPrint.Format( L"%s\tValue: %s\r\n", tabStr, AttInstValue.operator const wchar_t*() );
                fileOutput.WriteString( strPrint );
            }
            delete[] AttrIns;
        }
        else
        {
            strPrint.Format( L"%s\tERROR GetAttributeInstances\r\n", tabStr );
            fileOutput.WriteString( strPrint );
        }
    }
    else
    {
        strPrint.Format( L"%s\tERROR GetAttributeInstances\r\n", tabStr );
        fileOutput.WriteString( strPrint );
    }
}

Example

 

See Also

Availability

DraftSight V1R1