read layer names and react

Discussion in 'AutoCAD' started by Clarence, Jan 14, 2005.

  1. Clarence

    Clarence Guest

    I can get this to set current layer to "0" if on layer "-view" when I turn the vports on. But if I'm turning them off, it doesn't change the layer. And I need this to do both.

    (defun C:VC (/)
    (prompt
    "\n***This command has changed, please see Intranet for more info.***"
    )
    (setq setclay (getvar "clayer"))
    (IF (= setclay "-VIEW")
    (COMMAND "-LAYER" "S" "0" "")
    )

    (checks for some other info)

    (defun c:vponoff ()
    (setq onlayoff (cdr (assoc 62 (tblsearch "layer" "-view"))))
    (cond
    ((>= onlayoff 0)
    (progn
    (setq checktab (getvar "ctab"))
    (cond
    ((= setthistab nil)
    (setq setthistab checktab)))
    (c:tabbin)
    )
    )
    ((< onlayoff 0)
    (progn
    (= (strcase "-view") (strcase (getvar "clayer")))
    (setq setthistab (getvar "ctab"))
    (c:vpon)
    )
    )
    )
    (princ)
    )

    (some other functions here)

    (defun c:vpon ()
    (command "-layer" "s" "0" "")
    (command "-layer" "on" "-view" "")
    (COMMAND "-VPORTS" "L" "OFF" "ALL" "")
    (prompt "\n Viewport<s> On and Unlocked")
    (princ)
    )
    (defun c:eek:ffvp ()
    (command "-layer" "off" "-view" "")
    (COMMAND "-VPORTS" "L" "ON" "ALL" "")
    (setvar "clayer" setclay)
    (prompt "\n Viewport<s> Off and Locked")
    (setq checktab nil)
    (setq setthistab nil)
    (setq setclay nil)
    (setq laytest nil)
    (setq onlayoff nil)
    (setq ftstat nil)
    (princ)
    )

    thanks for any comments/suggestions.

    Thanks
    Clarence
     
    Clarence, Jan 14, 2005
    #1
  2. Clarence

    T.Willey Guest

    ((>= onlayoff 0)
    (progn
    (setq checktab (getvar "ctab"))
    (cond
    ((= setthistab nil)
    (setq setthistab checktab)))
    (c:tabbin)
    )
    )
    With in this cond statement shouldn't you be running your "offvp" function, or do you run it some other place?

    Tim
     
    T.Willey, Jan 14, 2005
    #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.