mojo8997 Posted May 6, 2010 Share Posted May 6, 2010 How can i set hideprecision to 1 before i plot? then set it back to 0 after it plots? im told i could use a reactor but im not that far into my lsp skills yet, any help would be much appreciated! i just found this but i dont quite get it (defun CommandReactor (objReactor lstCommand) (cond ((= (car lstCommand) "PLOT") (print "\nDo stuff before plot: \n") ) ) ) (setq rxnCommand ( vlr-editor-reactor nil '((:vlr-commandwillstart . CommandReactor)))) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 Perhaps (setvar 'HIDEPRECISION 1) Quote Link to comment Share on other sites More sharing options...
mojo8997 Posted May 6, 2010 Author Share Posted May 6, 2010 well i have this but it not working (defun edgplotstart (objReactor lstCommand) (cond ((= (car lstCommand) "PLOT") (print "\n Hideprecision Set to 1") (setvar "hideprecision" 1) ) ) ) (setq rxnCommand ( vlr-editor-reactor nil '((:vlr-commandwillstart . edgplotstart)))) (defun edgplotend (objReactor lstCommand) (cond ((= (car lstCommand) "PLOT") (print "\n Hideprecision Set to 0") (setvar "hideprecision" 0) ) ) ) (setq rxnCommand ( vlr-editor-reactor nil '((:vlr-commandended . edgplotend)))) well i dont think its working Command: _plot "\nHideprecision Set to 1" "\nHideprecision Set to 1" "\nHideprecision Set to 0" "\nHideprecision Set to 1" "\nHideprecision Set to 0" "\nHideprecision Set to 1" Effective plotting area: 10.60 wide by 15.91 high Effective plotting area: 5.69 wide by 1.05 high Plotting viewport 2. Effective plotting area: 5.70 wide by 1.71 high Plotting viewport 3. Plotting viewport 1. "\nHideprecision Set to 0" Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 6, 2010 Share Posted May 6, 2010 Try this: (defun c:HidePrecReactor nil (vl-load-com) ;; Lee Mac ~ 07.05.10 ( (lambda ( data / react ) (if (setq react (vl-some (function (lambda ( reactor ) (if (eq data (vlr-data reactor)) reactor) ) ) (cdar (vlr-reactors :vlr-command-reactor) ) ) ) (if (vlr-added-p react) (vlr-remove react) (vlr-add react) ) (setq react (vlr-command-reactor data (list (cons :vlr-CommandWillStart 'SetHide) (cons :vlr-CommandEnded 'RestoreHide) (cons :vlr-CommandCancelled 'RestoreHide) ) ) ) ) (princ (if (vlr-added-p react) "\n** Reactor Activated **" "\n** Reactor Deactivated **" ) ) react ) "Prec-Reactor" ) (princ) ) (defun SetHide ( reactor params ) (if (eq (strcase (car params)) "PLOT") (progn (setq oldHide (getvar 'HIDEPRECISION)) (setvar 'HIDEPRECISION 1) (princ (strcat "\n<< HIDEPRECISION set to 1 >>")) ) ) (princ) ) (defun RestoreHide ( reactor params ) (if (and oldHide (eq (strcase (car params)) "PLOT")) (progn (setvar 'HIDEPRECISION oldHide) (princ (strcat "\n<< HIDEPRECISION set to " (itoa oldHide) " >>")) (setq oldHide nil) ) ) (princ) ) Turn on the reactor using HidePrecReactor (turn it on once), and turn it off with the same command. Quote Link to comment Share on other sites More sharing options...
mojo8997 Posted May 7, 2010 Author Share Posted May 7, 2010 nice!! man your badass, i was telling my friend about you lol (hes the one teaching me lisp) it is getting caught at here (and oldHide (eq (strcase (car params) "PLOT"))) i changed it to (and oldHide (eq (strcase (car params)) "PLOT")) but something is still happening funny so i just made it (defun RestoreHide ( reactor params ) (if (and oldHide (eq (strcase (car params)) "PLOT")) (progn (setvar 'HIDEPRECISION 0) (princ (strcat "\n<< HIDEPRECISION set to 0 >>")) ) ) (princ) ) thanks a lot!! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share Posted May 7, 2010 Ahh nice one - I think I perhaps wrote it a bit too quick Thanks for the compliments Updated my original code to sort out that typo 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.