Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Batch Block Convertion

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
bdqrocks
1792 Views, 11 Replies

Batch Block Convertion

Hello,

  I have over a thousand files of separate DWG files that need to be converted to bocks in order to work with a new software we are implimenting.  Is there any way at all to batch procces alll these separate files to blocks so I dont have to open each file and go through the procces of turning each into a block individually? 

 

Thanks, 

Bob.

 

 

Tags (1)
11 REPLIES 11
Message 2 of 12
dmfrazier
in reply to: bdqrocks

Assuming you want to produce one (or possibly a few) DWG file(s) to act as (a) "container(s)" for the block definitions and (a) source(s) for block insertions, here's one way to "convert" separate DWG files to a bunch of block definitions in a DWG:

 

  • Start or Open a new, empty DWG file
  • Open Xref Manager
  • Click Attach DWG and browse to the location of the DWGs which will become blocks
  • Select as many files as you like (it might be best to start with a relatively small group) and click Open
  • On the Attach Xref dialog set:
  •   - Type to Attachment,
  •   - Scale factors to 1
  •   - Insert point to 0,0,0
  •   - Path type to No path
  •   - Rotation Angle to 0
  • Click OK
  • Now go back to the Xref Manager and bind all the xrefs as "Insert" type (Select all of them, right-click, Bind)
  • Erase all the inserts

You now have a file that contains all the block references defined by the DWG files you xreffed and bound as inserts.  The block names will match the original file names.

 

Message 3 of 12
bdqrocks
in reply to: bdqrocks

Thank you so much for your help!

 

 This is a trick I will use in the future.  unfortunately in this case I need to keep all the blocks in there files just as the are as opposed to gathering all the blocks in one file.  

 

 

Message 4 of 12
dmfrazier
in reply to: bdqrocks

Then color me confused... Smiley Frustrated

 

You said:

"I have over a thousand files of separate DWG files that need to be converted to b[l]ocks in order to work with a new software we are implimenting."

 

Please explain what you mean by "need to be converted to b[l]ocks".  What is a "block" in your world?

Message 5 of 12
bdqrocks
in reply to: dmfrazier

A NON block would be a solid or a few separate parts save as a DWG.  A Block would be those same parts selected and given the block command so that they will be forever in a family as a block.

 

It might seem there is no need to make them into blocks if there is nothing else occupying the same file.  But for some reason that I don't know this object needs to be a block in-order to work with this new app.  So therefor I have to do nothing to the file other than create a block around this object and save it.  The catch is that there are a whole lot of them.

Message 6 of 12
dmfrazier
in reply to: bdqrocks

So, just to be clear, this new app requires you to store (and maintain) all of the blocks it uses as single block definitions each within its own DWG file?

 

And each file (which has a name) must contain a block definition (which presumably will have the same name), correct?

 

And currently all of these existing files contain only the objects that would define the blocks (but not an actual block definition)?

 

Is it necessary for there to be an actual insert (instance) of the block definition, or is just the definition enough?

 

Would it be appropriate to assume 0,0 as the insert point for the new block definition?

 

I can envision a way to automate the "conversion", but the details will depend on the answers to these questions (and probably a few others I haven't thought of yet).  It can probably be done with a fairly simple script or small AutoLISP routine.

Message 7 of 12
bdqrocks
in reply to: dmfrazier

The answer is Yes to all of the above.  But dont know how to wright a AutoLISP routine?

Message 8 of 12
dmfrazier
in reply to: bdqrocks

Then it's a good thing for you that I do, and so do many others who read these forums.

Hopefully this is something you have a little time to wait for(?).

I will try my hand at it as soon as I get a block of time, unless someone else is quicker to the draw. Smiley Wink

Message 9 of 12
bdqrocks
in reply to: dmfrazier

Hay Thanks so much!  

  I have some time no problem.  Smiley Happy

 

This will be fantastic!

Message 10 of 12
abubakars
in reply to: bdqrocks

This may be of some help if not then you may get help from someone else here.

 

i tried the below workaround and it works for me, you may give it a try and let us know

 

Download the FREE Batch process tool BatchInEditor from Autodesk Exchange Application store

 

1. Load all your 1000 drawing to batch or split them into 2 or 4 groups

 

2. Add the command "Modelspace Set Active" to make it sure your current space is modelspace

 

3. Add the command "Lisp Expression" and paste the below

(command "-block" (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4)) "0,0" "all" "")

This will create a block from all objects in modelspace and the block name is set as drawing name

 

4. Add the another lisp expression command and paste the below

(command "-insert" (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4)) "0,0" "" "" "0").

This is to insert the newly created block into the modelspace at 0,0

 

5. Add the command "Zoom-Extents"

 

6. Select all the files (ctrl+A) from the added drawing list and select all the commands which are selected for this current batch operation and add them to files

 

7. Run the "TestRun" which will process the first file in the list and open the file and make sure everything is OK as expected then run the Batch

 

Convert drawing into block.PNG

 

You need to double click a command from command list to add to batch.

 

AbubakarS

 

Message 11 of 12
bdqrocks
in reply to: abubakars

Smiley Very Happy

 

 You are my hero!  It Worked!  You saved me days of mind numbing brutal monotonous suffering!  Thank you, Thank you, Thank You!

Message 12 of 12
abubakars
in reply to: bdqrocks

Glad to know that it helped and the initial version of BatchInEditor comes with the limitation of 3 files per session and send the licesnse key request which is free as well to utilise its full potential.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost