TheSwamp
CAD Forums => CAD General => Topic started by: M-dub on June 25, 2008, 02:55:45 PM
-
What is the quickest way to insert a whole bunch of blocks into one drawing relatively evenly spaced? They are all in the same directory. I was just trying to avoid having to insert each one individually.
-
Lisp of Script I would guess. Lisp would be My first choice.
-
I'm half done. It's not as easy (straight forward) as I first thought, anyway.
Thanks though. :)
-
Pseudo code:
Get names of all blocks plus limits
Get max limits of largest block
Set ins point at 0,0
Increment to the right using units of largest block + a couple units
Insert first block in list
Repeat for a number of times, then increment up/dn using units of largest block + a couple units, etc...
-
Here's my stab at it:
(defun c:insertblks (/ d doc lst pt pt1 dir)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(if
(and (setq
dir (vl-filename-directory
(getfiled "Select a DWG" (getvar 'dwgprefix) "dwg" 8)
)
)
(setq lst (vl-directory-files dir "*.dwg"))
(setq pt1 (getpoint "\nSelect point for first block: "))
(setq d
(distance (getpoint pt1 "\nSelect distance to space blocks: ")
pt1
)
)
)
(foreach b lst
(vla-insertblock
(if (= (getvar 'cvport) 1)
(vla-get-paperspace doc)
(vla-get-modelspace doc)
)
(vlax-3d-point (setq pt1 (polar pt1 0.0 d)))
(strcat dir "\\" b)
1
1
1
0.0
)
)
)
(princ)
)
-
Cool, Ron. That did it :)
Thanks!
-
You're welcome :)