- UID
- 5043
- 积分
- 1347
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-13
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
How to close an AcDbSpline?
By Augusto Goncalves
There is no specific isClosed() method defined for AcDbSpline as there is for
AcDbPolyline. However, in many cases, an AcDbSpline can be closed. Here is a
simple solution to implement a setClosed function for splines. It uses the
getNurbsData() and setNurbsData() AcDbSpline methods. getNurbsData will gather
the information about the spline, including a Boolean closed that indicates if
the spline is closed or not. setNurbsData() takes the same arguments as
getNurbsData(), so only the closed argument will be changed to Adesk::kTrue to
obtain the desired result.
And the same idea can be applied to the .NET Spline.NurbData property.
-
- void setClosed(AcDbSpline *pSpline)
- {
- int degree;
- Adesk::Boolean rational;
- Adesk::Boolean closed;
- Adesk::Boolean periodic;
- AcGePoint3dArray controlPoints;
- AcGeDoubleArray knots;
- AcGeDoubleArray weights;
- double controlPtTol;
- double knotTol;
- // get data from the spline
- pSpline->getNurbsData(degree, rational, closed, periodic,
- controlPoints, knots, weights,
- controlPtTol, knotTol);
- if(closed == Adesk::kTrue)
- return;
- // set as closed
- closed = Adesk::kTrue;
- // apply data back
- pSpline->setNurbsData(degree, rational, closed, periodic,
- controlPoints, knots, weights,
- controlPtTol, knotTol);
- }
|
|