skipsophrenic Posted February 3, 2009 Share Posted February 3, 2009 Hi all, Am working on a bit of code to help out my workload, alot of times i'm working at wierd angles on BIG plans, so i do named ucs's to make life easier. Here's the problem, I've written the code posted below, but it doesn't seem to work - can someone tell me where i've gon wrong? ;******************************************************************* ;******************************************************************* ;** ** ;** THIS ROUTINE IS FOR RESTORING ** ;** A NAMED UCS AND RUNNING THE ** ;** PLAN COMMAND AT THE SAME TIME ** ;** ** ;** ** ;** (C) PETER SMITH 03-02-2009 ** ;** PROVIDED FOR USE BY ALL PLEASE ** ;** INCLUDE THIS HEADER WHEN COPYING ** ;** ** ;** CONTACT TO REPORT PROBLEMS: skipsophrenic@hotmail.com ** ;** ** ;******************************************************************* ;******************************************************************* defun c:ucsplan () ;defined function (command "ucs" "na" "re") ;runs the ucs restore option (getstring "\nName of ucs:") ;asks for the name of the ucs wanted (command "Plan" "C") runs the plan command and set's it to current ucs ) (princ) Quote Link to comment Share on other sites More sharing options...
CarlB Posted February 3, 2009 Share Posted February 3, 2009 Maybe this: (command "ucs" "na" "re" pause) so you don't need the 'getstring' which I think is the problem having is separate. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 3, 2009 Share Posted February 3, 2009 Not sure why the "na", but maybe: (defun c:ucsplan (/ uNm) (if (and (setq uNm (getstring t "\nSpecify Name of UCS: ")) (tblsearch "UCS" uNm)) (progn (command "_ucs" "Re" uNm) (command "_plan" "c")) (princ "\nUCS Name not Found. ")) (princ)) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 3, 2009 Share Posted February 3, 2009 Carl, is the UCS prompts different for ACAD '08? Why is the "na" required? Quote Link to comment Share on other sites More sharing options...
skipsophrenic Posted February 3, 2009 Author Share Posted February 3, 2009 To state i want to input a named ucs that I had saved previously - just off to test the code now Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 3, 2009 Share Posted February 3, 2009 Hmmm... on '04, I just type "UCS" "RE" and then type the name of the UCS.... and it restores it ... Quote Link to comment Share on other sites More sharing options...
skipsophrenic Posted February 3, 2009 Author Share Posted February 3, 2009 Tested and keep getting the following: Command: _appload ucsplan.lsp successfully loaded. Command: ucsplan Unknown command "UCSPLAN". Press F1 for help. Quote Link to comment Share on other sites More sharing options...
CarlB Posted February 3, 2009 Share Posted February 3, 2009 Lee, Yes prompts are different in 2008: Command: ucs Current ucs name: xxx Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis] : na Enter an option [Restore/Save/Delete/?]: r Enter name of UCS to restore or [?]: Quote Link to comment Share on other sites More sharing options...
uddfl Posted February 3, 2009 Share Posted February 3, 2009 Your header has more lines than your routine. Sorry, I had to say it. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 3, 2009 Share Posted February 3, 2009 Lee,Yes prompts are different in 2008: Command: ucs Current ucs name: xxx Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis] : na Enter an option [Restore/Save/Delete/?]: r Enter name of UCS to restore or [?]: Thanks Carl: (defun c:ucsplan (/ uNm) (if (and (setq uNm (getstring t "\nSpecify Name of UCS: ")) (tblsearch "UCS" uNm)) (progn (command "_ucs" "NA" "R" uNm) (command "_plan" "c")) (princ "\nUCS Name not Found. ")) (princ)) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 3, 2009 Share Posted February 3, 2009 Tested and keep getting the following: Command: _appload ucsplan.lsp successfully loaded. Command: ucsplan Unknown command "UCSPLAN". Press F1 for help. Are you testing yours or mine? Because obviously yours is missing quite a few brackets... Quote Link to comment Share on other sites More sharing options...
Seneb Posted February 3, 2009 Share Posted February 3, 2009 I'm not good at lisp, but I did notice you're missing a semicolon before "runs the plan command..." Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 4, 2009 Share Posted February 4, 2009 Nice spot Seneb, Also, you are missing an open bracket for the defun, you have (princ) outside of the function, and you haven't set your string retrieval to any variable. Just a few pointers. Quote Link to comment Share on other sites More sharing options...
Seneb Posted February 4, 2009 Share Posted February 4, 2009 Thanks, Lee Mac. I do some web coding, so stuff like that jumps out at me. Quote Link to comment Share on other sites More sharing options...
skipsophrenic Posted February 4, 2009 Author Share Posted February 4, 2009 Was testing yours lee. I'll go back and edit mine with updates mentioned here and see how that goes Quote Link to comment Share on other sites More sharing options...
skipsophrenic Posted February 4, 2009 Author Share Posted February 4, 2009 Your header has more lines than your routine. Sorry, I had to say it. I noticed the same myself, but that's my standard header now. LOL ------------------------------------------------------------------ LEE, Sorry when i copied your corrections I missed the last closing parenthesis, rechecked and job done. Thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 4, 2009 Share Posted February 4, 2009 No worries Peter - glad you got it working Good luck with your coding Cheers Lee Quote Link to comment Share on other sites More sharing options...
skipsophrenic Posted February 4, 2009 Author Share Posted February 4, 2009 Thanks, I will need the luck - am tryin to figure out how to ask operator to choose which layout to go to, and then have it draw a viewport scaled to fit, with the selected ucs as the plan - fun no? all as part of same routine Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 4, 2009 Share Posted February 4, 2009 I'm sure you'll get there Peter Quote Link to comment Share on other sites More sharing options...
skipsophrenic Posted February 6, 2009 Author Share Posted February 6, 2009 how to ask operator to choose which layout to go to, :reallymad: help pls, i've gone through ev'ry website I know and turned up nothing - except colourful definitions of the word LISP - all I'm after is the choos layout bit, as mentioned before - only reason I haven't asked before is I'm a great beleiver in try and figre it out for yourself first, then it sticks in your head longer Hence why i angry with myself! 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.