(cdr (assoc 90 (entget (car (entsel)))))---对于LWPOLYLINE 对于3dPolyLine来说: (length (get-3dpoly-by-alisp (car (entsel)))) 下面是3dpolyline的点坐标的程序。 ;;Using DXF codes vertices are sub entities of the 3dpoly, have to use (entnext ...) (defun get-3dpoly-by-alisp (poly / vtx elst lst) (setq vtx (entnext poly)) (while (/= (cdr (assoc 0 (setq elst (entget vtx)))) "SEQEND") (setq lst (cons (cdr (assoc 10 elst)) lst) vtx (entnext vtx) ) ) (reverse lst) ) ;;Another way using VisualLISP (defun get-3dpoly-by-vlisp (poly / ) (vl-load-com) ;; Split a flat list into a points list (defun 3d-coord->pt-lst (lst) (if lst (cons (list (car lst) (cadr lst) (caddr lst)) (3d-coord->pt-lst (cdddr lst)) ) ) ) (3d-coord->pt-lst (vlax-get (vlax-ename->vla-object poly) 'Coordinates) ) ) ;;test (defun C:test () (if (setq 3dpoly (car (entsel))) (if (= (cdr (assoc 0 (entget 3dpoly))) "POLYLINE") ;;(get-3dpoly-by-alisp 3dpoly) ;1ST way (get-3dpoly-by-vlisp 3dpoly) ;2ND way ) ) ) |