AcMapRangeLibrary class

Land Desktop Development ARX CPP SDK

 

AcMapRangeLibrary class

Header file: MapArxApi.h.

The AcMapRangeLibrary class represents a range library, which contains all the range tables available to a project.

A range library is instantiated automatically when a project is instantiated. There is only one range library per project. You get a pointer to the project's range library with the AcMapProject::GetRangeLibrary function. Do not delete the memory associated with the AcMapRangeLibrary pointer.

Do not subclass from this class.

The following example shows how to use this class. It assumes that you have already attached citymap7.dwg from the MAPTUT directory. It queries all objects in the drawing, and labels each polyline and line. 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;
AcMapPropertyAlterationDefinition *pDef = NULL;
AcMapPropertyAlteration *pcAlt = NULL;
AcMapRangeLibrary *pRangeLib = NULL;
AcMapRangeTable *pTable = 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);
pQuery->GetPropertyAlteration(pDef);
pDef->AddAlteration(pcAlt, AcMap::kAlterationTextEntity);
pProj->GetRangeLibrary(pRangeLib);
pRangeLib->Clear();
const char *pcName = "MyTypeRangeTable";
const char *pcDsc = "Table for types";
pRangeLib->AddRangeTable(pTable, pcName, pcDsc);
pTable->AddRangeLine(AcMap::kRangeEq, "polyline", "PLINE");
pTable->AddRangeLine(AcMap::kRangeEq, "line", "LINE");
pTable->AddRangeLine(AcMap::kRangeEq, "lwpolyline", "LWPOLYLINE");
pcAlt->SetExpression("(Range .TYPE MyTypeRangeTable)");
pQuery->EnablePropertyAlteration(Adesk::kTrue);
pQuery->Define(pQBranch);
pQuery->Run();
pDSet->ZoomExtents();
delete pTable ;
delete pcAlt ;
delete pLocationCondition;
delete pQBranch;
delete pQuery;