@Anonymous wrote:
... lines to be drawn between them and it could be a set length for the lines.so it's the same length every time.
....
I would like them copied, so the originals remain and placed where I designate it with a mouse click.
....
Finally got around to working something out [in simplest terms, lightly tested]:
(defun C:BAL (/ osm bss pt rad len blk n); = Block Align with Lines between
;; for Blocks with primary Circle, with insertion point at its center
(setq osm (getvar 'osmode))
(prompt "\nTo Align Blocks with connecting Lines,")
(if
(and
(setq bss (ssget '((0 . "INSERT"))))
(setq pt (getpoint "\nPosition of left-most copy: "))
(setq rad (getdist "\nRadius of circle part of Blocks: "))
(setq len (getdist "\nLength of Lines between copies: "))
); and
(progn ; then
(setvar 'osmode 0)
(command
"_.copy" (setq blk (ssname bss (setq n (1- (sslength bss))))) ""
(cdr (assoc 10 (entget blk))) pt
); command
(repeat n
(command
"_.line" (setq pt (polar pt 0 rad)) (setq pt (polar pt 0 len)) ""
"_.copy" (setq blk (ssname bss (setq n (1- n)))) ""
(cdr (assoc 10 (entget blk))) (setq pt (polar pt 0 rad))
); command
); repeat
(setvar 'osmode osm)
); progn
); if
); defun
If you have a fixed and constant value for 'rad' and 'len', you can pull those out of the User-input area and the localized variables list, and just put those values into the code in place of those variable names.
EDIT:
Now that I look back at the lower image in Post 5, with a Line also to the right of the last one, that's also possible [in fact, a little simpler]:
(defun C:BAL (/ osm bss pt rad len blk n); = Block Align with Lines between
;; for Blocks with primary Circle, with insertion point at its center
(setq osm (getvar 'osmode))
(prompt "\nTo Align Blocks with connecting Lines,")
(if
(and
(setq bss (ssget '((0 . "INSERT"))))
(setq pt (getpoint "\nPosition of left-most copy: "))
(setq rad (getdist "\nRadius of circle part of Blocks: "))
(setq len (getdist "\nLength of Lines between copies: "))
); and
(progn ; then
(setvar 'osmode 0)
(repeat (setq n (sslength bss))
(command
"_.copy" (setq blk (ssname bss (setq n (1- n)))) ""
(cdr (assoc 10 (entget blk))) pt
"_.line" (setq pt (polar pt 0 rad)) (setq pt (polar pt 0 len)) ""
); command
(setq pt (polar pt 0 rad))
); repeat
(setvar 'osmode osm)
); progn
); if
); defun
It could also restrict selection to only a specific Block name, so you could select an area with a window and any other Blocks would be ignored. And it could put the Lines on a designated Layer, and it could .... . . . . . . . .
Kent Cooper, AIA