Jump to content
subodh_gis

Select Mpolygon or Hatch entity that have more that one text entity inside

Recommended Posts

subodh_gis

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)

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...