马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
[ 本帖最后由 csharp 于 2014-5-15 11:44 编辑 ]\n\n发帖纪念下,学习 Net 正好一个月时间了
 - [LispFunction("getsamplepts")]
- public static ResultBuffer CurveInters(ResultBuffer rb)
- {
- Document doc = Application.DocumentManager.MdiActiveDocument;
- Transaction transaction = doc.TransactionManager.StartTransaction();
- using (transaction)
- {
- try
- {
- TypedValue[] values = rb.AsArray();
- ObjectId id = (ObjectId)values[0].Value;
- Double d3 = (Double)values[1].Value;
- Curve cv = (Curve)id.GetObject(OpenMode.ForRead);
- Double endPam = cv.EndParam;
- Curve3d ccv1 = cv.GetGeCurve();
- var pts = ccv1.GetSamplePoints(0, endPam, d3);
- TypedValue[] ret = new TypedValue[pts.Count() + 2];
- ret[0] = new TypedValue((int)LispDataType.ListBegin);
- int j = 0;
- for (int i = 1; i < pts.Count() + 1; i++)
- {
- Point3d pt = pts[j].Point;
- ret[i] = new TypedValue((int)LispDataType.Point3d, pt );
- j++;
- }
- ret[pts.Count() + 1] = new TypedValue((int)LispDataType.ListEnd);
- ResultBuffer result = new ResultBuffer(ret);
- transaction.Commit();
- return result;
- }
- catch (Exception)
- {
-
- throw;
- }
- }
- }
获取 AcGeCurve 不用在一个个去构造了,Curve.GetGeCurve 就Ok
令: NETLOAD
命令: (getsamplepts (entlast) 2.)
((2791.46 1188.82 0.0) (2783.71 1267.71 0.0) (2760.76 1343.59 0.0) (2723.48 1413.55 0.0) (2673.29 1474.92 0.0) (2612.13 1525.36 0.0) (2542.32 1562.92 0.0) (2466.53 1586.19 0.0) (2387.67 1594.26 0.0) (2308.74 1586.83 0.0) (2232.77 1564.19 0.0) (2162.66 1527.19 0.0) (2101.08 1477.26 0.0) (2050.4 1416.3 0.0) (2012.55 1346.65 0.0) (1988.98 1270.96 0.0))
|