Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Mentor
The_Caddie
Posts: 208
Registered: ‎06-08-2010
Message 1 of 7 (348 Views)
Accepted Solution

Strange error message in LISP

348 Views, 6 Replies
05-01-2012 05:08 AM

I am trying to create a line between two defined points but get the following error

 

; error: An error has occurred inside the *error* function AutoCAD variable  setting rejected: "DYNMODE" nil

 

I have googeld it but can’t find anything on it. Just as some background information I didn’t use DYNAMODE or any error function, which has me a bit baffled then

 

Anyways here's the troubled code snippet.

 

 

(command "line" MYPOINT (strcat MYDIST ,0 ,0))

 

Also tried

 

(command "line" MYPOINT MYPOINT2)

 

Doesn’t do anything either…


The_Caddie wrote:

The cursor places the line but keeps on holding on to its endpoint and wont place that. though the error has now changed to ; error bad argument type: numberp: nil


That means some AutoLISP function that is expecting a number is being given nil instead.  The most likely reason for that is that the MYDIST variable does not have a value set into it, which is causing trouble for (rtos) and (polar).

*Expert Elite*
Kent1Cooper
Posts: 5,539
Registered: ‎09-13-2004
Message 2 of 7 (344 Views)

Re: Strange error message in LISP

05-01-2012 05:50 AM in reply to: The_Caddie

The_Caddie wrote:

I am trying to create a line between two defined points but get the following error

 

; error: An error has occurred inside the *error* function AutoCAD variable  setting rejected: "DYNMODE" nil

 

... here's the troubled code snippet.

 

(command "line" MYPOINT (strcat MYDIST ,0 ,0))

Also tried

(command "line" MYPOINT MYPOINT2)

.…


I couldn't say about DYNMODE without seeing the whole routine, but as for the (command) functions:

 

The first one, assuming MYDIST is a distance [real number] in the X direction othat you want to go from MYPOINT, should be either

(command "line" MYPOINT (strcat "@" (rtos MYDIST) ",0,0") "")

or

(command "line" MYPOINT (polar MYPOINT 0 MYDIST) "")

or there are a few other ways it could be done.

 

The second one also needs a "" [Enter] at the end to complete the Line command.

Kent Cooper
Mentor
The_Caddie
Posts: 208
Registered: ‎06-08-2010
Message 3 of 7 (342 Views)

Re: Strange error message in LISP

05-01-2012 05:57 AM in reply to: Kent1Cooper

The cursor places the line but keeps on holding on to its endpoint and wont place that. Though the error has now changed to ; error bad argument type: numberp: nil

 

EDIT:

 

a better way to tackle this is perhaps to show me how I can place a line using two variables set to coordinate values found in model space.

 

After all the problem is how do I use variables to place a line.

 

(sorry my fault, complicated explanations) 

*Expert Elite*
Kent1Cooper
Posts: 5,539
Registered: ‎09-13-2004
Message 4 of 7 (338 Views)

Re: Strange error message in LISP

05-01-2012 06:04 AM in reply to: The_Caddie

The_Caddie wrote:

The cursor places the line but keeps on holding on to its endpoint and wont place that. though the error has now changed to ; error bad argument type: numberp: nil


That means some AutoLISP function that is expecting a number is being given nil instead.  The most likely reason for that is that the MYDIST variable does not have a value set into it, which is causing trouble for (rtos) and (polar).

Kent Cooper
Mentor
The_Caddie
Posts: 208
Registered: ‎06-08-2010
Message 5 of 7 (334 Views)

Re: Strange error message in LISP

05-01-2012 06:09 AM in reply to: Kent1Cooper

yeah oops mabey if i spelled the two instances of the MYDIST and MYDIST1 variables equally the problem would go away (red faced:womanembarrassed:)

*Expert Elite*
Kent1Cooper
Posts: 5,539
Registered: ‎09-13-2004
Message 6 of 7 (329 Views)

Re: Strange error message in LISP

05-01-2012 06:23 AM in reply to: The_Caddie

The_Caddie wrote:

... how I can place a line using two variables set to coordinate values ....


It appears from further messages that you've got it working, but in answer to the above:  The last line of code in your original post, with "" [Enter] added at the end to complete the Line command, would be the usual way.

Kent Cooper
Mentor
The_Caddie
Posts: 208
Registered: ‎06-08-2010
Message 7 of 7 (326 Views)

Re: Strange error message in LISP

05-01-2012 06:53 AM in reply to: Kent1Cooper

Yes that worked with the enter...

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.