ectech Posted August 31, 2012 Posted August 31, 2012 (edited) Hi everybody, Anyone know how to save the view all defined view, and then plot as pdf. It is unable to save another view. How to make is work ? Thanks ! (setq v 0) (while (command "-view" "w" (strcat "view" (itoa v))) (setq v (1+ v)) );while Edited August 31, 2012 by SLW210 CODE tags not HTML tags!!!!! Quote
MSasu Posted August 31, 2012 Posted August 31, 2012 There are two issues in your code excerpt: the syntax of VIEW command isn't respected; try to call -VIEW on prompter and see that you are missing the coordinates of the corners for desired view. the condition evaluated by WHILE function will always be True, so the code will run infinitely; you should limit somehow the number of iteration - according with what you intend to achieve. Quote
ectech Posted August 31, 2012 Author Posted August 31, 2012 Thank you MSasu ! If I want to use the while loop to get all the user selected view (the coordinates of the corners) and then save it unit user press "esc" or "ok" button. After that I can plot to pdf automatically. From above code, if I selected the first view it will exit the while loop. I think there is some wrong in my code. Is it possible to save all the views by "-view" command by lisp ? There are two issues in your code excerpt: the syntax of VIEW command isn't respected; try to call -VIEW on prompter and see that you are missing the coordinates of the corners for desired view. the condition evaluated by WHILE function will always be True, so the code will run infinitely; you should limit somehow the number of iteration - according with what you intend to achieve. Quote
MSasu Posted August 31, 2012 Posted August 31, 2012 The Window option of -VIEW command will save a new view in drawing as long you provide a name for it and a pair of points (the oposite corners of said view). How are defined those views you want to save? Quote
ectech Posted August 31, 2012 Author Posted August 31, 2012 Is it possible to prompt user select the view, then user select the oppsite corners. After that, it automatically provide the name until user press "esc" button. Thank you ! MSasu. The Window option of -VIEW command will save a new view in drawing as long you provide a name for it and a pair of points (the oposite corners of said view). How are defined those views you want to save? Quote
MSasu Posted August 31, 2012 Posted August 31, 2012 I believe that this is what you were looking for: (setq index 0 answer "Yes") (while (member answer '("Yes" nil)) (command "_.VIEW" "_W" (setq nameView (strcat "view" (itoa (setq index (1+ index))))) pause pause) (initget "Yes No") (setq answer (getkword (strcat "\nCreated view " nameView ". Do you want to add another one <Yes>/No): "))) ) Quote
ectech Posted August 31, 2012 Author Posted August 31, 2012 thank very much for your help ! I believe that this is what you were looking for: (setq index 0 answer "Yes") (while (member answer '("Yes" nil)) (command "_.VIEW" "_W" (setq nameView (strcat "view" (itoa (setq index (1+ index))))) pause pause) (initget "Yes No") (setq answer (getkword (strcat "\nCreated view " nameView ". Do you want to add another one <Yes>/No): "))) ) Quote
ctdlc888 Posted September 12, 2012 Posted September 12, 2012 I believe that this is what you were looking for: (setq index 0 answer "Yes") (while (member answer '("Yes" nil)) (command "_.VIEW" "_W" (setq nameView (strcat "view" (itoa (setq index (1+ index))))) pause pause) (initget "Yes No") (setq answer (getkword (strcat "\nCreated view " nameView ". Do you want to add another one <Yes>/No): "))) ) I want to try this MSasu.How can i load this please? Quote
MSasu Posted September 12, 2012 Posted September 12, 2012 For a quick test just paste the above code to AutoCAD's command line. 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.