0

Well I'm sort of stuck and don't know what to do. I need to write program using AutoLisp, which would draw five-pointed star. I don't have any knowledge in AutoLisp programming, but managed to write this and it seems to me, correct, but AutoCAD won't draw anything. Maybe someone could help? (long numbers are angles in radian) Code:

(defun C:Figura3 ()
  (setq pl (getpoint "\nStart coordinate: ")) ;;; Coordinates of circle center
  (setq aukst (getint "\nRadius: "))
  ;;; Coordinates of vertices
  (setq p2 (polar p1 1.570796327 aukst)) ;;; 90 (degrees) 
  (setq p3 (polar p1 2.827433388 aukst)) ;;; 162
  (setq p4 (polar p1 4.08407045 aukst)) ;;; 234
  (setq p5 (polar p1 5.340707511 aukst)) ;;; 306
  (setq p6 (polar p1 0.3141592654 aukst)) ;;; 18
  ;;; Drawing
  (command "color" "white")
  (command "lweight" 0.35)
  (command "circle" p1 aukst)
  (command "line" p2 p4 p6 p3 p5 p2 "")
)

2 Answers2

1

You've defined the command 'Figura3', however you'll need to actually call it as well for it to do any work. Type Figura3 at the command prompt after you load/type your function definition and AutoCAD will run your function like you'd expect.

There's also an issue with your first point though. It's defined as 'pl' (lowercase 'L') and later referenced as 'p1'.

Parrish Husband
  • 3,148
  • 18
  • 40
0

If you want to make it yourself, consider using 2 pi and divide it to get the angles instead of hardcoding them.

If you need a solution now you can have a look at this page: http://www.lee-mac.com/star.html

dexus
  • 53
  • 6
  • The explanation should be a part of the answer. That means the external links are used solely as a reference, not as part of the reply. This is due to the possibility that an external link might become unavailable in the future, rendering the original reply incomplete. – Lopofsky Jul 02 '23 at 07:19