Author Topic: Multiple MText entities with varying overridden colors back to Bylayer  (Read 1062 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Bull Frog
  • Posts: 327
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.  
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Multiple MText entities with varying overridden colors back to Bylayer
« Reply #1 on: November 17, 2020, 12:34:12 PM »
Assuming that you are looking to remove the colour, have you considered using something like this?

jlogan02

  • Bull Frog
  • Posts: 327
Re: Multiple MText entities with varying overridden colors back to Bylayer
« Reply #2 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.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10