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…
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
@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.
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)
@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).
yeah oops mabey if i spelled the two instances of the MYDIST and MYDIST1 variables equally the problem would go away (red faced)
@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.