TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jlogan02 on November 17, 2020, 12:26:40 PM

Title: Multiple MText entities with varying overridden colors back to Bylayer
Post by: jlogan02 on November 17, 2020, 12:26:40 PM
I have multiple instances of mtext notes that have the color overridden to
colors 1, 15, 30, 150 for standards notes.

This is what I've got that seems to be working. Just want to see if my approach is correct.
Basically, I'll put a separate (progn statement for each instance of Mtext color. Is that the correct approach?

Code - Auto/Visual Lisp: [Select]
  1.  (if (setq sel (ssget "_X" '((0 . "mtext"))));;MTEXT
  2.    (repeat (setq int1 (sslength sel))
  3.      (setq obj1 (vlax-ename->vla-object (ssname sel (setq int1 (1- int1)))))
  4.     (progn (setq txt (vla-get-textstring obj1))
  5.            (while (vl-string-search "\\C1;" txt) (setq txt (vl-string-subst "\\C256;" "\\C1;" txt)))
  6.            (vla-put-textstring obj1 txt)
  7.       )
  8.     (progn (setq txt1 (vla-get-textstring obj1))
  9.      (setq txt1 (vla-get-textstring obj1))
  10.            (while (vl-string-search "\\C15;" txt1) (setq txt1 (vl-string-subst "\\C256;" "\\C15;" txt1)))
  11.            (vla-put-textstring obj1 txt1)
  12.       )
  13.     )
  14.   )
  15.  
Title: Re: Multiple MText entities with varying overridden colors back to Bylayer
Post by: Lee Mac on November 17, 2020, 12:34:12 PM
Assuming that you are looking to remove the colour, have you considered using something like this (https://www.theswamp.org/index.php?topic=31584.0)?
Title: Re: Multiple MText entities with varying overridden colors back to Bylayer
Post by: jlogan02 on November 17, 2020, 01:37:02 PM
Thanks Lee,

I should have said, the example is part of a larger routine that handles color changes for other entities.