AutoLISP: Point Circle

This routine lets you create a circle that is made of AutoCAD Point entities. A great feature of this routine is that it lets you determine the starting point where the first point will be placed.

Here’s how:

Set the Point Type to a points size and type that is visible by using the DDPTYPE command.

  • PCIRC <enter> to start
  • Specify the center point for the circle
  • Specify the radius (note: there is NO option to specify a diameter…)
  • Specify the Starting Point. This is where the first point will be placed
  • Specify the number of points that you want the “circle” to be made of.

(defun c:pcirc (/ p r u n c lst param delta)
(setq p (getpoint "\nCenter point: "))
(setq r (getdist p "\nRadius: "))
(setq u (getangle p "\nStart angle: "))
(setq n (getint "\nNumber of points: "))
(setq c (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 r)))
(setq lst
'(lambda (x) (vlax-curve-getPointAtParam c x))
(repeat n
(setq param
(+ (cond ((car param))
((- u (setq delta (/ (* 2. pi) n))))
(entdel c)
(mapcar '(lambda (x) (entmakex (list '(0 . "POINT") (cons 10 x)))) lst)

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, AutoLISP: Creating. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s