|
std::map<CString, CString> GetCustomParam(const AcDbObjectId& idBlkRef)
{
std::map<CString, CString> mapName;
AcDbDynBlockReferencePropertyArray DynBlkRefPropArray; //动态块参照属性数组
AcDbDynBlockReference DynBlkRef(idBlkRef); //动态块参照对象
DynBlkRef.getBlockProperties(DynBlkRefPropArray);
AcDbDynBlockReferenceProperty DynBlockReferenceProp; //动态块参照属性
for (int i = 0; i < DynBlkRefPropArray.length(); i++)
{
DynBlockReferenceProp = DynBlkRefPropArray.at(i);
bool bShow = DynBlockReferenceProp.show(); //是否在面板中显示
auto type = DynBlockReferenceProp.propertyType(); //属性类型
CString strName = DynBlockReferenceProp.propertyName().kwszPtr(); //属性名
if (true == bShow)
{
CString strValue;
AcDbEvalVariant value = DynBlockReferenceProp.value();//值
if (DwgDataType::kDwgText == type)
{
strValue = value.resval.rstring;
}
else if (DwgDataType::kDwgReal == type)
{
strValue.Format(_T("%.2f"), value.resval.rreal);
}
mapName[strName] = strValue;
}
}
return mapName;
} |
|