Property Alteration

AutoCAD Map 3D ObjectARX

 
Property Alteration
 
 
 

You associate a property alteration definition with the query that it affects using the AcMapQuery::GetPropertyAlteration function. You create a property alteration and add it to the definition, with the AcMapPropertyAlterationDefinition::AddAlteration function.

The classes used to create and manipulate property alteration for a query are

AcMapPropertyAlterationDefinition AcMapPropertyAlteration AcMapTextAlteration AcMapHatchAlteration

The last two classes, which are subclassed from AcMapPropertyAlteration, are specialized property alterations for adding text labels and hatch patterns to queried objects.

You can alter properties conditionally, depending on existing values of the property to be altered or of some other property. To do so, you will also need to use the following classes:

AcMapRangeLibrary AcMapRangeTable AcMapRangeLine

Property Types

A property alteration's type identifies the property that it alters. The properties that can be altered are enumerated in AcMap::EAlterationType. When you create a property alteration, you set its type by assigning it one of these enumerators. Note that two of these enumerators, AcMap::kAlterationTextEntity and AcMap::kAlterationHatch, create the specialized property alteration objects AcMapTextAlteration and AcMapHatchAlteration, which are subclassed from AcMapPropertyAlteration. The remaining enumerators simply identify the different kinds of AcMapPropertyAlteration objects, the simple property alterations.

AcMapTextAlteration objects in a property alteration definition create text objects when the query exceutes, which serve as text labels for queried objects. AcMapHatchAlteration objects create hatch objects, which apply hatch patterns to closed or closeable queried objects.

The value that the property acquires when the query is run is indicated by the property alteration's value expression, which you set with the AcMapPropertyAlteration::SetExpression function. For example, if the property alteration's type is AcMap::kAlterationColor, you might set its expression to "Red". If the property alteration's type is AcMap::kAlterationTextEntity, the property alteration's value expression is the text for the label. If the type is AcMap::kAlterationHatch, the value expression is a pattern name.

To define a property alteration for a query

  1. Get the property alteration definition of the query using the AcMapQuery::GetPropertyAlteration function.
  2. Create a property alteration and add it to the property alteration definition using the AcMapPropertyAlterationDefinition::AddPropertyAlteration function.
  3. Set the property alteration's expression using the AcMapPropertyAlteration::SetExpression function.
  4. Repeat steps 2 and 3 for every property alteration that you want to be executed by the query.

Applying Property Alteration

When the query is executed, property alteration is applied only if it is defined and enabled. Use the following AcMapQuery functions to determine whether property alteration has been defined for a query, whether it has been enabled, and to enable or disable it as needed.

AcMapQuery::IsPropertyAlterationDefined AcMapQuery::IsPropertyAlterationEnabled AcMapQuery::EnablePropertyAlteration

Property alteration is defined if the query's property alteration definition contains at least one property alteration.

Conditional Property Alteration

You can alter properties conditionally, depending on existing values of the property to be altered or of some other property. For example, you can alter the colors of queried parcels depending on their assessed value.

A range table is a collection of range lines. A range line consists of a comparative operator (such as "greater than"), a comparison value (such as 1,000,000), and a return value (such as "Green"), to express a conditional alteration such as, "If the value is greater than 1,000,000, return green." To use a range table, pass a range table expression to the property alteration's SetExpression function. A range table expression has the following format.

where Range is an invariant keyword.

All the range tables available to a project are contained in the project's range library, an instance of the AcMapRangeLibrary class. A project contains a single range library.

For More Information

For more information about property alteration and range tables, see the UI documentation, AutoCAD Map 3D Help, and the Map Samples folder of ObjectARX installations.

The property alteration feature of AutoCAD Map 3D lets you modify the appearance of objects queried into the project drawing.