antistar Posted April 6, 2011 Share Posted April 6, 2011 Thats a fair point. From my earlier post theres no need to define new commands on the fly. As is VVA's post I think its best just to change the offset distance (defun c:endOffset() (if *unknownReactor* (vlr-remove *unknownReactor*)) ) (defun c:beginOffset () (or *unknownReactor* (setq *unknownReactor* (vlr-command-reactor nil '((:vlr-unknownCommand . createOffset))))) (defun createOffset (<rea> <args> / acadDoc cmd offsetDist ) (setq acadDoc (vla-get-activedocument (vlax-get-acad-object )) cmd (car <args>)) (if (and (not (equal (setq offsetDist (atoi cmd)) 0.0 1e-6)) (< 1 offsetDist 15000) ) (progn (setvar 'offsetdist offsetDist) (vla-sendcommand acadDoc (strcat "._offset ")))) ) ) (c:beginOffset) (princ "\nReactor started. Type endOffset to stop") (princ) Hi Jammie, First congratulations for his work. I work with "CAD2002" and the routine goes in a loop when I type the decimal value for example: 1.5 ... 2.6 ... 10.3... That is, only runs with integers. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 6, 2011 Share Posted April 6, 2011 Hi Jammie,First congratulations for his work. I work with "CAD2002" and the routine goes in a loop when I type the decimal value for example: 1.5 ... 2.6 ... 10.3... That is, only runs with integers. Thanks in advance. Replace createOffset sub with this one: (defun createOffset (<rea> <args> / off) (if (and (setq off (distof (car <args>))) (> off 0.)) (vla-sendcommand (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) (strcat "_.offset " (rtos off) " ") ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
antistar Posted April 6, 2011 Share Posted April 6, 2011 Replace createOffset sub with this one: (defun createOffset (<rea> <args> / off) (if (and (setq off (distof (car <args>))) (> off 0.)) (vla-sendcommand (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) (strcat "_.offset " (rtos off) " ") ) ) (princ) ) Cool code Alan. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 6, 2011 Share Posted April 6, 2011 Cool code Alan.Thanks for your help. You're welcome. Quote Link to comment Share on other sites More sharing options...
jammie Posted April 7, 2011 Share Posted April 7, 2011 Hi Jammie,First congratulations for his work Thanks for that scamaru, glad you are getting some use of the code. Replace createOffset sub with this one: Alan thanks for the code update Regards Jammie Quote Link to comment Share on other sites More sharing options...
autolisp Posted April 7, 2011 Share Posted April 7, 2011 Thanks for that scamaru, glad you are getting some use of the code. Alan thanks for the code update Regards Jammie error at lisp error: malformed list on input (vl-load-com) (defun c:endOffset() (if *unknownReactor* (vlr-remove *unknownReactor*)) ) (defun c:beginOffset () (or *unknownReactor* (setq *unknownReactor* (vlr-command-reactor nil '((:vlr-unknownCommand . createOffset))))) (defun createOffset (<rea> <args> / off) (if (and (setq off (distof (car <args>))) (> off 0.)) (vla-sendcommand (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) (strcat "_.offset " (rtos off) " ") ) ) (princ) ) (c:beginOffset) (princ "\nReactor started. Type endOffset to stop") (princ) Quote Link to comment Share on other sites More sharing options...
jammie Posted April 7, 2011 Share Posted April 7, 2011 Hi Autolisp, You appear to be missing a closing bracket in the function c:beginOffset. This is what is causing the error : malformed list on input Jammie 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.