Text as layer to surrounded closed polygons

Text as layer to surrounded closed polygons

Anonymous
Not applicable
1,528 Views
10 Replies
Message 1 of 11

Text as layer to surrounded closed polygons

Anonymous
Not applicable

Dear Helpers,

 

I need a lisp that should create layers from texts inside selected polygons and those layers to be applied to self surrounded polygons.

 

Please have a look on attached image and drawing for better understanding.

 

Regards,

T.Brahmanandam

 

0 Likes
Accepted solutions (4)
1,529 Views
10 Replies
Replies (10)
Message 2 of 11

pbejse
Mentor
Mentor

@Anonymous wrote:

 

I need a lisp that should create layers from texts inside selected polygons and those layers to be applied to self surrounded polygons.

 


 

Hold on, you're going about this the wrong way tnvsb, you've been posting one request after another which I believe are somehow connected. I would suggest explaining your ultimate goal then request for one consolidated program.

 

As I've said it before, please post a realistic sample drawing to be tested on. AND show a BEFORE and AFTER scenario.

 

 

 

 

Message 3 of 11

Anonymous
Not applicable

Thank you Sir,

 

I have 500 different zones with unique zone names inside the polygons. But I need all polygons to be in their respective layers with their zone names Sir. So I can work with the polygons whatever I can do like listing the polygon for area, perimeter, Elevation and other data with DATA EXTRACTION TOOLS and so much etc...

0 Likes
Message 4 of 11

Kent1Cooper
Consultant
Consultant
Accepted solution

We don't need any more of a drawing than you've already posted.  Try this [minimally tested]:

 

(defun C:PLLTI (/ plss n); = PolyLines to Layer of Text Inside
  (if (setq plss (ssget '((0 . "LWPOLYLINE"))))
    (repeat (setq n (sslength plss)); then
      (setq pl (ssname plss (setq n (1- n))))
      (if
        (setq txtss
          (ssget "_WP"
            (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget pl)))
            '((0 . "TEXT"))
          )
        )
        (command
          "_.layer" "_new" ; [won't matter if it already exists]
          (setq layname (cdr (assoc 1 (entget (ssname txtss 0)))))
          ""
          "_.chprop" pl "" "_layer" layname ""
        )
      )
    )
  )
  (princ)
)

That assumes User selection of Polylines, presumably with a big window or whatever.  It could be made to find the Polylines itself, and could filter for closed ones, and/or for 4-sided ones, etc.

Kent Cooper, AIA
Message 5 of 11

Anonymous
Not applicable

Thank you so much Sir, It is really appriciated from my end for your spontaneous and smart reply. It helps me more to reduce more time spending on draiwng.

0 Likes
Message 6 of 11

pbejse
Mentor
Mentor
Accepted solution

@Kent1Cooper wrote:

We don't need any more of a drawing than you've already posted.  Try this [minimally tested]:


 

We mere mortals need our B & C. 🙂

 

I hesitated to post this code as I was waiting for more info

FWIW, I had it similar with Kents post.

 

(Defun c:BTL (/ ss s ve pts)
  (if
    (setq ss (ssget '((0 . "LWPOLYLINE"))))
     (repeat (setq s (sslength ss))
       (setq ve (ssname ss (setq s (1- s))))
       (setq pts (mapcar 'cdr
			 (vl-remove-if-not
			   '(lambda (x) (= (car x) 10))
			   (setq ent (entget ve))
			 )
		 )
       )
       (if (setq TextInsideBox (ssget "_WP" pts '((0 . "TEXT"))))
	 (entmod
	   (subst
	     (cons 8 (Cdr (assoc 1 (entget (ssname TextInsideBox 0)))))
	     (assoc 8 ent)
	     ent
	   )
	 )

       )
     )
  )
  (princ)
)

HTH

 

Message 7 of 11

Anonymous
Not applicable

Working like a charm, fentastic thank you for your efforts.

0 Likes
Message 8 of 11

devitg
Advisor
Advisor
Accepted solution

Hi , pbjse, please clear  me how do you cope with SSGET "WP" with no ZOOM to , at least, polyline bounding box??

 

(setq TextInsideBox (ssget "_WP" pts '((0 . "TEXT"))))

 

 

Message 9 of 11

pbejse
Mentor
Mentor
Accepted solution

@devitg wrote:

Hi , pbjse, please clear  me how do you cope with SSGET "WP" with no ZOOM to , at least, polyline bounding box??

 

(setq TextInsideBox (ssget "_WP" pts '((0 . "TEXT"))))

 

 

Your confusing "W" with "WP" mode. "WP" works regardless if the object is visible on screen or not.

 

 

 

 

Message 10 of 11

devitg
Advisor
Advisor

Hi , thanks for it . 

 

0 Likes
Message 11 of 11

-didier-
Advisor
Advisor

Coucou / Hello

 

You write

"Your confusing "W" with "WP" mode. "WP" works regardless if the object is visible on screen or not."

I'm not sure you're right

if the entities are not visible (zoom factor) they are ignored from the selection, at least on my pc

can you check please ?

 

amicalement / regards

Éternel débutant.. my site for learning : Programmer dans AutoCAD

DA

EESignature

0 Likes