Setting a layer current based on selected Dimstyle

Discussion in 'AutoCAD' started by rak19, Aug 13, 2004.

  1. rak19

    rak19 Guest

    I'm looking for a routine that will make a specific dimension layer current when a dimension style is set to current and vice versa - can anyone point me toward a solution? Thanks in advance.
     
    rak19, Aug 13, 2004
    #1
  2. Allen Johnson, Aug 13, 2004
    #2
  3. rak19

    OLD-CADaver Guest

    (defun C:DSC ()
    (command ".undo" "begin")
    (setq dscale (getvar "dimscale"))
    (if (setq ndscale (getdist (strcat "Enter New DIMSCALE <" (rtos dscale) ">: ")))
    (setq dscale ndscale))
    (command ".dim1" "dimscale" dscale)
    (if (= (getvar "tilemode") 0)
    (progn
    (command ".psltscale" "1" "ltscale" "0.3333")
    )
    (progn
    (command "psltscale" "0" ".ltscale" (/ (getvar "dimscale") 3.0))
    )
    )
    (txstla)(dmstla)
    (command "dimtxsty" txst)
    (command "dim1" "save" dmst "y")
    (command ".undo" "end")
    (princ)
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun txstla ()(SETVAR "CMDECHO" 0)
    (setq txst (strcat "txt" (rtos (getvar "dimscale") 2 0)))
    (setq txla (tblsearch "layer" "Txt"))
    (if (/= txla nil)
    (setq txclr (abs (cdr (assoc '62 txla))))
    (setq txclr 4)
    )
    (setq ntxst (tblsearch "style" txst))
    (if (/= ntxst nil)
    (progn
    (setq txst (cdr (assoc '2 ntxst)))
    (command "textstyle" txst)
    )
    (progn
    (command ".style" txst "romans" (* (getvar "dimscale") 0.1) "0.7" "" "" "" "")
    )
    )
    (setq ntxla (tblsearch "layer" txst))
    (if (= ntxla nil)
    (command "_layer" "m" txst "c" txclr "txt*" "")
    (command "_layer" "t" txst "s" txst "")
    )
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun dmstla ()(SETVAR "CMDECHO" 0)
    (setq dmst (strcat "dim" (rtos (getvar "dimscale") 2 0)))
    (setq dmla (tblsearch "layer" "Dim"))
    (if (/= dmla nil)
    (setq dmclr (abs (cdr (assoc '62 dmla))))
    (setq dmclr 10)
    )
    (setq ndmla (tblsearch "layer" dmst))
    (if (= ndmla nil)
    (command "_layer" "m" dmst "c" dmclr "dim*" "")
    (command "_layer" "t" dmst "s" dmst "")
    )
    )
     
    OLD-CADaver, Aug 13, 2004
    #3
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.