void PrintPropertyValue(AcDbEntity *pEntity, ACHAR* pPropertyName)
{
AcRxMemberIterator * iter
= AcRxMemberQueryEngine::theEngine()->newMemberIterator(pEntity);
if(iter == NULL)
return;
AcRxProperty * prop = AcRxProperty::cast(iter->find(pPropertyName));
if (prop != NULL)
{
Acad::ErrorStatus err = Acad::eOk;
AcRxValue value;
if ((err = prop->getValue(pEntity, value)) == Acad::eOk)
{
// Value type name
acutPrintf(
ACRX_T("\nValue Type Name : %s"),
value.type().name()
);
// Value
ACHAR * szValue = NULL;
int buffSize = value.toString(NULL, 0);
if (buffSize > 0)
{
buffSize++;
szValue = new ACHAR[buffSize];
value.toString(szValue, buffSize);
}
acutPrintf (
ACRX_T("\nValue : %s"),
(szValue == NULL) ? _T("none") : szValue
);
if (szValue)
delete szValue;
// Enum Tag name (only for enum properties)
const MyEnum *val = rxvalue_cast<MyEnum>(&value);
if (val != NULL)
{
const AcRxEnumTag *pEnumTag = value.getEnumTag();
if(pEnumTag != NULL)
{
acutPrintf(
ACRX_T("\nTag : %s"),
pEnumTag->name()
);
// OR
/*acutPrintf(
ACRX_T("\nTag : %s"),
pEnumTag->localName()
);*/
}
}
}
else
{
acutPrintf(ACRX_T("Error Code = %d"), err);
}
}
delete iter;
}