Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug with .lsp file in AutoCAD 2014 for mac

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
938 Views, 3 Replies

Bug with .lsp file in AutoCAD 2014 for mac

New user here. I'm using the student lisenced version of AutoCAD 2014 for Mac. Because Mac has no VisualLISP with the AutoCAD package, I'm using an app called Text Wrangler to create .lsp files for AutoCAD. Here is the code I am trying to use:

 

(defun c:circleseries ()
(setq N (getint "\n How many circles?: "))
(setq a (getreal "\n Angle at which circles will be drawn: "))
(setq cp1 (getpoint "\n Specify center point of first circle: "))
(setq r (getreal "\n Specify the radius: "))
(setq cpx (polar cp1 a (* 3 r)))
(setq x 0)
(command "circle" cp1 r "")
(while (< x N)
(command "circle" cpx r "")
(setq cpx (polar cpx a (* 3 r))))
)

 

After uploading this code using appload, the program works just fine. However, after the program finishes I encounter a problem: AutoCAD sends an error message stating: Unknown command "circleseries". Press F1 for help. It displays this message an infinite amount of times, freezing AutoCAD so I cannot do anything. Please let me know the problem, whether its a glitch with the software itself or just my program. Thanks in advance. 

3 REPLIES 3
Message 2 of 4
hmsilva
in reply to: Anonymous

bdeanc, welcome to the Autodesk Forums!

try this modified code

(defun c:circleseries (/ A CP1 CPX N R X);; localized variables
  (setq N (getint "\n How many circles?: "))
  (setq a (getreal "\n Angle at which circles will be drawn: "))
  (setq cp1 (getpoint "\n Specify center point of first circle: "))
  (setq r (getreal "\n Specify the radius: "))
  (setq cpx (polar cp1 a (* 3 r)))
  (setq x 0)
  (command "circle" cp1 r);; removed ""
  (while (< x N)
    (command "circle" cpx r);; removed ""
    (setq cpx (polar cpx a (* 3 r)))
    (setq x (1+ x));; added
  )
  (princ);; quiet exit
)

HTH

Henrique

EESignature

Message 3 of 4
Anonymous
in reply to: Anonymous

Wow. I forgot to close the while loop. Such a stupid mistake. Thanks for the help. 

Message 4 of 4
hmsilva
in reply to: Anonymous

You're welcome, bdeanc
glad I could help

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost