Lee Mac Posted June 5, 2009 Posted June 5, 2009 i know i'm behind, since we switched to a reactor, but i thought i'd indulge. Nice solution Alan Quote
Lee Mac Posted June 5, 2009 Posted June 5, 2009 Notice: the above does not take into account for the existence of the layers.. TIM - I forgot my call-back arguments...! (defun c:MacON () (vl-load-com) (if (not lay:react) (progn (setq lay:react (vlr-command-reactor nil (list (cons :vlr-commandWillStart 'ChkLay)))) (princ "\n<< LAYER REACTOR INITIATED >>"))) (princ)) (defun ChkLay ([b][color=Red]reac args[/color][/b] / lay1 lay2) (and (setq lay1 (tblobjname "LAYER" "APPROVED") lay2 (tblobjname "LAYER" "PRELIMINARY")) (setq lay1 (vlax-ename->vla-object lay1) lay2 (vlax-ename->vla-object lay2)) (cond ((vl-every (function (lambda (x) (eq :vlax-true (vla-get-layeron x)))) (list lay1 lay2)) (vla-put-layeron lay2 :vlax-false)) ((vl-every (function (lambda (x) (eq :vlax-false (vla-get-layeron x)))) (list lay1 lay2)) (vla-put-layeron lay1 :vlax-true)))) (princ)) (defun c:MacOFF () (if lay:react (progn (vlr-remove lay:react) (setq lay:react nil) (princ "\n<< LAYER REACTOR DEACTIVATED >>"))) (princ)) ^^ this works now! Your code reminded me! Quote
alanjt Posted June 8, 2009 Posted June 8, 2009 Nice solution Alan thought i'd show a less coding option. Quote
CAB Posted June 12, 2009 Posted June 12, 2009 Another option from another Alan. (defun c:laysw (/ lay) (and (setq lay (tblobjname "LAYER" "APPROVED")) (setq lay (entget lay)) (entmod (subst (cons 62 (- (cdr(assoc 62 lay)))) (assoc 62 lay) lay))) (and (setq lay (tblobjname "LAYER" "PRELIMINARY")) (setq lay (entget lay)) (entmod (subst (cons 62 (- (cdr(assoc 62 lay)))) (assoc 62 lay) lay))) (princ) ) Quote
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.