Hide Table of Contents
GetAttributeInstances Method (IBlockInstance)
AttributeInstanceArray[out]
Array of BlockAttribute instances

Gets the BlockAttribute instances for the Block instance.

.NET Syntax

Visual Basic (Declaration) 
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


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   GetAttributeInstances Method (IBlockInstance)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:



x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2019 SP04

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.