Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MasterMiner on December 25, 2019, 08:11:42 AM
Title: Set MTEXT background fill color using VLA - RGB color
Post by: MasterMiner on December 25, 2019, 08:11:42 AM
Merry Christmas and Happy Holidays to all,
I have a specific use case where I am trying to set the background color of Mtext in such a way that it is white in both model and paper space. While one can set it to color 7 with the entmake, that color changes to black when switching to the paper space.
I tried to do the same thing as I did with a hatch in the same project, setting it to RGB 255, 255, 255 with ActiveX, but it seems the background fill color is either set differently or impossible to set with VLA.
The problem is that the vla-put-backgroundcolor command does not seem to work for MTEXT, and the color 255 shows up as a grey in paper space. Does anybody have an idea how I can achieve this?
Thank you,
MM
Title: Re: Set MTEXT background fill color using VLA - RGB color
Post by: Lee Mac on December 25, 2019, 08:20:45 AM
You could use my Background Mask (http://lee-mac.com/mask.html) program, or build your own custom program (http://lee-mac.com/mask.html#custom) which calls the mask:maskentity function defined by the program to do the leg work for you.
The DXF group codes are essentially one more than those used for standard colour groups, i.e. 63, 421, & 431 instead of 62 (ACI), 420 (True Colour), & 430 (Colour Book).
Title: Re: Set MTEXT background fill color using VLA - RGB color
Post by: MasterMiner on December 25, 2019, 08:53:44 AM
Lee,
Thanks a bunch for your response, I should have studied your example more intensely when I first looked through it. I was able to find a way to achieve what I wanted through that. A big thanks for putting all your code online as you do and responding to questions, your website is top notch with its formatting, as well. Have a great 25th!!
For all who may find this interesting, what I found interesting about the solution was the Entmake would not work with true color (421) without also using a base color (63) which is then overriden... strange. Anyways, here's my final code, I hope it can help someone else.
Title: Re: Set MTEXT background fill color using VLA - RGB color
Post by: Lee Mac on December 25, 2019, 09:38:57 AM
You're most welcome MasterMiner - thank you for your gratitude & positive feedback for my site, I really appreciate it.
Note that you could pass the entity name returned by entmakex directly to your mip-mtext-wrap-BB function, and quote (http://lee-mac.com/quote.html) a lot of the literal data: