Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Associative Arrays > Editing Associative Array Parameters
Editing Associative Array Parameters

Use methods of classes derived from the OdDbAssocArrayParameters class to edit the values of the associative array parameters. Parameter values can be changed either before or after creating the associative array. To get access to parameters after the associative array is created, use the OdDbAssocArrayActionBody:: parameters() method.

void ModifyPolarArray (const OdDbEntity* pEntity) 
 {
 OdDbObjectId bodyId = OdDbAssocArrayActionBody::getControllingActionBody(pEntity);
 
 OdDbAssocArrayActionBodyPtr pBody = OdDbAssocArrayActionBody::cast(bodyId.openObject(OdDb::kForWrite));
 
 OdDbAssocArrayPolarParametersPtr pPolarParam = OdDbAssocArrayPolarParameters::cast(pBody->parameters());
 
 pPolarParam->setRowCount(2);
 pPolarParam->setRowSpacing(50);
 pPolarParam->setRadius(50);
 }

After executing the code sample, the polar array will be changed:

Example of changing parameters of a polar array

Editing Associative Array Parameters example

You can also find a code example illustrating how to edit parameters of an associative array in Drawing\Examples\ExCommands\ExArrayEdit.cpp. This file contains a sample implementation for the ARRAYEDIT command.

See Also

Working with Associative Arrays

Associative Arrays Architecture

Creating Associative Arrays

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.