- ;;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
- )
- )
- )
|