I am often requested to provide my water or sewer data in in a dwg or dxf format. I can easily move data back and forth between the two platforms using either the native import or export functions ArcGIS (Info level 9.3.1 or 10) or AutoCAD (Map 3D 2010). I am looking for a way to sort the features of a given featureclass into different CAD Layers based on their attribute values. For example if my water pipe data has an attribute values for both Diameter and Material. On export I would like to all of the 8 inch Ductile Iron pipes to be placed in the same CAD layer and all of the 10 PVC pipes in another CAD layer. I have done this in the past by manually selecting the pipe similar pipes and exporting just the selections but this can be tedious and time consuming. I have tried looking for a tool to do this, as I seem it is somethings others would be interested in, with no luck.
You can do it in AutoCAD Map with Query and Alter Properties.
- export you data to shp file
- import it into AutoCAD Map with attribute data in Object Table
- save your file as dwg and close it
- open empty dwg file and open Task plane (MAPWSPACE) - Map Explorer
- attach the drawing in which you imported your shp file
- define a query with Location:ALL ; Query mode: Draw
- open Alter Properties
- select Layer
- in Expression field write (strcat :fleid1@objectTable " " :field2@objectTable)
- press Add, then OK then Execute Query
- and thats it
filed1 and field2 are names of attribute columns in shapefile (in your example they are Diameter and Material) objectTable is name of you shapefile (this can be something else, but if you left as a default value in time of import it will be name of the shapefile)
I tested it on my example and it works so i think it will work for you also. I hope it helps.
In map 3d 2010 you can set the import to use data field for layer name. however if you have a size and type in two differing fields you would still not be able to accomplish exactly what you are talking about without another step of creating a composite field with size and type in it. If on the other hand your data does not have concidental values (i.e. 8" ductile, and 8" PVC) then you can accomplish. To describe further ... on the first page of your import dialog (after selecting the import file type) select the drawing layer elipsis... to the right of the default. and select use data field for layer name, select the data field you want to use and walla! Of course if you have enterprise data this would add another step to get your data into shape to begin with. If you add FME to the mix then you can accomplish in sooo many ways! as described in previous post or even with my solution by selecting your enterprise data type in map. hope this helps
You could set up a model that runs through the various selections, and then exports to CAD. All that would be required then is to run the model when a request comes in, or you could export it to a Python script and automate it to run on a set schedule. It will require some setup to get the model working, but it's time well spent. Here is a link to ESRI's help on working with models.
If you don't mind a suggestion for another software, then FME could do this in about 10 seconds with a fanout. It could even create either separate layers or separate files. I believe the ArcGIS Data Interoperability extension would do the same.
eg - here for elevation in a diagram from our training manual
Which is done with a simple check box:
Disclosure: I do work for Safe Software, the company who creates FME.
Due to a rather short turnaround time I broke down and using the "Add CAD Fields" GP tool to add the layer properties fields (Check Box). I then used the field calculator in ArcMAP to Concatenate the valves from my attribute fields in this case Diameter and Material along with the text string "WaterPipe" into the LyrName attribute field. I then used the "Export to CAD" GP tool remebering to leave the Ignore Paths in Table box unchecked. The resultant DWG file created contained my pipes neatly organized in CAD layers named [Diameter][Material]"WaterPipe" (i.e. 6DIPWaterPipe).