PDA

View Full Version : Zero length line created when lisp is run


tommy.malone
2005-05-26, 04:52 PM
When I run an AutoLISP called thd.lsp on one of the engineering computers, I get " Zero line length created at (...,...,....) etc. and I get a garbled output to the screen. The lisp runs perfectly on other computers. I reinstalled Autocad but it didn't help. Does anyone know of a solution?

scwegner
2005-05-26, 06:24 PM
When I run an AutoLISP called thd.lsp on one of the engineering computers, I get " Zero line length created at (...,...,....) etc. and I get a garbled output to the screen. The lisp runs perfectly on other computers. I reinstalled Autocad but it didn't help. Does anyone know of a solution? Without seeing the code I can only guess, but it's often a problem of the endpoint snapping to the startpoint. Change OSNAPCOORD to 2 and/or turn off osnaps in the lisp. It could also be a situation where internal math sometimes results in the startpoint and endpoint being the same but since it only happens on one machine, I'm betting on OSNAPCOORD.

tommy.malone
2005-05-26, 06:38 PM
I turned off Osnap and the lisp runs perfectly. I do not know how to turn it off and the back on again inside the code. I have attached thd.lsp. Please look at it and if you can, tell what code to add.
Thanks

scwegner
2005-05-26, 06:50 PM
Here you go. I annotated the changes so you can see them. The program could still use some additional work -an error handler for example.
Also, keeping OSNAPCOORD at 1 or 2 would make it a moot point anyway.

kennet.sjoberg
2005-05-26, 07:59 PM
. . . The program could still use some additional work -an error handler . . .
. . .and You forgot to make the oosmode variable local for the function
(defun C:THD (/ oosmode .....

: ) Happy Computing !

kennet

scwegner
2005-05-26, 08:11 PM
. . .and You forgot to make the oosmode variable local for the function
(defun C:THD (/ oosmode .....

: ) Happy Computing !

kennet
Oh, right. Oops. Tommy, in case what he said makes no sense, change:

(/ cl dia n ang len radius rang pang tang p nt tcnt a b c d e f g h blipsave)

To:

(/ cl dia n ang len radius rang pang tang p nt tcnt a b c d e f g h blipsave oosmode)

tommy.malone
2005-05-26, 08:23 PM
Thanks to both of you. You guys are a lot smarter than I am.

RobertB
2005-06-01, 06:42 AM
I'm not a big fan of changing OSMode, as the rest of the posts indicate. What if the user wanted to use their running OSnaps for part of the selection process?

Therefore, it is far easier, IMHO, to simply force the NONe mode when stuffing the command pipeline.

(setq pt1 (getpoint "\nSpecify first point: "))
(setq pt2 (getpoint pt1 "\nSpecify next point: "))
(command "._Line" "_non" pt1 "_non" pt2 "")

kennet.sjoberg
2005-06-01, 07:49 AM
. . .What if the user wanted to use their running OSnaps for part of the selection process?. . .
In this case the user have no chance to affect the "selection process" because the "command line" is running inside the lisp program already feeded with coordinates.

"Code:"
(setq oosmode (getvar "osmode"))
(setvar "osmode" 0)
a lot of calculating . . .
(command "line" X Y "") . . . repeated many times
(setvar "osmode" oosmode)

: ) Happy Computing !

kennet