subodh_gis Posted May 25, 2016 Posted May 25, 2016 This routine is selecting Closed Polylines that have more than one text inside. How can we do same with Mpolygon or Hatch instead of Polylines. If a polygon or Hatch entity have more than one text inside, how we will select it? (defun c:FindTxt ( / app ent grp idx lst mni mxa out sel tmp txt ) (getvar "cmdecho") (setvar "cmdecho" 0) (if (setq sel (ssget "_X" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1) (8 . "Layer")))) (progn (repeat (setq idx (sslength sel)) (setq ent (ssname sel (setq idx (1- idx))) lst (cons (cons ent (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) (entget ent)))) lst) ) ) (setq tmp (apply 'append (mapcar 'cdr lst)) mni (car tmp) mxa (car tmp) ) (foreach pnt (cdr tmp) (setq mni (mapcar 'min mni pnt) mxa (mapcar 'max mxa pnt) ) ) (setq app (vlax-get-acad-object) out (ssadd) ) (vla-zoomwindow app (vlax-3D-point mni) (vlax-3D-point mxa)) (foreach grp lst (if (and (setq txt (ssget "_wp" (mapcar '(lambda ( p ) (trans p (car grp) 1)) (cdr grp)) '((0 . "TEXT,MTEXT")))) (< 1 (sslength txt)) ) (ssadd (car grp) out) ) (setq txt nil) (gc) ) (sssetfirst nil out) ) ) (princ) ) (vl-load-com) (princ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.