how to filter underlined MTEXTs

how to filter underlined MTEXTs

msarqui
Collaborator Collaborator
1,031 Views
17 Replies
Message 1 of 18

how to filter underlined MTEXTs

msarqui
Collaborator
Collaborator

Hello guys,

 

Could someone help me please.

I would like to know how to filter underlined MTEXTs in a selection set with SSGET.

I need to select MTEXTs, except those that are underlined.

 

Thanks,

Marcelo

0 Likes
Accepted solutions (2)
1,032 Views
17 Replies
Replies (17)
Message 2 of 18

Jonathan3891
Advisor
Advisor

Give this a try:

 

(SETQ SS (SSGET '((0 . "TEXT,MTEXT")(1 . "*%%U**%%u*,{*\L*}"))))

Jonathan Norton
Blog | Linkedin
0 Likes
Message 3 of 18

msarqui
Collaborator
Collaborator

Hi Jonathan

 

Thanks for reply but it returns nil. The selection does not select anything

I tested on the attached exemple.

 

Marcelo

0 Likes
Message 4 of 18

kerry_w_brown
Advisor
Advisor

Perhaps try something like

(SETQ SS (SSGET '((0 . "TEXT,MTEXT")(1 . "*%%U*,*%%u*,*{*\L*}"))))

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 5 of 18

Jonathan3891
Advisor
Advisor

Thats strange. It works fine on the drawing I attached, but it wont work on your drawing.


Jonathan Norton
Blog | Linkedin
0 Likes
Message 6 of 18

msarqui
Collaborator
Collaborator

Hi Kerry,


@KerryBrown wrote:

Perhaps try something like

(SETQ SS (SSGET '((0 . "TEXT,MTEXT")(1 . "*%%U*,*%%u*,*{*\L*}"))))

 


This is actually selecting underlined MTEXTs and I would like to exclude them. But, you show me the way and with a small change I could get it work.

 

 

Here is what I did:

 

(setq ss2 (ssget "_:S:L" '((0 . "*TEXT")
			    (-4 . "<NOT")
	                            (1 . "*%%U*,*%%u*,*{*\L*}")	;Avoid texts underlined
	                    (-4 . "NOT>")
			    (-4 . "<NOT")
	                            (62 . 1)			;Avoid texts in RED color
	                    (-4 . "NOT>")
)))

 

Many thanks.

Marcelo

0 Likes
Message 7 of 18

msarqui
Collaborator
Collaborator
@Anonymous_dude wrote:

Thats strange. It works fine on the drawing I attached, but it wont work on your drawing.


 

Well, strange it is. I did a test in your drawing and it works. I have no idea why...

0 Likes
Message 8 of 18

dbroad
Mentor
Mentor
Accepted solution

Technically, if you only want to select MTEXT objects that have no underlined words, you would need the following:

 

(SETQ SS (SSGET '((0 . "MTEXT")(1 . "~*{*\L*"))))

Mtext has no uses for %%U or %%u.

 

If you want to select either text or mtext that is not underlined:

 

(setq ss (ssget	'((-4 . "<OR")
		  (-4 . "<AND")
		  (0 . "MTEXT")
		  (1 . "~*{*\L*")
		  (-4 . "AND>")
		  (-4 . "<AND")
		  (0 . "TEXT")
		  (1 . "~*%%U*,~*%%u*")
		  (-4 . "AND>")
		  (-4 . "OR>")
		 )
	 )
)
Architect, Registered NC, VA, SC, & GA.
Message 9 of 18

msarqui
Collaborator
Collaborator
Hello dbroad
 
 
In my tests, your suggestion will not select:
 
BOLD, ITALIC, UNDERLINE, OVERLINE
 
But it will select: 
NORMAL, WIDTH, STRIKETHROUGH
 

Weird?
 
Please, see attached file
0 Likes
Message 10 of 18

kerry_w_brown
Advisor
Advisor

msarqui,

You will need to be more explicit with your question.

What test are you using exactly.

You have made no previous mention of those properties.

 

weird, I don't recall your original post asking for the EXCLUSION of underlined text ??

 

 

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 11 of 18

kerry_w_brown
Advisor
Advisor

 

What is the DXF 1 value of the Mtext that is not being selected ??

 

Try something like this on the MText

 

(defun c:dxflist (/ eko)
  (setq eko (getvar 'cmdecho))
  (setvar 'cmdecho 0)
  (setq
    *lent* (entget
             (car (entsel "\nSelect entity to display its DXF value data "))
             '("*")
           )
  )
  (textscr)
  (list *lent*)
  (foreach n *lent* (print n))
  (setvar 'cmdecho eko)
  (princ)
)

// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 12 of 18

msarqui
Collaborator
Collaborator

@msarqui wrote:

Hello guys,

 

Could someone help me please.

I would like to know how to filter underlined MTEXTs in a selection set with SSGET.

I need to select MTEXTs, except those that are underlined.

 

Thanks,

Marcelo


 

Hi Kerry,

 

Thanks for the reply.

In my first original post I DO asked for the EXCLUSION of underlined MTEXTs

In my drawings I have different types of MTEXTs formatting. Someones with BOLD, others with ITALIC, others with OVERLINE, etc.

I would like to select all of them, except (excluding) those that are underlined

In my tests, I copied and pasted @dbroad's suggestion in the command line and I selected the MTEXTS to see wich ones are highlighted.

 


@msarqui wrote:
Hello @dbroad
 
 
In my tests, your suggestion will not select:
 
BOLD, ITALIC, UNDERLINE, OVERLINE
 
But it will select: 
NORMAL, WIDTH, STRIKETHROUGH
 

Weird?
 
Please, see attached file

I made a mistake in my last post. @dbroad's suggestion is working very well with underlined MTEXTs. Sorry about that Smiley Embarassed

The only problem is that is also excluding the BOLD, ITALIC and OVERLINED ones.

 

 

0 Likes
Message 13 of 18

hmsilva
Mentor
Mentor
Accepted solution

Marcelo,

dbroad's filter list is correct, just add a second backslash in (1 . "~*{*\\L*")

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 14 of 18

doni49
Mentor
Mentor

@msarqui wrote:

The only problem is that is also excluding the BOLD, ITALIC and OVERLINED ones.


Paste the following into your command line, when prompted, select one of the text elements that it's failing to select and paste the results here.

 

(assoc 1 (entget(car(entsel))))



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

0 Likes
Message 15 of 18

dbroad
Mentor
Mentor

@hmsilva,

I did test it before I posted it and it did work fine with a single backslash.  It might also work fine with a second escaping backslash.

 

Funny what got marked as a solution.  Oh well.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 16 of 18

hmsilva
Mentor
Mentor

@Anonymous wrote:

@hmsilva,

I did test it before I posted it and it did work fine with a single backslash.  It might also work fine with a second escaping backslash.

 

Funny what got marked as a solution.  Oh well.


@dbroad,

I did test with the dwg in msg#9 and only with a second backslash works as expected...rejecting underlined text...

I did also test in others dwgs, and with a single backslash works as expected, and with double backslashes works as expected also...

Being transversal to several tests, the 'double backslashes' in the list, do you mind to add a second backslash to your code, to provide a more universal solution?

 

Henrique

EESignature

Message 17 of 18

dbroad
Mentor
Mentor

Interesting.  I missed that post.  Thanks for adding the extra backslash!

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 18 of 18

hmsilva
Mentor
Mentor

@Anonymous wrote:

Interesting.  I missed that post.  Thanks for adding the extra backslash!


You're welcome, dbroad!

Henrique

EESignature

0 Likes