Logical SSGET funcitons

Logical SSGET funcitons

sudarsann
Advocate Advocate
555 Views
6 Replies
Message 1 of 7

Logical SSGET funcitons

sudarsann
Advocate
Advocate

Hello,

 

How can use the logical ssget filter functions.

There are Hundreds of closed polygons (plots) in a drawing. plots are in "plots" layer.

Each plot having one plot number inside the plot. plot text in "plot_text" layer.

How can I filter a specific plot number (by entering plot number in command prompt) inside the closed polygon.

 

Regards

Sudarsan

0 Likes
Accepted solutions (1)
556 Views
6 Replies
Replies (6)
Message 2 of 7

Kent1Cooper
Consultant
Consultant

If you want to put the plot-number Text in a selection-set variable, try:

(defun C:TEST ()

  (setq

    numtxt (getstring "\nEnter Plot number to find: ")

    numss (ssget "_X" (list (cons 1 numtxt) (cons 410 (getvar 'ctab)))); Text/Mtext with that content in current space

  ); setq

); defun

 

Doing it with (getstring) rather than (getint) means you can have a plot "number" like 17B if you ever use such designations.  [It would also find Attribute Definitions or Dimensions with that text as override, which don't seem likely -- if that might be a problem, you can include the entity type '(0 . "*TEXT") in the (ssget) filter list, which would see either Text or Mtext -- omit the * for only Text.]

 

You can do various things with the results of that [Zoom in around it, perhaps?].

Kent Cooper, AIA
0 Likes
Message 3 of 7

rapidcad
Collaborator
Collaborator

Not sure exactly what you are seeking Sudarsan. Are you trying to build a program to control layers or to select the actual objects through SSGET? I started to answer this but got busy with work and in the meantime, Kent came up with a nice solution. Here's what I had started, but I think you are looking for something to automatically prepare you for each plot. Kent thought along the lines of layout tabs, but I have a feeling you might be trying to isolate layers because hundreds of layouts in one drawing would be impractical.

 

Anyway, in direct answer to how to isolate using SSGET to filter for specific plot number.. 

 

(setq PN (getstring "Enter plot number"))

(setq SS (ssget "_X" (list (cons 1 PN)'(0 . "TEXT")'(8 . "plot_text") )))

 

It's just a start, but hope that helps some. More clarity on the question is needed.

 

Ron

ADN CAD Developer/Operator
0 Likes
Message 4 of 7

sudarsann
Advocate
Advocate

Hello,

I am sorry for my previous unclear mail. My requirement exactly is
How can change the color or lineweight of plot (by entering the inside plot number of that plot in command prompt).
Please see the attachment.
Ex: If I enter the SP1-4 plot number in command prompt, that surrounded related plot have to change its color and lineweight.
Please send lisp.

Regards
Sudarsan

0 Likes
Message 5 of 7

rapidcad
Collaborator
Collaborator

I see what you mean now. This will start you in the right direction, but as far as doing exactly what you are after, I have to leave that to the real programmers.

 

(setq PN (getstring "Enter plot number"))

(setq SS (ssget "_X" (list (cons 1 PN)'(0 . "TEXT")'(8 . "PLOT_NO") )))
(setq COUNTER 0)
(while (setq TEXTENT (ssname SS COUNTER))
       (setq DATA (entget TEXTENT)
      LOCATION (assoc 10 DATA)
      COUNTER (1+ COUNTER)
      )
        )
  )

 

LOCATION is your text insertion point. Data is your entity data for that text.

I think better programming would be to use an entity selection rather than a selection set, but if you never have two entities with the same text value, the above will work.

 

It isn't impossible to find the boundary polyline from the text insertion point, but it is very hard. If you can just get away with drawing an overlaying polyline, you can use the BOUNDARY command from here and draw a new blue polyline over the existing one. Just having the text insertion point is enough to get you there. You could entmod the text so that it is blue, (setvar "CECOLOR" "BLUE") draw the circle through lisp, and use something like this (command "_BOUNDARY" LOCATION).

 

That would work, but it is not very professional - I'm not isolating variables in the example, no error trapping - it's just a concept.

 

HTH

Ron

 

 

ADN CAD Developer/Operator
0 Likes
Message 6 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

Give the attached a shot.  You don't mention drawing the Circle around the Text, or changing the color of the Text itself as well as that of the plot boundary, but since they're in your example drawing, I included them.

 

This was made more complicated by the fact that some of the Text is left-justified and some middle-center-justified [and for all I know, some may have other justifications -- I didn't check every one].  If you can control that and have them all middle-center [or all middle], it could be simplified somewhat.

 

Limited testing.  Does not include a lot of the various typical controls yet.  See also various comments in the file.

Kent Cooper, AIA
0 Likes
Message 7 of 7

sudarsann
Advocate
Advocate

Thank you Mr. Kent Cooper

its is working and very useful in my work

0 Likes