dims & background mask..

Discussion in 'AutoCAD' started by C Witt, Apr 14, 2004.

  1. C Witt

    C Witt Guest

    I have this great lisp (see attached).. that adds the background mask to
    all the dim styles in a drawing.. the problem we have is that it won't
    work untill someone actually opens the dimension style manager and then
    closes it.. it's like the style don't really "exist" untill that is done..

    can anyone give me a fix for this? (ie: so you don't need to open
    anything, it just works)

    TIA

    ;; Begin code here
    ;; Written by Lee Ambrosius
    ;; Created on: 4/3/2004

    ;; This program allows you to specify a Dimension Style to add Background Color to
    ;; Not sure why this varies so much from the way Mtext and single Dimension objects work.

    ;; Use the DDim command to set the value that you want and then use the line of LISP code below
    ;; to get the newly set value.
    ;; (assoc -3 (entget (tblobjname "dimstyle" "1-4'' - 1FT") '("*")))

    ;; Use Yellow for the fill color
    ;;(-3 ("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 2) (1070 . 377) (1004 . "1800000001000000020000C3000000000000000000000000")))

    ;;Use Background Color for the fill color
    ;;(-3 ("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 1) (1070 . 377) (1004 . "1800000001000000000000C0000000000000000000000000")))

    ;; Use Bylayer for the fill color
    ;;(-3 ("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 2) (1070 . 377) (1004 . "1800000001000000000000C0000000000000000000000000")))

    ;; Use ByBlock for the fill color
    ;;(-3 ("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 2) (1070 . 377) (1004 . "1800000001000000000000C1000000000000000000000000")))

    ;; Use Color Book Color for the fill color
    ;;(-3 ("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 2) (1070 . 377) (1004 . "3100000001000000B6CFFAC203000000060000004449432031001300000044494320434F4C4F5220475549444528522900")))

    ;; Use True Color for the fill color
    ;;(-3 ("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 2) (1070 . 377) (1004 . "1800000001000000DFF2C0C2000000000000000000000000")))

    ;; Example (dimmask "1'' - 30FT" '("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 1) (1070 . 377) (1004 . "1800000001000000000000C0000000000000000000000000")))
    (defun dimmask (sDimStyleName / tableEnt)
    (if (/= (setq tableEnt (tblobjname "dimstyle" sDimStyleName)) nil)
    (progn
    (setq entData (entget tableEnt '("ACAD_DSTYLE_DIMTEXT_FILL")))
    (if (/= (assoc -3 entData) nil)
    (if (= (nth 0 (cadr (assoc -3 entData))) "ACAD_DSTYLE_DIMTEXT_FILL")
    (setq entData (subst (cons -3 (list '("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 1) (1070 . 377) (1004 . "1800000001000000000000C0000000000000000000000000")))) (assoc -3 entData) entData))
    (setq entData (append entData (list (list -3 '("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 1) (1070 . 377) (1004 . "1800000001000000000000C0000000000000000000000000"))))))
    )
    (setq entData (append entData (list (list -3 '("ACAD_DSTYLE_DIMTEXT_FILL" (1070 . 376) (1070 . 1) (1070 . 377) (1004 . "1800000001000000000000C0000000000000000000000000"))))))
    )
    (entmod entData)
    )
    )
    (princ)
    )
    ;; End code here
     
    C Witt, Apr 14, 2004
    #1
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.