样条曲线的长度!
要使用autolisp查找样条长度,我使用(command "spline" pt1 pt2 pt3 pt4"" pt1 pt4)
(setq ent1(entlast))
(setq lengthOfSpline(vlax-curve-getDistAtParam ent1 (vlax-curve-getEndParam ent1)))
如何在C++中做同样的事情?
//this doesn't give right value
ptArray contains pt1, pt2, pt3, pt4
for( int i = 0 ; i getEndParam(dummy1);
retVal = spline->getDistAtParam(dummy1,dummy2);
delete spline;
return dummy2;
//i think this is not right as the outputs are different.
//any other way to find it? is there a direct call like object.length() to find out?
谢谢,
帕万。
**** Hidden Message ***** 是的,它们的长度相同
static void ExtTools_doit(void)
{
CPromptEntityResultPtr pRes = CEditor::GetEntity(_T("\nSelect Spline: "));
if(pRes->Status != Acad::eNormal){
return;
}
AcDbEntityPointer pEnt(pRes->ObjectId,AcDb::kForRead);
if(pEnt.openStatus() != eOk){
return;
}
AcDbSpline *pSpline = AcDbSpline::cast(pEnt);
if(pSpline == NULL){
return;
}
double endParam,length;
pSpline->getEndParam(endParam);
pSpline->getDistAtParam(endParam,length);
acutPrintf(_T("\nSpline Length is %g"),length);
}
谢谢,但是我无法验证代码3]
AutoCAD 2009中的等效功能是什么?我在object arx 2009中找不到这个类。
抱歉,那是我自己班上的,试试这个
static void ExtTools_doit(void)
{
ads_name ename = { 0L , 0L };
ads_point pnt= {0.0, 0.0, 0.0};
AcDbObjectId eId;
if(acedEntSel(_T("\nSelect Spline: "),ename,pnt) == RTNORM){
acdbGetObjectId(eId,ename);
}
AcDbEntityPointer pEnt(eId, AcDb::kForRead);
if(pEnt.openStatus() != eOk){
return;
}
AcDbSpline *pSpline = AcDbSpline::cast(pEnt);
if(pSpline == NULL){
return;
}
double endParam,length;
pSpline->getEndParam(endParam);
pSpline->getDistAtParam(endParam,length);
acutPrintf(_T("\nSpline Length is %g"),length);
}
谢谢!
你非常擅长ARX!
这是我的荣幸<谢谢!我觉得我只是ARX的新手……长大后我想像欧文一样
页:
[1]