Aftertouch Posted April 10, 2017 Share Posted April 10, 2017 Hello all, I found the code below on the interwebs, It forces text and hatch objects to a certain layer. (Changes to the layer, makes object, changes back). for some reason the XATTACH command does place the XREF on the wanted layer, but doesnt set my current layer back to the previous setting... Why does XATTACH act different than Text commands??? (prompt " \nLoad Only....Do NOT Run...") (vl-load-com) ;**************************************** (vlr-command-reactor nil '((:vlr-commandWillStart . startCommand))) (vlr-command-reactor nil '((:vlr-commandEnded . endCommand))) (vlr-command-reactor nil '((:vlr-commandCancelled . cancelCommand))) ;****************************************************** (defun startCommand (calling-reactor startcommandInfo / thecommandstart) (setq OldLayer (getvar "CLAYER")) (setq thecommandstart (nth 0 startcommandInfo)) (cond ((= thecommandstart "XATTACH") (setvar "CLAYER" "4")) ((= thecommandstart "MTEXT") (setvar "CLAYER" "4")) ((= thecommandstart "DTEXT") (setvar "CLAYER" "4")) ((= thecommandstart "HATCH") (setvar "CLAYER" "6")) ((= thecommandstart "BHATCH") (setvar "CLAYER" "6")) );cond (princ) );defun ;**************************************************** (defun endCommand (calling-reactor endcommandInfo / thecommandend) (setq thecommandend (nth 0 endcommandInfo)) (cond ((= thecommandend "XATTACH") (setvar "CLAYER" OldLayer)) ((= thecommandend "MTEXT") (setvar "CLAYER" OldLayer)) ((= thecommandend "DTEXT") (setvar "CLAYER" OldLayer)) ((= thecommandend "HATCH") (setvar "CLAYER" OldLayer)) ((= thecommandend "BHATCH") (setvar "CLAYER" OldLayer)) );cond (princ) );defun ;******************************************************** (defun cancelCommand (calling-reactor cancelcommandInfo / thecommandcancel) (setq thecommandcancel (nth 0 cancelcommandInfo)) (cond ((= thecommandcancel "XATTACH") (setvar "CLAYER" OldLayer)) ((= thecommandcancel "MTEXT") (setvar "CLAYER" OldLayer)) ((= thecommandcancel "DTEXT") (setvar "CLAYER" OldLayer)) ((= thecommandcancel "HATCH") (setvar "CLAYER" OldLayer)) ((= thecommandcancel "BHATCH") (setvar "CLAYER" OldLayer)) );cond (princ) );defun ;********************************************************* (princ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.