[每日一码] ARX实例代码 --- 一些常用的对象转字符串函数
/*Utils*///对象ID转字符串
CString getObjectIdToStr(const AcDbObjectId& id)
{
CString str = 采用T("");
ads采用name ent;
acdbGetAdsName(ent, id);
str.Format(采用T("%lx"), ent);
return str;
}
//对象句柄转字符串
CString objToHandleStr(const AcDbObject* obj)
{
ASSERT(obj != NULL);
AcDbHandle handle;
obj->getAcDbHandle(handle);
TCHAR tmpStr;
handle.getIntoAsciiBuffer(tmpStr);
CString str = tmpStr;
return str;
}
CString intDbIdToStr(const Adesk::IntDbId intVal)
{
CString str = 采用T("");
#if !defined(采用WIN64) && !defined (采用AC64)
str.Format(采用T("%d"), intVal);
#else
str.Format(采用T("%I64d"), intVal);
#endif
return str;
}
//布尔值转字符串
CString booleanToStr(bool b)
{
CString str = 采用T("");
if (b)
str = 采用T("True");
else
str = 采用T("False");
return str;
}
页:
[1]