AdamW Posted November 20, 2017 Share Posted November 20, 2017 Hi All Ive been going through the AutoLISP tutorial on this site and think I might have found an error. The example for changing the cross hair reads "(defun c:perpdon (/ a b pntl pnt2 angl) (graphscr) (setq a (entsel)) (setq b (entget (car a))) (setq pntl (cdr (assoc 10 b))) (setq pnt2 (cdr (assoc 11 b))) (setq angl (angle pntl pnt2)) (setvar "snapang" ang1) (princ) ) (defun c:perpdoff (setvar "snapang" 0) (princ) )" These don't seem to work for me. However if I add a set of parentheses to (defun c:perpdoff (setvar "snapang" 0) to make it (defun c:perpdoff () (setvar "snapang" 0) then Perpoff works. Similary in perpon I have to change the line (setvar "snapang" ang1) to (setvar "snapang" angl) chnaging the "1" to an "L". Then all works well. If I have it wrong I appologise. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted November 20, 2017 Share Posted November 20, 2017 You are correct. Either put () or nil after the defun and it will work as expected. HERE's some info on defun. Quote Link to comment Share on other sites More sharing options...
SLW210 Posted November 21, 2017 Share Posted November 21, 2017 Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.