MikeP Posted July 14, 2009 Posted July 14, 2009 Im combining "-view" "w" with "ucs" "world" Here is my lisp. Very simple (defun c:sv (/ -view ucs) (command "-view" "w") (princ) ) Yet. when I finish this on certain objects it rotates the UCS for some reason. So just as a fix. Im adding "(command "ucs" world")" to the code. Yet I need to finish the first "-view" command first. because it need to know a view name and window first. Quote
Se7en Posted July 14, 2009 Posted July 14, 2009 Something like: (while (eq (logand (getvar 'CMDACTIVE)) 1) (command PAUSE)) should do the trick. Quote
Lee Mac Posted July 14, 2009 Posted July 14, 2009 You shouldn't need to localise "-view" and "ucs" as these are not variables, just strings. Quote
MikeP Posted July 14, 2009 Author Posted July 14, 2009 You shouldn't need to localise "-view" and "ucs" as these are not variables, just strings. Dunno, Dont work with out it. here is what I have. Is there an easier way? (defun c:sv (/ -view ucs) (command "-view" "w") (while (eq (logand (getvar 'CMDACTIVE)) 1) (command PAUSE)) (command "ucs" "world") (princ) ) Quote
JeepMaster Posted July 15, 2009 Posted July 15, 2009 I use this between commands if I have a pause. (while (> (getvar "cmdactive") 0) (command pause)) Quote
Lee Mac Posted July 15, 2009 Posted July 15, 2009 Dunno, Dont work with out it. I don't see why it shouldn't. (defun c:sv ( ) (command "-view" "w") (while (eq (logand (getvar 'CMDACTIVE)) 1) (command pause)) (command "ucs" "world") (princ)) Quote
CALCAD Posted July 15, 2009 Posted July 15, 2009 (defun c:sv (/ vname) (setq vname (getstring "\nSave view as: ")) (command "view" "W" vname pause pause) (command "ucs" "") (princ)) Quote
JeepMaster Posted July 15, 2009 Posted July 15, 2009 or this to make it even shorter. (defun c:sv ( / ) (command "view" "W" (getstring "\nEnter view name to save:") pause pause) (command "ucs" "w") (princ)) Quote
Lee Mac Posted July 15, 2009 Posted July 15, 2009 I would use: (defun c:sv ( / ) (command "_.-view" "_W" (getstring [color=Red][b]t[/b][/color] "\nSave view as:") pause pause) (command "_.ucs" "_W") (princ)) Quote
David Bethel Posted July 16, 2009 Posted July 16, 2009 Unless it has changed over the years, a ( getxxx ) call cannot be used inside of a ( command ). -David Quote
JeepMaster Posted July 16, 2009 Posted July 16, 2009 Unless it has changed over the years, a ( getxxx ) call cannot be used inside of a ( command ). -David Then it must have changed because it works fine for me. Plus I've seen it done many times before.:wink: Quote
David Bethel Posted July 16, 2009 Posted July 16, 2009 That is a change. From the R14 Help files: The getxxx user-input functions (getangle, getstring, getint, getpoint, and so on) cannot be used inside the command function. An attempt to do so results in the following message and terminates the function in progress. error: AutoCAD rejected function If user input is needed, issue the getxxx functions beforehand, or place them between successive command function calls. I don't think I would recommend it just because of error trapping and parameter checking. -David 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.