Back for More:
Ok. From the first thread I was turning a layer ON/OFF with a keystroke. If ON-turn off; if OFF-turn on.
Well, the original intent was to totally toggle to layer. ON/OFF, LOCK/UNLOCK, FROZEN/THAW.
To keep those setting local and put back when toggled on.
I found that in order to do this I needed the ASSOC 62 and ASSOC 70 values of that layer.
The 62 I could work with, but never figured out how to work with the 70 value.
Michael S. gave the following code for a VLISP example:
Code:
(defun c:MKSxLayerToggle(/ lName lyr lyrCol)
(setq lyrCol (vla-get-layers (vla-get-activeDocument (vlax-get-acad-object)))) ;;get the layer collection
(setq lName "0") ;;<-set the layer name here
(if (vl-catch-all-error-p (setq lyr (vl-catch-all-apply 'vla-item (list lyrCol lName)))) ;;get specific layer object or error code
(princ) ;;if error, do nothing
(if (= (vla-get-layerOn lyr) :vlax-true) ;;if no error, check if layer is on
(vla-put-layerOn lyr :vlax-false) ;;if on, turn it off
(vla-put-layerOn lyr :vlax-true) ;;if off, turn it on
)
)
(princ)
)
From that I learned a few new things: vla-get-freeze, vla-get-plottable, vla-get-lock.
So, with those I should be able to totally toggle a layer now, correct? Maybe?
And what about FROZEN IN NEW and FROZEN IN CURRENT setting? How do I work with those?