ARX 实体的偏移

实体的偏移:


//实体的偏移
static void TESToffentcmd()
{
ads_real dis;
if(acedGetReal(_T("\n输入偏移距离"),&dis) != RTNORM)
{
return;
}


ads_name en;
ads_point pt;
if(acedEntSel(_T("\n选择要偏移的实体"),en,pt) != RTNORM)
{
acutPrintf(_T("\n选择实体失败"));
return;
}
AcDbObjectId id;
if(acdbGetObjectId(id,en) != Acad::ErrorStatus::eOk)
{
acutPrintf(_T("\n实体ID获取失败"));
return;
}
AcDbEntity* pEnt;
if(acdbOpenObject(pEnt,id,AcDb::OpenMode::kForRead) != Acad::ErrorStatus::eOk)
{
acutPrintf(_T("\n实体打开失败"));
return;
}
if(pEnt->isKindOf(AcDbCurve::desc()))
{
AcDbCurve* pCur = (AcDbCurve*)pEnt;
AcDbVoidPtrArray ptArr;
pCur->getOffsetCurves(dis,ptArr);
int len = ptArr.length();
acutPrintf(_T("\n有%d个实体"),len);
for(int i = 0;i < len;i ++)
{
AcDbEntity* pEnt2 = (AcDbEntity*)ptArr.at(i);
LoadEntity(pEnt2);
}
}


pEnt->close();


}


你可能感兴趣的:(ARX 实体的偏移)