PDA

View Full Version : Dimension layer setting



stanmccall
2004-06-21, 03:02 PM
In my dimension toolbar I set the layer to DIM so that all my dimensions are on the DIM layer.
^C^C-layer s dim;;_dimlinear
How can you get it to automatically set it back to the layer it was working on ?

Ed Jobe
2004-06-21, 03:46 PM
Add the following code to your menu mnl or acaddoc.lsp.


;;; CurrentLayer checks and sets current layer.
;;; argument is name of layer to check.
;;; "prevlay" stores the name of the current layer
;;; to be reset later
(defun CurrentLayer (cl color /)
(if (tblsearch "LAYER" cl) ;check to see if desired layer exists
(progn ;if yes, then set to current
(setq oLay (vla-item (vla-get-layers *CurDoc*) cl))
(if (= (vlax-get-property oLay "Freeze") :vlax-True)
(vlax-put-property oLay "Freeze" :vlax-False)
)
(if (= (vlax-get-property oLay "LayerOn") :vlax-False)
(vlax-put-property oLay "LayerOn" :vlax-True)
)
(if (= (vlax-get-property oLay "Lock") :vlax-True)
(vlax-put-property oLay "Lock" :vlax-False)
)
(setq prevlay (getvar "clayer")) ;store current layer
(setvar "clayer" cl)
)
(progn ;else make new and set to current
(setq prevlay (getvar "clayer")) ;store current layer
(command "-layer" "make" cl "color" color "" "")
)
)
)
;;; RestorePrevLayer sets the current layer
;;; to the value stored in "prevlay"
(defun RestorePrevLayer ()
(setvar "clayer" prevlay)
)

Then, replace your menu macro with this: "^C^C(CurrentLayer "Dims" 82);_dimlinear;\\(RestorePrevLayer) ". Use whatever color number is standard for you.

Mike.Perry
2004-06-21, 03:55 PM
Hi

To go with Ed's suggestion that can be found the AUGI Exchange (http://64.227.78.21/empower/exchange/index.asp), take a look at Peter Jamtgaard submission # EX001260 -

AUGI Exchange Search Page (http://64.227.78.21/empower/exchange/searchdownloads.asp)

Have a good one, Mike

Ed Jobe
2004-06-21, 04:04 PM
Come to think of it, I also had mine on there too. :grin:

stanmccall
2004-06-21, 07:15 PM
Thanks
Stan.