返回二次三次拟合线控制点坐标
- (defun vxs ( ent / PLTYPE obj vtx vtxlst n ptlst) ;提取多段线顶点坐标
- (vl-load-com)
- ; (setq ent (entsel "\n选取多线:\n"))
- (if ent
- (progn
- (setq PLTYPE (cdr (assoc 0 (entget (car ent)))))
- (if (or (= "POLYLINE" PLTYPE) (= "LWPOLYLINE" PLTYPE))
- (progn
- (setq obj (vlax-ename->vla-object (car ent)))
- (setq vtx (vla-get-Coordinates obj))
- (setq vtxlst (vlax-safearray->list (vlax-variant-value vtx)))
- (setq n 0)
- (setq ptlst nil)
- (repeat (/ (length vtxlst) 3)
- (setq ptlst (append ptlst (list (list (nth n vtxlst) (nth (1+ n) vtxlst)(nth (+ n 2) vtxlst) ))))
- (setq n (+ n 3))
- )
- (if ptlst ptlst nil)
- )
- (prompt "\n选取实体不是多义线!")
- );if
- )
- )
- ;if
- ptlst
- );;;;;;;-------------------
- (setq e (entsel "\n选择多段线:"))
- (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length (vxs e ))))
- (mapcar '(lambda (pt)(cons 10 pt)) (vxs e ) ))
- )
- ;;;(vlax-safearray->list (vlax-variant-value (vla-get-Coordinates (vlax-ename->vla-object (car (entsel))))))
|