Jump to content

Named UCS and PLAN all in one LISP not working


Recommended Posts

Posted

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)

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    21

  • skipsophrenic

    17

  • uddfl

    4

  • GE13579

    3

Posted

Maybe this:

 

(command "ucs" "na" "re" pause)

 

so you don't need the 'getstring' which I think is the problem having is separate.

Posted

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))

Posted

Carl, is the UCS prompts different for ACAD '08?

 

Why is the "na" required?

Posted

To state i want to input a named ucs that I had saved previously - just off to test the code now

Posted

Hmmm... on '04, I just type "UCS" "RE" and then type the name of the UCS.... and it restores it ... :unsure:

Posted

Tested and keep getting the following:

 

Command: _appload ucsplan.lsp successfully loaded.

Command: ucsplan

Unknown command "UCSPLAN". Press F1 for help.

Posted

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 [?]:

Posted
:D Your header has more lines than your routine. Sorry, I had to say it.
Posted
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))

Posted
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...

Posted

I'm not good at lisp, but I did notice you're missing a semicolon before "runs the plan command..."

Posted

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. :thumbsup:

Posted

Thanks, Lee Mac. I do some web coding, so stuff like that jumps out at me. :)

Posted

Was testing yours lee.

 

I'll go back and edit mine with updates mentioned here and see how that goes

Posted
:D Your header has more lines than your routine. Sorry, I had to say it.

 

:lol: 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 :thumbsup:

Posted

No worries Peter - glad you got it working :)

 

Good luck with your coding :thumbsup:

 

Cheers

 

Lee

Posted

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

Posted
how to ask operator to choose which layout to go to,

 

:reallymad: :reallymad: :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!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...