admin 发表于 2024-5-2 22:46:31

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();


}
页: [1]
查看完整版本: ARX 实体的偏移