Select Text different height 1.5

Select Text different height 1.5

Anonymous
Not applicable
1,339 Views
6 Replies
Message 1 of 7

Select Text different height 1.5

Anonymous
Not applicable

Hello,

I am a beginner in AutoLisp.

 

I tried to make a macro that selects Text from a different height to 1.5, but it does not work.

 

I do not understand what I did as an error.

 

Here is my code

^C^C(sssetfirst nil (ssget "_X" '((0 . "TEXT)(40 . (~1.0))))

 

Thank you in advance.

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

cadffm
Consultant
Consultant

@Anonymous 

I do not understand what I did as an error.

^C^C(sssetfirst nil (ssget "_X" '((0 . "TEXT)(40 . (~1.0))))

 


 

(40 . (~1.0))

This part contains  two errors

1. ~1.0 is an invalif value for groupcode(gc) 40

2. ~ is a wildcard for strings, never for numbers

 

And please: Work step by step, not like bingo

create a working ssget expression first, then you can use it in *whatever you like* for example for sssetfirst

(ssget "_X" '((0 . "TEXT")(-4 . "/=")(40 . 1.5)))

Works? OK, then use it.

(sssetfirst nil (ssget "_X" '((0 . "TEXT)(-4 . "/=")(40 . 1.5))))

 

You talked about "to 1.5", so you like to dearch for TEXT (no MTEXT?) which are not set to 1.5..or?

4free
http://help.autodesk.com/view/OARX/2020/ENU/
http://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-4CEE5072-8817-4920-8A2D-7060F5E16547
http://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-265AADB3-FB89-4D34-AA9D-6ADF70FF7D4B

 

 

Press [F1]
search for the function, read, test and learn.
SSGET
http://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-0F37CC5E-1559-4011-B8CF-A3BA0973B2C3
About Logical Grouping of Selection Filter Tests (AutoLISP)
http://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-5CB54129-22A1-42B9-B97C-2D2F5597F90E
About Wild-Card Patterns in Selection Set Filter Lists (AutoLISP)
http://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-11EA0ABD-AE29-4DD7-92A5-DFF6EC1C9799

 

Sebastian

0 Likes
Message 3 of 7

Anonymous
Not applicable

Thank you for your reply.

Yes, I want to select all Text and MText except those of height 1.5.

0 Likes
Message 4 of 7

cadffm
Consultant
Consultant
Accepted solution

@Anonymous  schrieb:

Thank you for your reply.

Yes, I want to select all Text and MText except those of height 1.5.


Then you have to edit the ssget filter list, because MTEXT is MTEXT and TEXT is TEXT, two different objects/objecttypes.

(ssget "_X" '((-4 . "<or")(0 . "TEXT")(0 . "MTEXT")(-4 . "or>")(-4 . "/=")(40 . 1.5)))

 or just

(ssget "_X" '((0 . "TEXT,MTEXT")(-4 . "/=")(40 . 1.5)))

 

 for now also works

(ssget "_X" '((0 . "*TEXT")(-4 . "/=")(40 . 1.5)))

But this will also find "DTEXT" (old object) and if the next versions creates something new objecttype

who matchs to "*TEXT" , for example an objecttype  "RTFMTEXT"..

What i mean: Think twice about your filter lists.

 

 

Sebastian

0 Likes
Message 5 of 7

Anonymous
Not applicable

thank you very much

0 Likes
Message 6 of 7

Kent1Cooper
Consultant
Consultant

@cadffm wrote:
.... for now also works(ssget "_X" '((0 . "*TEXT")(-4 . "/=")(40 . 1.5)))
But this will also find "DTEXT" (old object) and if the next versions creates something new objecttype who matchs to "*TEXT" , for example an objecttype  "RTFMTEXT"..  ....

 

Just for the record, "DTEXT" has never been an entity type.  It was a command name  [and in fact still is, though you won't find it in the Commands list in Help; the relation to the TEXT command name is a long story], but what it makes have always been just plain "TEXT" entities.

 

However, there is  already another entity type that filtering for "*TEXT" will find [if you have any -- I don't think it's very commonly used] -- "RTEXT."

Kent Cooper, AIA
Message 7 of 7

cadffm
Consultant
Consultant

@Kent1Cooper Kent1Cooper schrieb:
>Just for the record, "DTEXT" has never been an entity type.

 

You are right and i know that, sorry - I had confused it in the hectic with 3DLINE 😉

 

 

 

Kent1Cooper schrieb:
>However, there is already another entity type that filtering for "*TEXT" will find [if you have any -- I don't >think it's very commonly used] -- "RTEXT."

 

As third part object type (Expresstools) I did not want to mention it, but now that you're doing it:
RTexte are more prevalent in older files because 99% uses RTEXT just for autocad native Diesel-Expressions,
what you can do also with fields today (the better choice for this case).
It's really rarely that people uses the FILE option or the extented rtext-diesel functions like XREFS or IMAGES for example.


For the OP, it does not matter if there was DTEXT, it is important to consider what the filter list should look like,
depending on what you want to get for now and in the future.

Sebastian

0 Likes