broncos15 Posted April 6, 2016 Author Share Posted April 6, 2016 I don't think this should work , but you need to convert the layer object to vla-object then put the plotstyle to Block if your Plot Style Mode is not Color-Dependent and it is Named Plot Style mode. Thanks Tharwat! I got it all working, except I have one last question in regards to using setenv. So I have been able to get the reactor on to work using (if (not *Offset2LayerReactor*) (progn (setenv *Offset2LayerReactor* t) (vlr-command-reactor "offset:to:layer" '((:vlr-commandWillStart . PaveTheGround) (:vlr-commandended . GetTheJobDone) ) ) ) ) However, my turning off portion doesn't work, which is (if *Offset2LayerReactor* (progn (vlr-remove (vlr-command-reactor "offset:to:layer" '((:vlr-commandWillStart . PaveTheGround) (:vlr-commandended . GetTheJobDone) ) )) (setenv *Offset2LayerReactor* nil) ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 6, 2016 Share Posted April 6, 2016 Sorry, you have lots of mistakes. Why you are assigning the global variable *Offset2LayerReactor* into setenv ? Setenv accepts strings only as I know and not Boolean or nil. You are removing the reactor by creating it ! Quote Link to comment Share on other sites More sharing options...
broncos15 Posted April 6, 2016 Author Share Posted April 6, 2016 Sorry, you have lots of mistakes. Why you are assigning the global variable *Offset2LayerReactor* into setenv ? Setenv accepts strings only as I know and not Boolean or nil. You are removing the reactor by creating it ! The reason that I was trying to use setenv is that I want the user to only have to turn on the reactor once. That way, every time they open AutoCAD, the reactor is running if they turn it on. So if I understand correctly, I should just use setenv to turn the reactor on or off, then I will need another function that will actually run the reactor based on if setenv is set to on or off. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 6, 2016 Share Posted April 6, 2016 You don't need at all , I already include that with two commands to activate and disable. Did not you notice that ? If you want to activate the reactor in every new or opened drawing , just add the complete name of the command like this example (c:test) and the program must be loaded via ACADDOC.lsp or added to Contents of the command call APPLOAD to get sure that the program is running with any new session. Quote Link to comment Share on other sites More sharing options...
broncos15 Posted April 6, 2016 Author Share Posted April 6, 2016 You don't need at all , I already include that with two commands to activate and disable. Did not you notice that ?If you want to activate the reactor in every new or opened drawing , just add the complete name of the command like this example (c:test) and the program must be loaded via ACADDOC.lsp or added to Contents of the command call APPLOAD to get sure that the program is running with any new session. The variable is only global though that control whether it is turned on though, so when I load it, I still have to turn it on in every new drawing vs. if I used setenv, then I could just turn it on once, and it would remember it. Quote Link to comment Share on other sites More sharing options...
broncos15 Posted April 6, 2016 Author Share Posted April 6, 2016 So I have tried to correct this by adding (if (= (getenv "*Offset2LayerReactor*") "On") (setq *Offset2LayerReactorOnOff* (vlr-command-reactor offset:to:layer '((:vlr-commandWillStart . PaveTheGround) (:vlr-commandended . GetTheJobDone) ) ) ) ) I added this to the top so the reactor is loaded during start up. I then edited the on and off functions to: (defun c:Offset2LayerOn nil (if (not (= (getenv "*Offset2LayerReactor*") "On")) (progn (setenv "*Offset2LayerReactor*" "On") (setq *Offset2LayerReactorOnOff* (vlr-command-reactor offset:to:layer '((:vlr-commandWillStart . PaveTheGround) (:vlr-commandended . GetTheJobDone) ) ) ) ) ) (princ "\nOffset to Layer enabled.") (princ) ) ;;--------------------------------------------;; (defun c:Offset2LayerOff nil (if (= (getenv "*Offset2LayerReactor*") "On") (progn (vlr-remove *Offset2LayerReactorOnOff*) (setenv "*Offset2LayerReactor*" "Off") ) ) (princ "\nOffset to Layer disabled.") (princ) ) Do you see any problem w/ my solution? I am just asking because I know that reactors are extremely finicky. 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.