MText Background Color (sysvar or DXF #)

Discussion in 'AutoCAD' started by Matt W, Jul 16, 2004.

  1. Matt W

    Matt W Guest

    Two questions:

    Is there a sysvar for the MText Background??

    If not, how can I enable the background (programmatically) from this code
    snippet??
    I know I'm doing something wrong, but I can't put my finger on it.

    Code:
    (defun C:BGTest ( / pt1 pt2 eLast ent2 strString strNewString)
    (command "textstyle" tStyle (initdia) "mtext" (setq pt1 (getpoint "\n
    Pick first corner of MText box..."))
    (setq pt2 (getcorner pt1 "\n Pick second corner of MText box...")))
    (setq eLast (entlast))
    (setq ent2 (entget eLast))
    (setq strString (cdr (assoc 1 ent2)))
    (setq strNewString (subst (cons 90 0) (assoc 90 ent2) ent2)) ;; Is it DXF
    90 for the background??!?
    (entmod strNewString)
    (princ)
    )
    
    Thanks in advance!
     
    Matt W, Jul 16, 2004
    #1
  2. From Lee Ambroious' MTEXTMASK:

    (progn
    (cond ((= kWordBackgroundMask "None")
    (setq mask_list (list (cons 90 2)(cons 63 0)(cons 45 dOffset)(cons 441 0))
    dxf90 2
    dxf63 nil
    dxf45 nil
    dxf441 nil
    )
    )
    ((and (= kWordBackgroundMask "Color")(/= (assoc 420 maskClr) nil))
    (setq mask_list (list (cons 90 1)(cons 63 1)(cons 421 (cdr (assoc 420
    maskClr)))(cons 45 dOffset)(cons 441 (cdr (assoc 420 maskClr))))
    dxf90 1
    dxf63 2
    dxf45 dOffset
    dxf441 (cdr (assoc 420 maskClr))
    )
    )
    ((and (= kWordBackgroundMask "Color")(= (assoc 420 maskClr) nil))
    (setq mask_list (list (cons 90 1)(cons 63 (cdr (assoc 62 maskClr)))(cons 45
    dOffset)(cons 441 2146608))
    dxf90 1
    dxf63 (cdr (assoc 62 maskClr))
    dxf45 dOffset
    dxf441 nil
    )
    )
    ((= kWordBackgroundMask "Background")
    (setq mask_list (list (cons 90 3)(cons 63 3)(cons 45 dOffset)(cons 441 0))
    dxf90 3
    dxf63 256
    dxf45 dOffset
    dxf441 0
    )
    )
    )
     
    Allen Johnson, Jul 16, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.