Text Colour within a Block

Text Colour within a Block

Anonymous
Not applicable
1,661 Views
4 Replies
Message 1 of 5

Text Colour within a Block

Anonymous
Not applicable

Hey,

 

I have a bunch of arch drawings where I need to convert everything to colour 253 for our x-refs. The issue is that these arch drawings contain blocks within blocks and many of the blocks are x-clipped (makes a mess if I try exploding or bursting). I found a great lisp (https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-colour-change-for-lisp/td-p/16... ) which will change everything in a block to a certain colour, unfortunately it doesn't work for some of the nested blocks that contain text.

 

Everything I've read says to use ATTSYNC or BATTMAN, but these blocks don't have attributes. 

 

I've attached a drawing of some of the text that I'm struggling with. Any help is appreciated!

 

Cody

 

 

0 Likes
Accepted solutions (2)
1,662 Views
4 Replies
Replies (4)
Message 2 of 5

john.uhden
Mentor
Mentor

We just went through this with someone who wanted all the xref objects to be color 8...

 

(defun c:C253 ()(command "_.layer" "_C" 253 "*|*" ""))

John F. Uhden

0 Likes
Message 3 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

The Mtext object  has color 253, but the internal text content  has color 11 assigned from within the Mtext editor.  That can't be fixed with Layer color or object color assignment.  There are routines out there to remove all internal formatting from Mtext [Search for STRIPMTEXT, for example], but I'm not sure whether or how that can be applied in a nested way to something within a Block definition.  You might be able to incorporate Exploding Mtext into the other routine, but you would also then need to assign the color to the resulting Text -- it seems to get the color of the Mtext's internal assignment.

Kent Cooper, AIA
Message 4 of 5

ActivistInvestor
Mentor
Mentor
Accepted solution

@Anonymous wrote:

Hey,

 

I have a bunch of arch drawings where I need to convert everything to colour 253 for our x-refs. The issue is that these arch drawings contain blocks within blocks and many of the blocks are x-clipped (makes a mess if I try exploding or bursting). I found a great lisp (https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-colour-change-for-lisp/td-p/1629195 ) which will change everything in a block to a certain colour, unfortunately it doesn't work for some of the nested blocks that contain text.

 

Everything I've read says to use ATTSYNC or BATTMAN, but these blocks don't have attributes. 

 

I've attached a drawing of some of the text that I'm struggling with. Any help is appreciated!

 

Cody

 

 


You're most-likely dealing with MTEXT that has local formatting for color, similar to how text can be formatted with different colors in Word or most other word-processing apps.

 

The problem is not unsolvable, but it can be fairly-complicated, especially if you take the (entget)/(entmod) route, which is complicated by the possibility that there can be large amounts of mtext that are distributed over multiple DXF group 3 elements, and formatting codes could be distributed across multiple group codes as well.  

 

Basically, color is specified in MTEXT with the formatting code "{\Cnnn;some text}". This causes 'some text' to have the color whose ACI index is 'nnn'. So for example, the word RED has the color red in the text: "This mtext contains {\C1;RED} text".

 

So you would have to search for and replace (or remove) the color formatting codes from the mtext. If there are other kinds of local formatting (underline or special characters), a dumb strip-mtext routine will most-likely remove everything, including things that would alter the text in ways you didn't intend, so you most-likely have to use a more-specialized routine that only strips out or replaces color formatting, while leaving other formatting codes intact.

 

Message 5 of 5

Anonymous
Not applicable

 

Thanks Kent, STRIPMTEXT will still save me a bunch of time!

 

0 Likes