Stuck on an AutoLISP program

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am using Autolisp for the first time and am trying to teach myself how to use it. I started of with programming for a simple stud. The code is working when i give chamfer as big as 5mm, but when i give chamfer value as 0.5mm the output is just a rectangle. I am hoping someone could help me with this. Thanks 🙂
Here is the code:
(defun c:stud ()
;define the function
;********************************************************
;Get User Inputs
(setq lb (getdist "\nLength of Stud : "))
;get the length of the beam
(setq dia (getdist "\nDiameter of Stud : "))
;get the Diameter of Stud
(setq a (getdist "\nChamper length : "))
;get the Champer length
(setq b (getangle "\nChamper angle : "))
;get the Champer angle
;End of User Inputs
;*********************************************************
;Get Insertion Point
(setq ip (getpoint "\nInsertion Point : "))
;get the insertion point
;********************************************************
;Start of Polar Calculations
(setq p2 (polar ip 0.0 a))
(setq p3 (polar ip 0.0 (- lb a)))
(setq p4 (polar p3 b (/ a (cos 20))))
(setq p5 (polar p2 (/ pi 2) dia))
(setq p6 (polar p3 (/ pi 2) dia))
(setq p7 (polar p6 (- 0.0 b) (/ a (cos 20))))
(setq p8 (polar p7 pi lb))
(setq p9 (polar p4 pi lb))
;End of Polar Calculations
;**********************************************************
;Start of Command Function
(command "Line" p2 p3 p6 p5 "c"
"Line" p5 p8 ""
"Line" p8 p9 ""
"Line" p9 p2 ""
"Line" p6 p7 ""
"Line" p7 p4 ""
"Line" p4 p3 ""
) ;End Command
;End of Command Function
;*********************************************************
(princ)
;finish cleanly
) ;end of defun