Invent Civil




Civil Engineering news, technology, and opinions

AutoCad to EPA-SWMM

I wrote this AutoCAD script to streamline the process of defining and drawing subcatchments in EPA-SWMM. The script will prompt you to select any number of polylines in AutoCAD, and will automatically create a file in the location you specify. The script creates an EPA-SWMM input file that contains the catchment area and vertexes so that the catchment can be drawn in EPA-SWMM.

To run the script, open AutoCAD, and type the command “vbaload”. Browse to the location where you saved the file, select it, and hit ok. Make sure you “enable macros” when you’re prompted. Next type “vbarun” and select the macro ending in “Export2EPASWMM”.

Make sure you’ve entered an existing directory, and specify the filename, ending in .inp. Note that the containing directory needs to exist, but not the file. Any existing file by the same name will be overwritten. Once the filename has been specified, click on “Select Polylines” and follow the command prompts. Once complete, you can open the input file (by the name you specified) in EPA-SWMM.

[AutoCAD2EPASWMM (24 KB)]

This is a free download – you may use it as much as you like, but it comes without warranty. The script is password protected, but if you’d like to see/edit the code, tell me why and I’ll probably be willing to send you an unprotected version.





If you find this script helpful or if you have suggestions for improvement, tell me about it in the comments.

19 Responses to "AutoCad to EPA-SWMM"

2 | AN

September 19th, 2008 at 2:52 am

Avatar

export2 epaswmm can’t export conduit in file autocad to epaswmm? if it can ! you are can help me ,please!

3 | Skylar

September 19th, 2008 at 6:17 am

Avatar

AN: No, the program only deals with subcatchments at the moment. I might be able to write a quick addition for a conduit if you can give me some information:

How have you drawn the conduit in autocad? is it a straight polyline, a closed polyline, a civil 3d object, etc?

Please reply via email. Thanks.

4 | an

September 20th, 2008 at 10:21 am

Avatar

I want a program . it can Export file .*dxf to file.*inp for epaswmm same “Dxf2epa.exe” program , it can export file .*dxf in autocad program to .*inp for “Epanet 2.0 ” program.
thank you very much !

5 | Skylar

September 20th, 2008 at 10:27 am

Avatar

I’m sorry. To be honest, the program you are requesting is an impossibility. At some point along the line, there will need to be human input. The program I wrote is a small tool to assist in drawing subcatchments only. It does not provide any of the variables required to properly run the epa-swmm model, nor can an autocad drawing even provide that type of information. I recommend you read the epa-swmm documentation here.

6 | Leon Hellberg

January 7th, 2009 at 4:55 am

Avatar

This is neat.

I have created a similar tool, and also one for reading in an .INP file and drawing nodes, conduits and subcatchments. Useful for presentation purposes.

It is a bit rough-and-ready without much error trapping but if anyone is interested mail me at leon.hellberg-at-gmail.com

7 | elev8848

January 7th, 2009 at 9:37 pm

Avatar

Great. I was wishing for a similar thing.

I would like to modify your VBA to select all polylines by layer.

And may be do some more.

8 | tassya

March 6th, 2009 at 5:22 am

Avatar

hello guys,

i need your help. i wanna know, how to import excel spreadsheet data into EPA SWMM? i have been given data on the cross section and coordinate of drain system, and i wanna open it with EPA SWmm. is it possible to do so? If cannot, can i bring the Autocad drawing to EPA SWMM? how to do so?

really need your help. thank you

9 | Skylar

March 6th, 2009 at 6:47 pm

Avatar

tassya,

If you’re looking for a concrete, easy solution to export excel or autocad formats to an epa swmm model, there is no such thing. There are too many caveats that prevent this sort of system from working. However, if you’re asking how to develop a program to export your excel data to epa-swmm, then here’s some tips:

You’ll need to know some vba to export the excel data (assuming you want to automate the process). To create an input file, I would first open up epa swmm and create an example file by piecing together a quick model. Open up the resulting “.inp” file in a text editor and look at how it’s set up. What you’ll then need to do is have your excel vba program export it’s containing data to a “text file” (just make the extension .inp for epa swmm to read it). All you need to do is make sure the format and syntax of your outputted text file is consistent with the “example” inp file.

10 | b tiberiu

July 18th, 2009 at 4:21 pm

Avatar

Hello!!
i tried all kind of programs that are supposed to export files from civil 3d 2010 to epanet 2.0 ( inp file extension ) but no success. do you have any ideas how to do it?
thank you!!

11 | Reinaldo Seguro Seguro

December 14th, 2009 at 7:04 pm

Avatar

Gracias

12 | Pina

January 3rd, 2011 at 10:07 am

Avatar

Feel free to use inp.PINS for generating SWMM input files (.inp) based on GIS files.

13 | chou

March 21st, 2012 at 6:03 am

Avatar

svp je veux avoir la clĂ© de swmmcad s’il est possible, ou de me donner le lien, j’en ai vraiment besoin

14 | Edlic

April 24th, 2012 at 9:51 pm

Avatar

Thanks… you are a great help

15 | naglaa

September 20th, 2012 at 12:40 pm

Avatar

Autocad 2012 does not support VBA any more do you have another solution

16 | Traveller

September 30th, 2012 at 5:31 pm

Avatar

Hello! Thank you for this dvb, I would like to modify the code in order to select all polylines by multiple selection.. I’m a student working on a drainage project, can you contact me, please? Thanks a lot

17 | elena

December 18th, 2013 at 7:49 am

Avatar

The file I download has the extension .wiz and not .dvb as autocad asks to me.
I’m not able to modifie this extension… how can I manage it?

Thanks

18 | Anis

March 25th, 2014 at 6:40 am

Avatar

thx for this script , i have AUTOCAD 2008 , i try it many time and every time it say illegal numeric value (xxxx,xxx) at line x i can’t understand the problem can any one help me plz.

19 | m.A

November 24th, 2014 at 9:13 am

Avatar

when i type vbaload an error occur: it is no longer installed with auto cad and when i want install it i can`t because it says it is not supported in your country, so what should i do ?

Comment Form

About

This site is dedicated to providing interesting and helpful articles and resources for people in the Civil Engineering field.

The articles presented on this site represent my own personal opinions and not those of my employer. All information, links, and downloads on this site are for general information only, and are provided as-is without warranty.