Changing dimstyles unwanted

Discussion in 'AutoCAD' started by AHILL, Dec 17, 2003.

  1. AHILL

    AHILL Guest

    Can anyone alter this lisp so that it does not overwrite current dimstyle values? When it is used to change the scale of a drawing, it changes certain properties of the drawings dimstyles. It seems to mainly effect the colors 0f ARCH48 and ARCH96 dim styles (although it doesn't seem to be extremely consistant!). Is there something in here that changes dimstyles to some standard within the lisp? any help is appreciated. thanks in advance.
    :
    (defun as ()
    (setvar "cmdecho" 0)
    (setvar "lunits" 4)
    (setvar "filletrad" 0)
    (if (= (getvar "tilemode") 0)(setq tm t))
    (if (= (getvar "tilemode") 1)(setq tm nil))
    ;;; (if (boundp 'scale) () (setq scale 96))
    (if (boundp 'scale) () (setq scale (getvar "dimscale")))
    (if (boundp 'tsize) () (setq tsize 0.09375))
    ;;; (if (boundp 'tsize) () (setq tsize (getvar "textsize")))

    ;; If current value matches one of the standard choices, then use as default value.

    ;; If NOT, then use ROMANS as default.
    (if (= (getvar "textstyle") "ROMANS") (setq tfont 1))
    (if (= (getvar "textstyle") "ROMANT") (setq tfont 2))
    (if (= (getvar "textstyle") "architxt") (setq tfont 3))
    (if (= (getvar "textstyle") "STANDARD") (setq tfont 4))
    (if (= (getvar "textstyle") "STENCIL") (setq tfont 5))
    (if (boundp 'tfont) () (setq tfont 3))

    ;; Load Dcl File
    (setq dcl_id (load_dialog "ARCSCALE"))
    (new_dialog "scales" dcl_id)

    (action_tile "cancel" "(exit)")
    (action_tile "S384" "(setq scale 384)")
    (action_tile "S192" "(setq scale 192)")
    (action_tile "S96" "(setq scale 96)")
    (action_tile "S48" "(setq scale 48)")
    (action_tile "S32" "(setq scale 32)")
    (action_tile "S24" "(setq scale 24)")
    (action_tile "S16" "(setq scale 16)")
    (action_tile "S12" "(setq scale 12)")
    (action_tile "S8" "(setq scale 8)")
    (action_tile "S4" "(setq scale 4)")
    (action_tile "S2" "(setq scale 2)")
    (action_tile "S1" "(setq scale 1)")
    (action_tile "T8" "(setq tsize 0.0833)")
    (action_tile "T9" "(setq tsize 0.09375)")
    (action_tile "T10" "(setq tsize 0.1042)")
    (action_tile "T12" "(setq tsize 0.125)")
    (action_tile "T16" "(setq tsize 0.1667)")
    (action_tile "T24" "(setq tsize 0.25)")
    (action_tile "T48" "(setq tsize 0.5)")
    (action_tile "F1" "(setq tfont 1)")
    (action_tile "F2" "(setq tfont 2)")
    (action_tile "F3" "(setq tfont 3)")
    (action_tile "F4" "(setq tfont 4)")
    (action_tile "F5" "(setq tfont 5)")
    (action_tile "TM" "(setq tm (not tm))")

    ;;
    (if (= tsize 0.0833) (set_tile "T8" "1"))
    (if (= tsize 0.09375) (set_tile "T9" "1"))
    (if (= tsize 0.1042) (set_tile "T10" "1"))
    (if (= tsize 0.125) (set_tile "T12" "1"))
    (if (= tsize 0.1667) (set_tile "T16" "1"))
    (if (= tsize 0.25) (set_tile "T24" "1"))
    (if (= tsize 0.5) (set_tile "T48" "1"))

    ;;
    (if (= tfont 1) (set_tile "F1" "1"))
    (if (= tfont 2) (set_tile "F2" "1"))
    (if (= tfont 3) (set_tile "F3" "1"))
    (if (= tfont 4) (set_tile "F4" "1"))
    (if (= tfont 5) (set_tile "F5" "1"))
    ;;
    (if (= (getvar "dimscale") 384) (set_tile "S384" "1"))
    (if (= (getvar "dimscale") 192) (set_tile "S192" "1"))
    (if (= (getvar "dimscale") 96) (set_tile "S96" "1"))
    (if (= (getvar "dimscale") 48) (set_tile "S48" "1"))
    (if (= (getvar "dimscale") 32) (set_tile "S32" "1"))
    (if (= (getvar "dimscale") 24) (set_tile "S24" "1"))
    (if (= (getvar "dimscale") 16) (set_tile "S16" "1"))
    (if (= (getvar "dimscale") 12) (set_tile "S12" "1"))
    (if (= (getvar "dimscale") 8) (set_tile "S8" "1"))
    (if (= (getvar "dimscale") 4) (set_tile "S4" "1"))
    (if (= (getvar "dimscale") 2) (set_tile "S2" "1"))
    (if (= (getvar "dimscale") 1) (set_tile "S1" "1"))
    ;;; (if (= scale 0.9999) (set_tile "PS" "1"))
    (if (= tm T) (set_tile "TM" "1"))

    (start_dialog)
    (if (= TM T) (tile0))
    (if (/= TM T) (tile1))
    (if (= tfont 1 ) (txt1))
    (if (= tfont 2 ) (txt2))
    (if (= tfont 3 ) (txt3))
    (if (= tfont 4 ) (txt4))
    (if (= tfont 5 ) (txt5))
    (if (= scale 384 ) (dmstyl))
    (if (= scale 192 ) (dmstyl))
    (if (= scale 96 ) (dmstyl))
    (if (= scale 48 ) (dmstyl))
    (if (= scale 32 ) (dmstyl))
    (if (= scale 16 ) (dmstyl))
    (if (= scale 12 ) (dmstyl))
    (if (= scale 8 ) (dmstyl))
    (if (= scale 4 ) (dmstyl))
    (if (= scale 2 ) (dmstyl))
    (if (= scale 1 ) (dmstyl))
    (if (= scale 0.999 ) (dmstyl))
    (unload_dialog dcl_id)
    (princ))

    (defun tile0 ()
    (setvar "tilemode" 0)
    (setvar "DIMSCALE" 1)
    (setvar "PSLTSCALE" 1)
    (setvar "LTSCALE" 0.375)
    (setq ts (* tsize scale))
    (princ))

    (defun tile1 ()
    (setvar "tilemode" 1)
    (command "dimscale" scale)
    (setvar "PSLTSCALE" 0)
    (setvar "LTSCALE" (* 0.375 scale))
    (setq ts (* tsize scale))
    (princ))

    (defun txt1 ()
    (command "._style" "ROMANS" "romans" ts ".8" "" "" "" "")(princ))

    (defun txt2 ()
    (command "._style" "ROMANT" "romant" ts ".8" "" "" "" "")(princ))

    (defun txt3 ()
    (command "._style" "architxt" "architxt" ts ".8" "" "" "" "")(princ))

    (defun txt4 ()
    (command "._style" "STANDARD" "txt" ts ".8" "" "" "" "")(princ))

    (defun txt5 ()
    (command "._style" "STENCIL" "stencil" ts "1.0" "" "" "")(princ))

    (defun dmstyl ()
    (setvar "dimasz" 0.0625)
    (setvar "dimblk1" "_archtick")
    (setvar "dimblk2" "_archtick")
    (setvar "dimcen" 0.125)
    (setvar "dimclrd" 256)
    (setvar "dimclre" 256)
    (setvar "dimclrt" 4)
    (setvar "dimdle" 0.09375)
    (setvar "dimdli" 0.375)
    (setvar "dimexe" 0.09375)
    (setvar "dimexo" 0.0625)
    (setvar "dimfit" 5)
    (setvar "dimgap" 0.0625)
    (setvar "dimrnd" 0.125)
    (setvar "dimsah" 1)
    (setvar "dimtad" 1)
    (setvar "dimtdec" 2)
    (setvar "dimtih" 0)
    (setvar "dimtofl" 1)
    (setvar "dimtoh" 0)
    (setvar "dimtxsty" (getvar "textstyle"))
    (setvar "dimunit" 6)
    (setvar "dimzin" 7)

    (setq sc (getvar "dimscale"))
    (setq number (fix sc))
    (setq Dstyl (strcat "Arch-" (itoa number)))
    (if (tblsearch "dimstyle" Dstyl)
    (command "dimstyle" "s" Dstyl "y")
    (command "dimstyle" "s" Dstyl ))
    (princ)
    )

    (defun c:as () (as))
     
    AHILL, Dec 17, 2003
    #1
  2. AHILL

    ECCAD Guest

    Comment out following lines:
    (if (tblsearch "dimstyle" Dstyl)
    (command "dimstyle" "s" Dstyl "y")
    (command "dimstyle" "s" Dstyl ))
    (princ)
     
    ECCAD, Dec 17, 2003
    #2
  3. AHILL

    AHILL Guest

    I think I understand... I replace all of the specified text with the ";" ? is this correct. This works fine in not altering the existing dimstyle, but now it does not specify the correct dimstyle as current (1/8" scale = Arch96 style for example). Can this function be kept, but just not change arch96 from its definitions within the drawing? basically it changes the colors from always red to by layer, which is not wanted. Make sense? :)

    thanks again for the help.

    adam
     
    AHILL, Dec 17, 2003
    #3
  4. AHILL

    ECCAD Guest

    adam,
    try commenting this one. Seems to be only variable that has 'Red' (4) bit. Make it like:

    ;(setvar "dimclrt" 4)

    Bob
     
    ECCAD, Dec 17, 2003
    #4
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.