|
//功 能:从CAD的颜色得到RGB
COLORREF CGlobal::GetColorFromIndex(int colorIndex)
{
if(colorIndex < 0 || colorIndex > 255)
{
ads_alert("传入的颜色号不在0~255之间!");
return 0;
}
BYTE R, G, B;
#ifdef ARX_2002_dll
R = lpszRGBData[colorIndex*3+0];
G = lpszRGBData[colorIndex*3+1];
B = lpszRGBData[colorIndex*3+2];
#else
long zhi = acdbGetRGB(colorIndex);
WORD LOW = LOWORD(zhi);
WORD HIG = HIWORD(zhi);
R = LOBYTE(LOW);
G = HIBYTE(LOW);
B = LOBYTE(HIG);
#endif
return RGB(R,G,B);
//return acdbGetRGB(nColor);
}
获取AcDbDimension里的属性信息
AcDbEntity *pEnt;
AcDbObjectId id;
AcGePoint3d ptPick;
ads_name eName;
if (acedEntSel ("Select a dimension: " , eName, asDblArray (ptPick)) != RTNORM )
return;
acdbGetObjectId (id, eName);
acdbOpenAcDbEntity (pEnt, id, AcDb::kForRead);
//----- Get the id of the block table record which owns the text entity
AcDbDimension *pDim =AcDbDimension::cast (pEnt);
if (pDim == NULL)
{
pEnt->close ();
return;
}
id =pDim->dimBlockId ();
pDim->close ();
AcDbBlockTableRecord *pr;
acdbOpenAcDbObject ((AcDbObject *&) pr, id, AcDb::kForRead);
//----- Iterating the block table record
AcDbBlockTableRecordIterator *pi;
pr->newIterator (pi);
while (!pi->done ())
{
pi->getEntity (pEnt, AcDb::kForRead);
if (pEnt->isKindOf (AcDbMText::desc ()))
{
AcDbMText *pt = (AcDbMText *) pEnt;
char *s = pt->contents ();
acutPrintf (s);
delete s;
}
pEnt->close();
pi->step();
}
pr->close();
|
|