Message 1 of 4
AutoLisp Adjustments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am trying to come up with a lisp routine that puts rivet holes (circles) in the perimeter of an ACM panel (see attachment). The holes need to be equally spaced with a maximum spacing of 24" o.c. and the first and last hole being 3" off the ends on all sides.
I found a lisp that does almost exactly what I need it to do (see below) except it puts two circles at either end, the first 1" off the ends and the second 1.75" of the ends. I was able to edit the lisp so as to get the correct spacing, layer, diameter, and distance from the edges. I can not figure out how to eliminate one of the circles at the ends and place the first and last hole 3" off the ends.
Can someone please help?
Thanks!
(defun c:HOLES (/ gc:clockwise-p _aap _c a d d2 e ep f i l r sp)
;; RJP » 2023-02-02
(defun _c (p) (entmakex (list '(0 . "CIRCLE") '(8 . "HOLES") '(40 . 0.06425) (cons 10 p))))
(defun _aap (e pt / a clpt e pa)
(if (and (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getendparam (list e))))
(setq clpt (vlax-curve-getclosestpointto e pt))
(setq pa (vlax-curve-getparamatpoint e clpt))
(setq a (angle '(0 0 0) (vlax-curve-getfirstderiv e pa)))
)
a
)
)
;; Clockwise-p - gile
(defun gc:clockwise-p (p1 p2 p3) (< (sin (- (angle p1 p3) (angle p1 p2))) -1e-14))
(cond ((and (setq e (car (entsel "\nPick a panel frame: ")))
(= "LWPOLYLINE" (cdr (assoc 0 (entget e))))
(setq sp (vlax-curve-getstartparam e))
(setq ep (vlax-curve-getendparam e))
)
(repeat (fix ep)
(cond ((> (setq l (- (abs (- (vlax-curve-getdistatparam e sp)
(vlax-curve-getdistatparam e (setq sp (1+ sp)))
)
)
5.5
)
)
6
)
(setq d2 (/ l (setq i (1+ (fix (/ l 24))))))
(setq d (vlax-curve-getdistatparam e (1- sp)))
(foreach b '(1.0 1.75)
;;----------------
(setq r (cons (_c (vlax-curve-getpointatdist e (setq d (+ d b)))) r))
)
(repeat i (setq r (cons (_c (vlax-curve-getpointatdist e (setq d (+ d d2)))) r)))
;;----------------------------------------------------------------------------------
(setq r (cons (_c (vlax-curve-getpointatdist e (setq d (+ d 1.75)))) r))
)
)
)
(setq f (if (gc:clockwise-p
(vlax-curve-getpointatparam e 0)
(vlax-curve-getpointatparam e 1)
(vlax-curve-getpointatparam e 2)
)
+
-
)
)
(foreach el r
(setq a (cdr (assoc 10 (entget el))))
(entmod (append (entget el) (list (cons 10 (polar a (f (_aap e a) (/ pi 2)) 0.375)))))
)
)
)
(princ)
)