Does anybody know how to batch process shp. to .dwg files?

5587
12
Jump to solution
01-18-2017 08:42 AM
MattReynolds1
New Contributor II

I am looking to batch process shp. to .dwg files.  I have ArcMap 10.2 with Standard licence so I am able to convert each file separately. However, with over 200 files, this is a long process.  Does anyone know if there is a way to do this is a batch (or a toolbox).  Any help will be very much appreciated!!

Tags (3)
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Matt,

   You would use model Builder to build a model of this batch process.

  1. Open Model Builder. Geoprocessing Menu > ModelBuilder
  2. Open the ArcToolbox window and expand Conversion Tools > To CAD > Export to CAD and drag that tool into the model
  3. In the Model Builder window go to the Insert Menu > Iterators > Feature Classes.
  4. Double click on the Iterate Feature and set the Workspace or Feature Dataset by browsing to the central location of all the shapefiles you want to convert.
  5. Once you have chosen the FOLDER (not a specific shapefile) you are done so just click OK.
  6. Click the connect tool in the Model Builder window toolbar and draw a line from the *.shp oval to the Export to CAD rounded rectangle and chose Input Features.
  7. No double click on the Export to CAD and in the Output File change the *.DWG to %Name%.DWG (i.e. C:\Users\rscheitlin\AppData\Local\Temp\arc8ADC\EMS_ExportCAD.DWG to C:\DWGs\%Name%.DWG)
  8. Now run the model.

View solution in original post

12 Replies
RobertScheitlin__GISP
MVP Emeritus

Matt,

   You would use model Builder to build a model of this batch process.

  1. Open Model Builder. Geoprocessing Menu > ModelBuilder
  2. Open the ArcToolbox window and expand Conversion Tools > To CAD > Export to CAD and drag that tool into the model
  3. In the Model Builder window go to the Insert Menu > Iterators > Feature Classes.
  4. Double click on the Iterate Feature and set the Workspace or Feature Dataset by browsing to the central location of all the shapefiles you want to convert.
  5. Once you have chosen the FOLDER (not a specific shapefile) you are done so just click OK.
  6. Click the connect tool in the Model Builder window toolbar and draw a line from the *.shp oval to the Export to CAD rounded rectangle and chose Input Features.
  7. No double click on the Export to CAD and in the Output File change the *.DWG to %Name%.DWG (i.e. C:\Users\rscheitlin\AppData\Local\Temp\arc8ADC\EMS_ExportCAD.DWG to C:\DWGs\%Name%.DWG)
  8. Now run the model.
MattReynolds1
New Contributor II

Thanks Robert for your help.  I will give this go and report back.  Sounds like a plan though, I was toying with model builder rather than scripting.  Hopefully all will go well!

0 Kudos
MattReynolds1
New Contributor II

Hi Robert this has worked a treat... thanks very much.  One further question which you may be able to help with, no worries if not.  The CAD output file I have processed is essentially a copy of a Topographical layer; simple lines.  What i need to do is create is a more complex dwg file with road lines, points and annotations.  I would normally do this be adding these features in the big 'Input Features' box.  Is there a way to do that in this batch process?

Again, any help would be very much appreciated!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Matt,

   I am not sure how you would automate/batch that process. Are you saying that every shapefile that you have in the file you are iterating over will be added to one CAD file?

Also don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.

MattReynolds1
New Contributor II

Hi Rob,

Dont worry about the last Q, i know the issue - I rather stupidly used the wrong shapefiles (which weren't prepared for AutoCAD) - i.e shapefiles created without LAYER, COLOR etc so when pulled into CAD there wasn't any differentiation/layering.

PS. I think i have now checked 'answered'.

Thanks for all your help - lifesaver!! 

0 Kudos
ChrisDonohue__GISP
MVP Alum

Robert Scheitlin, GISP has the easiest answer.  Modelbuilder is very useful, it a bit quirky to figure out at first.

I will also add that the batch process can also be done using Python if you are familiar with it.

What is Python?—Help | ArcGIS for Desktop 

A quick tour of Python—Help | ArcGIS for Desktop 

FAQ: What version of Python is used in ArcGIS? 

Chris Donohue, GISP

MichaelVolz
Esteemed Contributor

Matt:

If you have the business need to repeat this process on a regular basis (e.g. weekly, monthly) then I would suggest converting the model to python and then using Windows Scheduled Task to run the process (maybe at night when no one is accessing the data).

MattReynolds1
New Contributor II

Michael, thats a great idea, I'll look into it... thanks for your help!

0 Kudos
curtvprice
MVP Esteemed Contributor

Should be said, if you have a working model, note that you do can easily run the model from Python with a short python script that looks like this:

import arcpy
arcpy.ImportToolbox(r"<path to toolbox>My Tools.tbx")  
# My Tools.tbx has alias mytools, and a tool named MyModel
arcpy.mytools.MyModel( ... )‍‍‍‍‍‍‍‍‍‍‍‍ # you can pass parameters