AcMapPropertyAlterationDefinition class

Land Desktop Development ARX CPP SDK

 

AcMapPropertyAlterationDefinition class

Header file: MapAlteration.h.

Note  This class has new functions added for AutoCAD Map 3D 2005.

An instance of the AcMapPropertyAlterationDefinition class represents a property alteration definition, which is an ordered collection of property alterations. These property alterations affect the appearance of objects displayed in the results of a query if property alteration for the query is enabled.

There are three classes for representing property alterations: AcMapPropertyAlteration, AcMapTextAlteration, and AcMapHatchAlteration. The latter two are subclassed from the first, and both of them use the parent's SetExpression function to specify the string for the text alteration or a hatch pattern name for the hatch alteration.

To create or get the property alteration definition of a query, use the AcMapQuery::GetPropertyAlteration function. If property alteration is not yet defined for the query, calling this function creates an empty definition that you can complete by adding property alterations.

Do not subclass from this class. Do not delete the AcMapPropertyAlterationDefinition memory.

The following code alters the color of queried objects to red. This example assumes that a drawing is already attached. For simplicity, error checking is not shown.

AcMapSession    *mapApi = NULL;
AcMapProject    *pProj = NULL;
AcMapDrawingSet *pDSet = NULL;
AcMapQueryBranch *pQBranch = NULL;
AcMapLocationCondition *pLocationCondition = NULL;
AcMapQuery *pQuery = NULL;
 
mapApi = AcMapGetSession();
mapApi->GetProject(pProj);
pProj->GetDrawingSet(pDSet);
pQBranch = new AcMapQueryBranch(); 
pLocationCondition = new AcMapLocationCondition(AcMap::kOperatorAnd,
   AcMap::kLocationInside); 
pLocationCondition->SetBoundary((&AcMapAllBoundary;()));
pProj->CreateQuery(pQuery, Adesk::kFalse);
pQuery->Clear(Adesk::kTrue);
pQuery->SetMode(AcMap::kQueryDraw);
pQBranch->AppendOperand(pLocationCondition);
AcMapPropertyAlterationDefinition *pDef = NULL;
AcMapPropertyAlteration *pcAlt = NULL;
pQuery->GetPropertyAlteration(pDef);
pDef->AddAlteration(pcAlt, AcMap::kAlterationColor);
pcAlt->SetExpression("RED");
pQuery->EnablePropertyAlteration(Adesk::kTrue);
pQuery->Define(pQBranch);
pQuery->Run();
pDSet->ZoomExtents();
delete pcAlt ;
delete pLocationCondition;
delete pQBranch;
delete pQuery;