Header file: MapAlteration.h.
Note This class has new functions added for AutoCAD Map 3D 2005.
An instance of the AcMapHatchAlteration class represents a hatch alteration object, which provides hatch patterns for closed figures when they are queried into the project drawing if property alteration is enabled for the query.
To access members of this class, create an AcMapHatchAlteration pointer using AcMapPropertyAlterationDefinition::AddAlteration and cast it to the AcMapHatchAlteration* type as follows:
pDef->AddAlteration(pcAlt, AcMap::kAlterationHatch); ... AcMapTextAlteration *pHatch = NULL; pHatchAlt = (AcMapHatchAlteration*)pcAlt; pHatchAlt->SetColor("RED");
You are responsible for deleting the pcAlt pointer. Do not attempt to delete the pDef pointer.
The AcMapHatchAlteration class is a subclass of the AcMapPropertyAlteration class. Note that it inherits certain functions of the parent class without overloading them. In particular, note that it uses the parent's SetExpression function to specify the hatch pattern name for the hatch alteration.
Do not subclass from this class.
You create an AcMapHatchAlteration pointer by adding an alteration to the property alteration definition. Next, you specify the hatch pattern using AcMapTextAlteration::SetExpression. Default values are used to alter the pattern unless you access members of AcMapHatchAlteration to you change these values, as shown in the following example, which changes the color of the hatch pattern on the WATER layer. This example assumes you have attached citymap7.dwg from the MAPTUT directory.
// For simplicity, error checking is not shown. AcMapProject *pProj = NULL; AcMapQueryBranch *pQBranch = NULL; AcMapLocationCondition *pLocationCondition = NULL; AcMapQuery *pQuery = NULL; AcMapSession *mapApi = AcMapGetSession(); mapApi->GetProject(pProj); 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::kAlterationHatch); AcMapHatchAlteration *pHatchAlt = NULL; pHatchAlt = (AcMapHatchAlteration*)pcAlt; pHatchAlt->SetLayer("WATER"); pHatchAlt->SetColor("CYAN"); pcAlt->SetExpression("Solid") ; pQuery->EnablePropertyAlteration(Adesk::kTrue); pQuery->Define(pQBranch); pQuery->Run(); delete pcAlt ; delete pLocationCondition; delete pQBranch; delete pQuery;