Download presentation
Presentation is loading. Please wait.
Published byHenry Hutchinson Modified over 8 years ago
1
City of Richland Public Works GIS ESRI to CAD Script 1 10+ years experience in GIS industry Helped Launch (6) GIS programs Civil Engineer Squadron / RAF Lakenheath Civil Engineer Squadron / Lakeland AFB Joint Command 7 / Bagram Airfield Air Force Civil Engineer Squadron / Bagram Airfield Civil Engineer Squadron / Fairchild AFB Public Works / City of Richland ESRI/Python programmer Richard Allen / GIS Public Works City of Richland
2
City of Richland Public Works GIS ESRI to CAD Script 2 Create Seed File(s) Create Python Scripts Put CAD Together Run Script Create CSV Files
3
City of Richland Public Works GIS ESRI to CAD Script 3 Create Seed file(s) This is how you want your drawing to look Blocks need to be made so that the points have a place to go Linetype names can be saved/stored in the seed file Layers can be saved/stored in either the seed file or the CSV file We saved/stored this in the CSV file since our groups wanted different colors Annotation Blocks Everything else is pretty straight forward except for blocks Depending on how the blocks are created you could have attributes added to them We chose to create two blocks for every feature One block shows the feature as well as its attributes when you click on it The second shows one attribute that can be turned off in the layer manager Creating Seed Files
4
City of Richland Public Works GIS ESRI to CAD Script 4 Block Examples Final ResultAttribute Only Block Block & Hidden Attributes
5
City of Richland Public Works GIS ESRI to CAD Script 5 This ESRI diagram outlines the specific field names that must be used when using the Export to CAD tool This is the base of everything that was done in this code CAD Fields Defined Field Calculations listed below are performed in an ArcMap Edit session. CAD Staging GDB Table Field Type Field Length CAD Application (s) Short Description Effect on Export To CAD Color Use CAD color numbersEntityShort2BothCAD color number A valid value will override the default entity color of the output feature LineWt Export to AutoCAD, measured in millimeters, maximum value = 9 Setting changes required in AutoCAD to apply this to display EntityShort2AutoCAD OnlyCAD Line weight value A valid value will control the line weigth of the output feature Layer Calculate records with suitable values in this field for Layer Names in the output CAD file. EntityString255BothCAD entity layer name A valid value will override the default entity layer name of the output feature HandleEntityString16Both CAD created entity internal identifier Not Used RefName If Elevation attribute exists in the data, assign RefName as the Alias for the attribute. The Z-aware output polylines will store the Z- values. If CadType = "Insert", calculate RefName = the name for the block in the output AutoCAD file. EntityString255Both CAD entity Block name/ Hatch name /Cell Name/Tag name or Text Value A valid value will override the default entity name of the output feature
6
City of Richland Public Works GIS ESRI to CAD Script 6 Edit Python Script The script is designed to run from C:\ Edit _All.py Edit what def statements should run Edit the def statements Depending on what is needed The variable CSV file needs to correspond with the actual CSV file Create New def statements using the one already made Make sure that all def statements are referenced in the _All.py Edit Python Scripts
7
City of Richland Public Works GIS ESRI to CAD Script 7 _All.py Script Example
8
City of Richland Public Works GIS ESRI to CAD Script 8 Edit CSV Files Global.csv This is the variable file inDir_sde, outDir_sde, outDir_fd, inDir_dwg, outDir_dwg Text – The first three lines are variables This is the Text file Name, fc, Layer, sql, LyrColor, Color, TxtFont, LyrFrzn, ProcessIt, Period Blocks – The first three lines are variables This is the Blocks file Name, fc, Layer, sql, LyrColor, Color, Block, Cad Angle, Scale, LyrFrzn, ProcessIt, Period Lines – The first three lines are variables This is the Lines file Name, fc, Layer, sql, LyrColor, Color, Type, LyrFrzn, ProcessIt, Period Create CSV Files
9
City of Richland Public Works GIS ESRI to CAD Script 9 CSV Files Examples varNamefcLayersqlLyrColorColorTxtFontLyrFrznProcessItPeriod varinDir_SN \\PublicWorks.DBO.Irrigation_ Network varrkaSeed_dwg\\Irrigation_Blocks.dwg varFinished_dwgIrrigationText_base.dwg data ESRItoDWGirPressurized MainAnno PublicWorks.DBO.iwPressurize dMainAnnoPythonGIS_IRR TEXTSymbolID = 0210256Existing0TRUE0 data ESRItoDWGirPressurized MainAnnoAban PublicWorks.DBO.iwPressurize dMainAnnoPython GIS_IRR_ABA NDON TEXTnull210256Existing00 varvarNameDirectory varinDir_sdeDatabase Connections\\arcsqlprod01-publicworks.sde varoutDir_sdeDatabase Connections\\arcsqltest01-publicworks.sde varoutDir_fd\\PublicWorks.DBO.Richards_Base varinDir_dwgC:\\_EsriToDwg\\Files\\Seed varoutDir_dwgC:\\_EsriToDwg\\Files\\Complete\\Base Irtext.csv Global.csv
10
City of Richland Public Works GIS ESRI to CAD Script 10 ESRI to CAD Script There are a few different ways to run this script Copy the Main script (_All.py) and paste it into ESRI python shell Open with a program like IDLE or PYTHONWIN and run it Double click it to run it. There is code in this script to document what happened Schedule it to run in Windows Again there is code to document what happened After the code is finished, review the document to see if anything went wrong If all worked, it is time to put everything together If there were errors, re-run the code with just the parts that did not work Run Script
11
City of Richland Public Works GIS ESRI to CAD Script 11 ESRI to CAD Script Open a blank document and insert drawing When insert do not forget to explode the drawing on insertion After all drawings are inserted wblock the drawing to bring down the file size A lisp program can be created to do all this in AutoCAD Included on the disc is a lisp program that you can modify 10.1 should make this process easier The program was initially designed to create one drawing per utility There are issues with ESRI’s ExportToCAD tool in 10.0 Put CAD Files Together
12
City of Richland Public Works GIS ESRI to CAD Script 12 ESRI to CAD Script If there is any question about this code please let me know There are (10) CDs that include this code in the back if anyone is interested I will be happy to get the code to anyone that didn’t get a CD Since this application was created for a public entity, this code is free to share If you find ways to make the code better or have ideas about it, I would love to hear them Please feel free to contact me for comments, help or questions Richard Allen (509) 942-7729 rallen@ci.richland.wa.us rallen@ci.richland.wa.us Enjoy
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.