Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to have a combination in ssget?

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
aqdam1978
936 Views, 11 Replies

how to have a combination in ssget?

Hi,

 

I want to have a selection set of both TEXT and MTEXT objects that are in "*/*" format.

 

(ssget (list '(0 . "TEXT") (cons 1 "*/*")));;;;;<=== just works for text objects

(ssget (list '(0 . "MTEXT") (cons 1 "*/*")));;<=== just works for Mtext objects

 

so, how can I combine these two in one SSGET command?

To have one selection set for this conditions (Text or Mtext with "*/*" format value)?

 

Thanks

 

 

 

 

11 REPLIES 11
Message 2 of 12
Kent1Cooper
in reply to: aqdam1978


@aqdam1978 wrote:
....

 

I want to have a selection set of both TEXT and MTEXT objects that are in "*/*" format.

 

(ssget (list '(0 . "TEXT") (cons 1 "*/*")));;;;;<=== just works for text objects

(ssget (list '(0 . "MTEXT") (cons 1 "*/*")));;<=== just works for Mtext objects

 

so, how can I combine these two in one SSGET command?

To have one selection set for this conditions (Text or Mtext with "*/*" format value)?

....


You can use a wildcard there, too: '(0 . "*TEXT").  [That will also find any RTEXT entities, if you ever use those.]

 

And come to think of it, since there are no variables to be evaluated, you should be able to use the shorthand for the (quote) function, without the explicit (list) function, like this:

(ssget '((0 . "*TEXT") (1 . "*/*")))

Kent Cooper, AIA
Message 3 of 12
aqdam1978
in reply to: Kent1Cooper

Hi Kent,

 

Thank you for your solution 🙂

 

Can you tell me about RTEXT? I don't know anything about it.

 

Thanks,

 

Abbas

 

Message 4 of 12
Kent1Cooper
in reply to: aqdam1978


@aqdam1978 wrote:
....

Can you tell me about RTEXT? I don't know anything about it.

....


I haven't actually used it, so I don't remember why I know about it.  It's a way of externally Referencing content of TEXT in a drawing: you create an external text file, and use Rtext to put its text content into a drawing, and if you change that file, it is changed in the Rtext entity in your drawing just as an Xref updates other drawn content.  I think you can therefore have, for example, the same text content in Rtext entities in multiple drawings in different ways [different fonts, sizes, etc.], which you wouldn't be able to do with an Xref.  You can certainly read about it in Help.

Kent Cooper, AIA
Message 5 of 12
aqdam1978
in reply to: Kent1Cooper

Hi Kent,

 

Thank you for your help.

I have another question!:

 

How can we combine another entities to TEXT,MTEXT and RTEXT also? for example attributes:

(0 . "*TEXT") or (0 . "ATTDEF") or (0 . "ATTRIB")

 

It mean if each of them has "*/*" format in values then ssget should select it.

 

And is there any "add" function/operator to combines two or more than two selection sets?

something like this: (add ss1 ss2 ss3 ....) <=== ss=ss1+ss2+ss3+....+ssn

 

Thanks,

Message 6 of 12
devitg
in reply to: aqdam1978

To add ss , you have to iterate at each ss to SSADD to the first SS 

 

It can not be add as a whole.

 

 

Message 7 of 12
aqdam1978
in reply to: devitg

Hi,

 

But I think that SSADD just add one entity to a selection set,

It does not add a SS to another SS!

 

Thanks,

 

Abbas

 

Message 8 of 12
devitg
in reply to: aqdam1978

Get one by one , each enty, from a SS to ssadd to the first SS 

 

 

 

Message 9 of 12
Kent1Cooper
in reply to: aqdam1978


@aqdam1978 wrote:

Hi Kent,

 

Thank you for your help.

I have another question!:

 

How can we combine another entities to TEXT,MTEXT and RTEXT also? for example attributes:

(0 . "*TEXT") or (0 . "ATTDEF") or (0 . "ATTRIB")

 

It mean if each of them has "*/*" format in values then ssget should select it.

 

And is there any "add" function/operator to combines two or more than two selection sets?

something like this: (add ss1 ss2 ss3 ....) <=== ss=ss1+ss2+ss3+....+ssn

 

Thanks,


Again, I'm not at an AutoCAD computer now, but I believe you can find more than one kind of thing in an (ssget) filter, with comma-separated strings as you can use in (wcmatch):

 

(ssget '((0 . "*TEXT,ATTDEF") (1 . "*\*")))

 

However, I believe you can't select Attributes in inserted Blocks this way, but that (ssget) only finds top-level entities.

 

Try searching the Discussion Group for a way to add selection sets together.  What devitg says is correct, that you can't directly add sets together, but you can add one entity at a time, and someone may have made a shortcut routine to do that.  If you don't find a better one, try something like this to add ss2 into ss1:

 

(repeat (sslength ss2)

  (ssadd (ssname ss2 0) ss1)

  (ssdel (ssname ss2 0) ss2)

)

 

That changes the content of both ss1 and ss2, so if for some reason you would need them with their original content later, you'd need to make a copy of each to other variable names and combine those.

Kent Cooper, AIA
Message 10 of 12
Anonymous
in reply to: aqdam1978

Hi,

 

you can use operators "or", "and", "not" etc with dxf code -4 more in example below

 

(ssget "_X" (list
                  (cons -4 "<OR")
                    (cons 0 "TEXT")
                    (cons 0 "MTEXT")
                  (cons -4 "OR>")
                  (cons 1 "*/*")
                ) ;_ list
) ;_ ssget

 

 Ales

Message 11 of 12
aqdam1978
in reply to: Anonymous

Hi Ales,

 

Thank you for your comment.

I didn't know about logical operators in SSGET.

 

Thanks,

 

Abbas

 

Message 12 of 12
devitg
in reply to: aqdam1978

The best use of logical operator in SSGET , regards when you want to get a scope , like to select all circles between a minimus and maximun radious.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost