Jump to content

Lisp error


dungcan68

Recommended Posts

;;***************************************************
;; ÐO GÓC 3D free lisp from cadviet.com
(defun c:GH (/ p1 p2 p3 v1 v2 angrad angdeg)
  (setq    p1     (getpoint "\nPick point common to both lines.")
    p2     (getpoint p1 "\nPick end of first line.")
    p3     (getpoint p1 "\nPick end of second line.")
    v1     (uvec (mapcar '- p2 p1))
    v2     (uvec (mapcar '- p3 p1))
    angrad (@acos (dot v1 v2))
    angdeg (/ (* angrad 180.) 3.14159265359)
  )
  (princ "\nAngle between the two lines (degrees): ")
  (princ angdeg)
  (princ)
)


 

Error when running: Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.

Please help me fix this error. Only when used on autocad 2021 does it happen. Thank you

 

123.lsp

Edited by SLW210
Added CodeTags!
Link to comment
Share on other sites

2 hours ago, SLW210 said:

 

2 hours ago, SLW210 said:

Please use Code Tags in the future. (use the <> in the editor toolbar)

Sorry to bother everyone. The error occurred because I copied the missing lisp

 

Link to comment
Share on other sites

9 hours ago, dungcan68 said:

Error when running: Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.

Please help me fix this error. Only when used on autocad 2021 does it happen. Thank you

@dungcan68 The error you are describing could not be coming from the code you have presented, but rather an global error handler made by some other additional code not included in what you have shown. The error itself comes from using the (command) function within an error handler, which causes some issues in newer versions of AutoCAD. the (command-s) function was created to allow command functions from within an error handler when referencing local variables, but older code that was not upgraded may display this error.

 

I recommend you start looking through other AutoLISP functions you have loaded to determine which code is using a global error handler that contains the (command) function.

 

See the following link for more info:

https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-5C9DC003-3DD2-4770-95E7-7E19A4EE19A1

  • Like 1
Link to comment
Share on other sites

As pkenewell, I think the issue is in the other LISPs, one of these:

uvec

@acos

dot

 

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