(vl-load-com) (defun c:ent2pt (/ _kpblc-conv-list-to-3dpoints adoc selset) (defun _kpblc-conv-list-to-3dpoints (lst / res) (cond ((not lst) nil ) (t (setq res (cons (list (car lst) (if (cadr lst) (cadr lst) 0. ) ;_ end of if (if (caddr lst) (caddr lst) 0. ) ;_ end of if ) ;_ end of list (_kpblc-conv-list-to-3dpoints (cdddr lst)) ) ;_ end of cons ) ;_ end of setq ) ) ;_ end of cond res ) ;_ end of defun (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))) ) ;_ end of vla-startundomark (if (= (type (setq selset (vl-catch-all-apply (function (lambda () (ssget "_:L" '((0 . "ARC,CIRCLE,ELLIPSE,*TEXT,HATCH,INSERT,*POLYLINE" ) ) ) ;_ end of ssget ) ;_ end of lambda ) ;_ end of function ) ;_ end of vl-catch-all-apply ) ;_ end of setq ) ;_ end of type 'pickset ) ;_ end of = (foreach ent (mapcar (function entget) ((lambda (/ tab item) (repeat (setq tab nil item (sslength selset) ) ;_ end setq (setq tab (cons (ssname selset (setq item (1- item))) tab ) ;_ end of cons ) ;_ end of setq ) ;_ end of repeat ) ;_ end of lambda ) ) ;_ end of mapcar (cond ((= (cdr (assoc 0 ent)) "LWPOLYLINE") (entmakex (append (list (cons 0 "POINT") (cons 10 (trans (append (cdr (assoc 10 ent)) (list (cdr (assoc 38 ent))) ) ;_ end of append (cdr (assoc 210 ent)) 0 ) ;_ end of trans ) ;_ end of cons ) ;_ end of list (vl-remove-if-not (function (lambda (x) (cdr x) ) ;_ end of lambda ) ;_ end of function (mapcar (function (lambda (x) (assoc x ent))) '(210 8 67 6 62 410 62 370 48 420 440 430 10) ) ;_ end of mapcar ) ;_ end of vl-remove-if-not ) ;_ end of append ) ;_ end of entmakex ) ((= (cdr (assoc 0 ent)) "POLYLINE") (mapcar (function (lambda (x) (entmakex (vl-remove 'nil (append (list (cons 0 "POINT") (cons 10 x) ) ;_ end of list (mapcar (function (lambda (x) (assoc x ent))) '(210 8 67 6 62 410 62 370 48 420 440 430) ) ;_ end of mapcar ) ;_ end of append ) ;_ end of vl-remove ) ;_ end of entmakex ) ;_ end of lambda ) ;_ end of function (_kpblc-conv-list-to-3dpoints (vlax-safearray->list (vlax-variant-value (vla-get-coordinates (vlax-ename->vla-object (cdr (assoc -1 ent))) ) ;_ end of vla-get-coordinates ) ;_ end of vlax-variant-value ) ;_ end of vlax-safearray->list ) ;_ end of _kpblc-conv-list-to-3dpoints ) ;_ end of mapcar ) (t (entmakex (append (list '(0 . "POINT") (cons 10 (cond ((member (cdr (assoc 0 ent)) '("ARC" "CIRCLE" "INSERT" "MTEXT" "ELLIPSE") ) ;_ end of member (trans (cdr (assoc 10 ent)) (cdr (assoc 210 ent)) 0) ) ((= (cdr (assoc 0 ent)) "HATCH") ((lambda (/ minp maxp) (vla-getboundingbox (vlax-ename->vla-object (cdr (assoc -1 ent))) 'minp 'maxp ) ;_ end of vla-getboundingbox (mapcar '(lambda (a b) (* (+ a b) 0.5)) (vlax-safearray->list minp) (vlax-safearray->list maxp) ) ;_ end of mapcar ) ;_ end of lambda ) ) ((= (cdr (assoc 0 ent)) "TEXT") (trans (cdr (assoc (if (or (not (cdr (assoc 72 ent))) (/= (cdr (assoc 72 ent))) ) ;_ end of or 11 10 ) ;_ end of if ent ) ;_ end of assoc ) ;_ end of cdr (cdr (assoc 210 ent)) 0 ) ;_ end of trans ) ) ;_ end of cond ) ;_ end of cons ) ;_ end of list (vl-remove-if-not (function (lambda (x) (cdr x) ) ;_ end of lambda ) ;_ end of function (mapcar (function (lambda (x) (assoc x ent))) '(210 8 67 6 62 410 62 370 48 420 440 430) ) ;_ end of mapcar ) ;_ end of vl-remove-if-not ) ;_ end of append ) ;_ end of entmakex ) ) ;_ end of cond (entdel (cdr (assoc -1 ent))) ) ;_ end of foreach ) ;_ end of if (vla-endundomark adoc) (princ) ) ;_ end of defun |