I have ran out of time for now, but almost there. I am using a pline and points for testing. I have found that the dwg is very sloppy in that dwg circles are not done well hence I put a "fix" in the code otherwise got all sorts of answers like 39.987654 instead of 40. Need to take more care and use ortho F8 and copy/move with fixed offsets to maintain accuracy. I am more inclined to do a distance from the start end so 25 65 105 and so on with y offset the way you would lay a tape on a beam.
Code:
(defun c:test ( / pt1 pt2 lst J x y )
(SETQ OLDSNAP (GETVAR 'OSMODE))
(setq pt1 (getpoint "Pick lower left corner of existing"))
;(setq pt1a (getpoint "Pick lower right corner of existing"))
(setq ss (ssget (list (cons 0 "Circle"))))
(setq pt2 (Getpoint "Pick pt2 for new location"))
(setq lst '())
(repeat (setq J (sslength ss))
(setq pt (assoc 10 (entget (ssname ss (setq J (- J 1))))))
(setq lst (cons (list (nth 1 pt)(nth 2 pt)) lst ))
)
(setq lst (VL-SORT lst '(lambda (a b) (> (car a) (car b)))))
;(setq lst (reverse lst))
(SETVAR 'OSMODE 0)!
(command "_pline")
(while (= (getvar "cmdactive") 1 )
(repeat (setq J (length lst))
(command (nth (setq J (- J 1)) lst))
)
(command "")
)
(setq offs 5)
(setq top 15)
(setq len (+ 10 (* (sslength ss) 5)))
(setq pt3 (polar (polar pt2 0.0 len) (/ pi 2.0) 15))
(command "rectang" pt2 pt3)
; x value starts 5 Jn
(setq x (+ 5 (car pt2)))
(setq lst2 '())
(repeat (setq J (sslength ss))
(setq ptxy (nth (setq J (- J 1)) lst))
(setq y (* 0.075 (- (cadr ptxy)( cadr pt1))))
(setq y (+ y (cadr pt2)))
(setq x (+ x 5))
(setq lst2 (cons (list x y) lst2))
)
(repeat (setq x (length lst2))
(command "point" (nth (setq x (- x 1)) lst2))
)
(setq lst2 (cons pt2 lst2))
(setq lst2 (cons pt3 lst2))
(setq lst2 (VL-SORT lst2 '(lambda (a b) (> (car a) (car b)))))
(setq dims '())
(setq J (length lst))
(repeat (- J 1)
(setq dimx (fix (- (car (nth (- J 2) lst))(car (nth (- J 1) lst)))))
(setq dims (cons dimx dims))
(setq J (- J 1))
)
(setq y (length dims))
(repeat (setq x (length lst2))
(setq pt1d (nth (setq x (- x 1)) lst2))
(setq pt2d (nth x lst2))
(setq dimval (nth y dims))
(command "dim" "hor" pt1d pt2d pt4 dimval "exit")
(setq y (- y 1))
(setvar 'osmode oldsnap)
)
(c:test)