Laying out hole patterns with a lisp

Laying out hole patterns with a lisp

Anonymous
Not applicable
2,843 Views
21 Replies
Message 1 of 22

Laying out hole patterns with a lisp

Anonymous
Not applicable

Hello everyone,

 

So I am revisiting this topic coming back with more knowledge of lisp and trying to get everything automated.

I was hoping to make a lisp to draw circles within in a rectangle and center them on that rectangle.

I am struggling on how to go about doing this.

Can any one help help me with this?

It cannot be a hatch or super hatch they have to be individual circles created. 

 

thanks a lot  

 

See the attached notated drawing for all the details 

(defun C:test (/ getcenter )
(defun getcenter (/ centroid)
  (setq centroid
       (trans
	 (osnap
	   (cadr
	     (entsel "\nSelect polyline: "
		     )
	     ) "_gcen"
	   ) 1 0
	 )
      )
  )
  (princ )
  (getcenter)
  (command "circle" centroid "Diameter" ".315")
 )

 

0 Likes
Accepted solutions (2)
2,844 Views
21 Replies
Replies (21)
Message 21 of 22

Moshe-A
Mentor
Mentor

@Anonymous wrote:

Moshe-A,

 

That works great, but is it missing the point of getting the holes centered within that polyline. The dist from the outer most quadrant should be the same from left to right, it should also be the same from top to bottom.

that is not true, if you place the hatch origin point in Centroid point of the rectangle, all holes will be symmetric from all sides.

 


 

0 Likes
Message 22 of 22

Anonymous
Not applicable

My apologize, 

The code and hatch by @Moshe-A does indeed work for laying out the holes and centering them on the polyline. 

That was all user error! oops... 🙂

Thanks for pointing that out @Moshe-A.

0 Likes