How to insert individual blocks from separate CAD files, into one master file

How to insert individual blocks from separate CAD files, into one master file

antcav501
Participant Participant
3,599 Views
8 Replies
Message 1 of 9

How to insert individual blocks from separate CAD files, into one master file

antcav501
Participant
Participant

 I have a folder containing a few hundred CAD blocks. Each CAD block is saved to it's own individual CAD file. I therefore have hundreds of CAD files, and within each file it contains one (1) block. I am trying to bring each block, from each CAD file, into one master CAD file.

 

This will eliminate hundreds of unnecessary files. I end up converting the individual blocks into dynamic blocks, but I like to have a file with all of the blocks for record. I started using using this method:  Multiple > Insert

 

That method makes it easy because it opens the insert command automatically for me, but if this is the only fast and efficient way to insert hundreds of blocks from separate files into one master file, then I guess this will take me some time.

 

Any advice or ideas on how to accomplish this in an easier and more efficient way?  I appreciate the feedback.

0 Likes
Accepted solutions (1)
3,600 Views
8 Replies
Replies (8)
Message 2 of 9

SeeMSixty7
Advisor
Advisor
Accepted solution

I don't recommend putting all your eggs in one basket, but copies of them in that one basket works. grin.

 

If you are not concerned with the insertion point of them all, use the XREF command and you can pick a lot of them at once and then just attach. Then when all done, just bind them as inserts.

 

Someone recently just posted this method in another post and its a great way to handle it.

 

Good luck,

Message 3 of 9

dbroad
Mentor
Mentor

Open the file explorer to the folder. Drag n drop each file (one at a time) into the drawing. Takes very little time.

Architect, Registered NC, VA, SC, & GA.
Message 4 of 9

pendean
Community Legend
Community Legend
>>>...way to insert hundreds of blocks from separate files into one master file...<<<
Why the need to clutter a single new file all at once?

If the individual block-files are organized by type in folders, why not use ADCENTER to navigate there and insert them? Or make ToolPalettes from those folders from inside ADCENTER in less than 30-seconds each and use that method?

INSERT command is great for one-off usage, but a terribly slow and inefficient method for productive speedy input of blocks in files day-in and day-out.
Message 5 of 9

john.vellek
Alumni
Alumni

Hi @antcav501,

 

Use Designcenter to grab the individual blocks to insert into a set of Library files. Make sure that you save copies because corruption is more likely in bigger files.

 

Please let me know if you need help in trying this.

 

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 6 of 9

Kent1Cooper
Consultant
Consultant

This is a job for BlockChart.lsp, available here.  No need to do them all yourself, whether through the Design Center or drag-and-dropping from an Explorer file folder or otherwise -- it will bring them all in for you automatically.  See comments, etc., on that thread.

Kent Cooper, AIA
Message 7 of 9

Anonymous
Not applicable

Instead of one file, break them into categories with a file for each type of block.  That way a damaged file won't trash the entire library.  That will also make it easier to import the blocks by file into tool palettes.

As for inserting them into one file, the lisp below works, but it places all the blocks at 0,0.

 

There is a line in this function that loads DOSLIB

    (arxload "N:/ACAD2015/CS/DOSLIB/doslib20x64.arx")

 

You'll need to download the version of DOSLIB that matches your version of AutoCAD from HERE.

Then you'll need to edit that line to match the location of the file for loading.

 

;;;;;;;============================================
;;;;;Main Error Handler
;;;;;;;============================================
(defun *xoerr* (s)
  (if (/= s "Function cancelled")
    (if	(= s "quit / exit abort")
      (princ)
      (princ (strcat "\nError: " s))
    )
  )
  (setq S nil)
  (if OLDECHO
    (setvar "cmdecho" OLDECHO)
  )
  (if OLDLAY
    (setvar "clayer" OLDLAY)
  )
  (setq	*error*	*err_old*
	*err_old* nil
  )
  (princ)
)
;;
;;;;;;;============================================
;;;;;Main Osmode Handler
;;;;;;;============================================
(defun XT_SWT_OSMODE (SWT_XT_OO /)
  (if (= SWT_XT_OO "ON")
    (progn
      (if (< 5000 (getvar "osmode"))
	(setvar "osmode" (- (getvar "osmode") 16384))
      )					;if
    )					;progn
    (progn
      (if (> 5000 (getvar "osmode"))
	(setvar "osmode" (+ (getvar "osmode") 16384))
      )					;if
    )					;progn
  )					;if
)					;defun
;;
;;;;;;;============================================
;;;;;Sets attatch type to Attach then runs DOINSERT
;;;;;;;============================================
(defun c:inslist () (command "undo" "begin")(DOinsert)(command "undo" "end"))
;;;;;;;;;============================================
(defun DOinsert (;/	OLDECHO	   OLDLAY
;	       CAPT_TITLE DEF_PATH   IPOINT	XSCALE	   YSCALE
;	       ROT	  FNAME	     FLIST	DWG_PATH CMTDCLPATH
	      )
(COMMAND "UCS" "WORLD")
(osmget)
  (XT_SWT_OSMODE "OFF")
  (setq	*err_old* *error*
	*error*	*xoerr*
  )
  (setq OLDECHO (getvar "cmdecho"))
  (setq OLDLAY (getvar "clayer"))
  (setvar "clayer" "0")
   
  (setq CAPT_TITLE (strcat "Select files to Insert"))
  (setq DEF_PATH (getvar "DWGPREFIX"))

    (arxload "N:/ACAD2015/CS/DOSLIB/doslib20x64.arx")

  (setq	FLIST
	 (dos_getfilem CAPT_TITLE DEF_PATH "Drawing Files (*.DWG)|*.DWG")
  )
  (if FLIST
	(progn
		(setq IPOINT "0,0")
		(setq XSCALE 1)
		(setq YSCALE XSCALE)
		(setq ROT 0)
		(setq DWG_PATH (nth 0 FLIST))
		(vl-load-com)
		(setq FLIST (vl-remove DWG_PATH FLIST))
		(foreach FNAME FLIST
			(progn
				(command "-insert" (strcat DWG_PATH FNAME) "xs" "1" "r" "0" "0,0,0")
				(princ
					(strcat FNAME " was successfully inserted.\n")
				)
			)				;progn
		)					;foreach
	)					;progn
    (princ "\nNo files selected.")
  )					;if
  (setq	*error*	*err_old*
	*err_old* nil
  )
  (setvar "clayer" oldlay)
  (XT_SWT_OSMODE "ON")
  (osmret)
(COMMAND "UCS" "PREV")
  (princ)
)
(defun c:ins () (c:inslist))
(princ)

 

Message 8 of 9

antcav501
Participant
Participant

@SeeMSixty7 Thank you very much! And thank you to everyone else who took the time to answer my question.  I found that SeeMSixty7's solution works the best for my current situation.  It's very easy to use the xrefs tools to insert the dwgs and then bind them as inserts. This should make the process much more efficient. Thanks again, much appreciated.

Message 9 of 9

dbroad
Mentor
Mentor

Glad you found your solution.  I hope you don't think that you can now delete the original files though per your original post:

--------

"This will eliminate hundreds of unnecessary files. I end up converting the individual blocks into dynamic blocks, but I like to have a file with all of the blocks for record. "

---------

 

As far as whether or not to put blocks in a single file, there are 2 distinct advantages to putting related blocks in a single file (by inserting, not xreffing).  

1.  If blocks are in a single file, a tool palette can be created automatically by using the designcenter.

2.  Editing blocks by right clicking in the tool palette is made possible.

Architect, Registered NC, VA, SC, & GA.
0 Likes