Jump to content

Autodesk Help trying to be helpful?


ewan_m

Recommended Posts

Hi Everyone,

 

I have recently found what I would call a bug in a lisp routine I've been charged with fixing.

 

In Autocad Map 2006 we have a routine which prepares a drawing to be run through CadPublisher and then does so (it does a number of thing from changing/freezing layers to modifying setfiles on the fly).

 

For some reason a change a senior programmer made to this routine caused the help window to pop up every time a map is processed, while it doesnt stop the process it takes focus and makes working on anything else difficult. I have gone through the process line by line and it did not seem to trigger, does anyone know of commands that might make the help window pop up? (i.e. an insert or explode or something maybe?)

Link to comment
Share on other sites

Upon opening a new or existing drawing (no previous command has been issued), my enter key with initiate the help window.

 

So maybe an extra

""

in the Lisp file might be the cause?

 

Maybe not... the extra "" would do the last command in the lisp..

 

Can you post the code ?

Link to comment
Share on other sites

Upon opening a new or existing drawing (no previous command has been issued), my enter key with initiate the help window.

 

So maybe an extra

""

in the Lisp file might be the cause?

 

Maybe not... the extra "" would do the last command in the lisp..

 

Can you post the code ?

 

I think I've sort of found the problem, you'll have to bear with me explaining it though:

 

When you have a process that doesn't return anything you get a nil right? like

(command "move" "all" 0,0 1,1)
nil

 

the problem is a returned nil seems to repeat the last input? for example if i open vlide then run something that produces a nil it will try to redo vlide

Command: 'VLIDE
Command:
Command: (command "move" "all" 0,0 1,1)
nil
Command: 'VLIDE

 

Now my understanding is a function should not return or produce anything except what its told or if its told nothing it will return the last function it worked through so it would be like:

(defun c:test ()
(command "move" "all" 0,0 1,1)
)
Command: TEST
nil
Command:

 

when run. I was told that a way to protect against this was to put (princ) at the bottom of a function so it would return a blank line, not a nil or a value. However the function being used is returning all its nils regardless of the (PRINC) at the end and causing a problem like the one you described when "" are inserted.

 

I hope that made sense, and if so, what should I do?

Link to comment
Share on other sites

Yes Badien,

 

When using commands that require a selection set input (like "move" for instance), one must include a "" (as if the user pressed enter) after the input, to tell the command that you have finished adding objects to the selection set of objects to be moved.

 

You will find that this extra "" is needed on a lot of other functions also - for example: "chprop" "rotate" "mirror" "copy" and many more.

 

Hope this explains things a little better.

 

Cheers

 

Lee

Link to comment
Share on other sites

(defun c:test ()
(command "move" "all" 0,0 1,1)
)

 

 

One other thing I have just noticed also is that there are no quotation marks around your coordinate specifications.

 

When using the "command" function, this function requires strings as arguments and will just print these strings to the command line in succession. Therefore, unless the specified arguments are variables containing strings, then all input to this function will need quotation marks.

 

I would also use a (princ) or (prin1) at the end of the LISP to exit cleanly and suppress the last function return as it makes things more professional.

Link to comment
Share on other sites

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