本帖最后由 重慶崽兒 于 2015-6-27 22:18 编辑
我也写了个样条曲线 圆弧取点并画线的,没考虑闭合的情况,写得不好:- (defun c:tt()
- (setq pts nil)
- (setq en (car (entsel)) ent (entget en))
- (setq n (getint "\n请输入段数:"))
- (setq obj (vlax-ename->vla-object en))
- (setq duandian (vlax-curve-getendparam obj))
- (setq changdu (vlax-curve-getDistAtParam obj duandian))
- (setq changdu_1 (/ changdu (float n)))
- (setq n_1 0)
- (while (< n_1 changdu)
- (setq pt (vlax-curve-getpointatdist obj n_1))
- (setq pts (append pts (list pt)))
- (setq n_1 (+ n_1 changdu_1))
- )
- (setq pts (append pts (list (vlax-curve-getendpoint obj))))
- (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length pts))) (mapcar '(lambda (x) (cons 10 x)) pts)))
- (princ)
- )
|