Jump to content

Recommended Posts

Posted

I've tried to write a LISP routine quickly, but came up with nothing -- just lots of errors and gibberish. I have never written a true script before, so would consider myself an extreme beginner when it comes to LISP. I just don't have the time to spend and figure it out as work is very busy.

 

Basically, what I need to do is take a windowed area, and create a 3x3 grid in that window. I need the spacing to be even... ie: x spacing = x length/3, y spacing = y length/3. (The windowed area may be a rectangle, not always a square)

 

Ideally, I would like a small circle placed within each square. Would the easiest way be to create one square with a circle, and then array it? I am so helpless right, lol.

 

Think anyone can help me out? :oops:

 

I attached an example :geek:

grid.jpg

Posted

See how it will work for you

 

(defun C:rac  (/ cpt hgt leng pt1 pt2 pt3 rad ss)
 (setq	leng (getdist "\nEnter the length of an outer contour: ")
hgt  (getdist "\nEnter the height of an outer contour: ")
rad  (/ leng 60.)			  ;<-- change the radius to your suit
)
 (setq	pt1 (getpoint "\nPick the lower left corner: ")
pt1 (list (car pt1) (cadr pt1))
pt2 (list (+ (car pt1) leng) (+ (cadr pt1) hgt))
)
 (command "._rectang" "_non" pt1 "_non" pt2)
 (setq pt3 (list (+ (car pt1) (/ leng 3)) (+ (cadr pt1) (/ hgt 3))))
 (setq ss (ssadd))
 (command "._rectang" "_non" pt1 "_non" pt3)
 (ssadd (entlast) ss)
 (setq cpt (mapcar (function (lambda (a b) (/ (+ a b) 2))) pt1 pt3))
 (command "._circle" "_non" cpt rad)
 (ssadd (entlast) ss)
 (command "._-array" ss "" "_R" 3 3 (/ hgt 3) (/ leng 3))
 (princ)
 )
(princ "\nStart command with RAC...")
(princ)

 

~'J'~

Posted

omg, you're the best.

 

I can't believe you did that so quickly! That would have taken me a couple of days!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...