Author Topic: How to change color for part of MText?  (Read 644 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1421
How to change color for part of MText?
« on: May 29, 2023, 09:48:52 AM »
Hi all

I am trying to edit Text in Dimension with this lisp but gives as image.
How to modify Text to be as image.

Thanks in advance.


Code: [Select]
(defun c:F2D ( / DIMSS DTX)
  (setvar "cmdecho" 0)
  (setq DIMSS (SSGET '((0 . "*DIMENSION"))))
  (SETQ TYP "{\H0.9375x;\Q20;\W0.7;\C1;AS STRUCK FROM MOULD FINISH\XAS PER APPROVED SAMPLE}")
  (setq c -1)
  (repeat (sslength DIMSS)
    (setq DTX (ENTGET (SSNAME DIMSS (setq c (1+ c)))))
    (setq DTX (SUBST (CONS 1 TYP) (ASSOC 1 DTX) DTX)
  )
    (ENTMOD DTX)
    )
  (PRINC)
  )

chaev

  • Mosquito
  • Posts: 4
Re: How to change color for part of MText?
« Reply #1 on: May 29, 2023, 10:23:22 AM »
This should do it. Double slashes and the curly brackets close after the red part.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:F2D ( / DIMSS DTX)
  2.   (setvar "cmdecho" 0)
  3.   (setq DIMSS (SSGET '((0 . "*DIMENSION"))))
  4.   (SETQ TYP "{\\H0.9375x;\\Q20;\\W0.7;\\C1;AS STRUCK FROM MOULD FINISH}\\XAS PER APPROVED SAMPLE")
  5.   (setq c -1)
  6.   (repeat (sslength DIMSS)
  7.     (setq DTX (ENTGET (SSNAME DIMSS (setq c (1+ c)))))
  8.     (setq DTX (SUBST (CONS 1 TYP) (ASSOC 1 DTX) DTX)
  9.           )
  10.     (ENTMOD DTX)
  11.     )
  12.   (PRINC)
  13.   )
  14.  

HasanCAD

  • Swamp Rat
  • Posts: 1421
Re: How to change color for part of MText?
« Reply #2 on: May 29, 2023, 10:32:52 AM »
This should do it. Double slashes and the curly brackets close after the red part.

Code - Auto/Visual Lisp: [Select]
  1. ...
  2.   (SETQ TYP "{\\H0.9375x;\\Q20;\\W0.7;\\C1;AS STRUCK FROM MOULD FINISH}\\XAS PER APPROVED SAMPLE")
  3. ...
  4.  

Thanks allot.