求教:怎么获得多段线的长度????
我一直没有找到相关的函数,各位帮帮我 参考:static void GetCurveLength_Len(void)
{
// Add your code for command GetCurveLength._Len here
ads_name en;
ads_point pt;
int rc;
rc = acedEntSel("\nSelect an entity: ", en, pt);
if (rc == RTNORM)
{
AcDbObjectId eId;
acdbGetObjectId(eId, en);
AcDbObjectPointerpEnt (eId, AcDb::kForRead);
if ((_stricmp(pEnt->isA()->name(), "AcDbPolyline") == 0) ||
(_stricmp(pEnt->isA()->name(), "AcDb2dPolyline") == 0))
{
AcDbCurve *pCurve = AcDbCurve::cast(pEnt.object());
double endParam;
pCurve->getEndParam(endParam);
double len;
pCurve->getDistAtParam(endParam, len);
CString str;
str.Format(_T("%f"), len);
acedAlert(str);
}
}
} if ((_stricmp(pEnt->isA()->name(), "AcDbPolyline") == 0) ||
(_stricmp(pEnt->isA()->name(), "AcDb2dPolyline") == 0))
改成if (pEnt->isKindOf(AcDbCurve::desc()))比较好
页:
[1]