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