I had this, I have cleaned up, IIRC it works pretty similar if not exactly like the old Softdesk Continuous Copy.
;;; Allows you to copy objects multiple times at a typed in distance and angle. |
;;; |
;;; |ContCop.lsp| similar to SoftEngine command Continuous Copy |
;;; |
;;; https://www.cadtutor.net/forum/topic/89869-continuous-copylsp/#comment-648783 |
;;; |
;;; By SLW210 (Steve Wilson) |
;;; |
;;;_________________________________________________________________________________________|
;;; |
;;; August 18th, 2024 |
;;; |
;;; |
;;; |
;;; |
;;;_________________________________________________________________________________________|
;;; |
;;; |
(defun C:ContCop (/ ss ang dist dists temp pt1 pt2 oldOsnap)
;; Error handler for internal errors
(defun ccerr (st)
(if (or (/= st "Function cancelled") (= st "quit / exit abort"))
(princ (strcat "\nError: " st))
)
(princ)
)
;; Set the error handler
(setq *error* 'ccerr)
;; Store current Osnap setting
(setq oldOsnap (getvar "OSMODE"))
;; Prompt user to select objects
(prompt "\nSelect objects to copy: ")
(command "select" "auto" pause)
(setq ss (ssget "p"))
;; Prompt user to select the start and end points
(initget 1)
(setq pt1 (getpoint "\nSelect Start Point: "))
(initget 1)
(setq pt2 (getpoint pt1 "\nSelect End Point: "))
;; Calculate distance and angle
(setq dist (distance pt1 pt2)
ang (angtos (angle pt1 pt2) 0 6)
dists 0.0
)
;; Main loop for continuous copying
(while
(/= (setq
temp (getdist
(strcat "\nNext distance/Exit < " (rtos dist) " >: ")
)
)
"Exit"
)
(setq dists (+ dists
(if (not temp)
dist
temp
)
)
)
(setq temp (strcat "@" (rtos dists 2 6) "<" ang))
(command "COPY" ss "" "0,0" temp)
)
;; Restore original Osnap setting
(setvar "OSMODE" oldOsnap)
(princ)
)
I am positive the others are better, but I need the practice, hopefully commented correctly for you and me both.