Import From CAD (Conversion)
Summary
Converts a collection of CAD files into feature classes and data tables using a predefined and highly normalized schema for the purpose of further translation into GIS data.
The output is stored in an interim staging geodatabase. The geodatabase can then be used, or further postprocessing can be performed.
This is a deprecated tool. To learn more about how this tool works click here. This functionality has been replaced by CAD To Geodatabase.
Usage
-
This tool will output a File based Geodatabase (.GDB) by default, but will also output an Personal Geodatabase (.MDB) if the user defines the proper extension.
-
A fixed set of feature classes will be generated in the specified output feature dataset. These feature classes contain the geometry for the lines, areas, points, and document extent, and optionally, point feature classes can be generated for each unique block or cell name.
-
This tool creates a new geodatabase and will not append to an existing one.
-
Postprocessing will be required if you need to perform any joins of the data or relationships. The output is data from the CAD inputs and no relationships exist. Its flattened structure allows it to be put back together however you want.
-
The Input files parameter will allow the addition of different kinds of CAD data (DGN, DWG, DXF) in one operation.
-
CAD property tables are created in the output workspace. These normalized tables can be linked together using key fields, such as the EntID that is also found in the feature classes created by the Import CAD tool.
-
If a table in the output feature dataset or workspace has the same name as one created by ImportCAD, the table will be deleted and re-created.
-
The Import from CAD tool does not support the creation of annotation feature classes.
-
The CAD property tables can be accessed from the output workspace in a model or script using the Select Data tool. Likewise, the feature classes generated from the CAD data can be accessed using the Select Data tool on the output feature dataset.
-
CAD text and attribute entities are converted to point features.
-
Import from CAD cannot output to an ArcSDE feature class; it will create a new personal geodatabase.
-
If you are going to copy the DocPath field in the CadDoc feature class or the TextMemo field in the TxtProp table from the staging geodatabase to a ArcSDE geodatabase, there are some limitations you need to be aware of. The DocPath field in the CadDoc feature class and the TextMemo field in the TxtProp table each have a memo field that is too long to fit in an ArcSDE geodatabase. For information about limitations of your ArcSDE geodatabases, see your system administrator. Portions of the information in these fields are duplicated in other fields. They have a shorter field length, so they can be moved to an ArcSDE geodatabase. The DocName field contains portions of the DocPath field, and the TextValue field contains portions of the TextMemo field.
-
This function is generally used in the process of translating CAD data to an existing geodatabase using a series of other geoprocessing functions in a script or ModelBuilder model and as such, the resulting data from this function is typically temporary.
-
Normalized tables are generated in the specified output workspace. These tables contain the tabular attributes of the layer properties, text properties, entity properties, block or cell attributes, and extended entity data or MSLink values.
-
If a projection file exists for the input CAD file it will automatically populate the spatial reference parameter with the projections information. If multiple CAD files are used as inputs the spatial reference will be taken from the first CAD file which has a projection file, in the input list.
-
When generating a default spatial reference for the staging geodatabase, you should always use the extent default model of the CAD file as the foundation. This means that if there are entities outside the extents of the default CAD field extents, they could be rejected. Be sure the model with the greatest extent is used as the default model in a DGN drawing. Only MicroStation version 8 supports the use of multiple models in a single design file.
-
If a DGN file has multiple models, be sure the first model has the largest domain. Import from CAD calculates the domain for the entire DGN file from the first model. If this is not the case, be sure to expand the domain in your first model to be large enough so all will fit.
-
If you use a PRJ file for the spatial reference parameter, be sure to set your x,y,z domain. If you do not set a domain, this could cause some features not to be imported if they fall outside the domain calculated on the fly.
-
If you need to convert CAD annotation to geodatabase annotation, there are specific tools for this, such as Import CAD Annotation.
Syntax
Parameter | Explanation | Data Type |
Input_Files [Input_Files,...] |
The collection of CAD files to convert to geodatabase features. | CAD Drawing Dataset |
out_personal_gdb |
The new output geodatabase where all the input CAD features are placed along with the accompanying tables. If you need joins of the tables or features, then postprocessing is required. | Workspace |
spatial_reference (Optional) |
The spatial reference to be applied to the Output Staging Geodatabase. | Spatial Reference |
Explode_Complex (Optional) |
Specifies if block inserts in DWG or DXF and/or cells in DGN will create a feature for each constituent element in the complex object or just a single point feature at its defined insertion point.
| Boolean |
Code Sample
# To create Points from the CAD block inserts. # Create the Geoprocessor object import arcgisscripting gp = arcgisscripting.create() # Script arguments... blocks = sys.argv[1] if blocks == '#': blocks = "C:/Test_data/CAD/MetroGAS/res00051_pc22j_ImportCAD1.mdb/blocks" # provide a default value if unspecified res00051_pc22j_dwg = sys.argv[2] if res00051_pc22j_dwg == '#': res00051_pc22j_dwg = "C:/Test_data/CAD/MetroGAS/res00051_pc22j.dwg" # provide a default value if unspecified Select_Set_Name = sys.argv[3] if Select_Set_Name == '#': Select_Set_Name = "[SetName] = 'COD_90_50M'" # Local variables... Pivoted_AttrTags_by_OwnerID = "C:/Test_data/CAD/MetroGAS/res00051_pc22j_ImportCAD1.mdb/Attrib_PivotTable" Attrib_Table = "C:/Test_data/CAD/MetroGAS/res00051_pc22j_ImportCAD1.mdb/Attrib" Entities_Table = "C:/Test_data/CAD/MetroGAS/res00051_pc22j_ImportCAD1.mdb/Entity" joined = "joined" Output_Staging_Geodatabase = "C:/Test_data/CAD/MetroGAS/res00051_pc22j_ImportCAD1.mdb" points_new2 = "points_new" Point = "C:/Test_data/CAD/MetroGAS/res00051_pc22j_ImportCAD1.mdb/CADStaging/Point" points_new = "points_new" points_new3 = "points_new" try: # Process: Import from CAD...gp.ImportCAD_conversion("'C:/Test_data/CAD/MetroGAS/res00051_pc22j.dwg'", Output_Staging_Geodatabase, "", "Do_Not_Explode_Complex") # Process: Select Data... gp.SelectData_management(Output_Staging_Geodatabase, "CADStaging/Point", ) # Process: Make Layer... gp.MakeFeatureLayer_management(Point, points_new, "", "", "EntID EntID VISIBLE") # Process: Select Data (Entities Table)... gp.SelectData_management(Output_Staging_Geodatabase, "Entity", ) # Process: Add Join... gp.AddJoin_management(points_new, "EntID", Entities_Table, "EntID", "OUTER", ) # Process: Select Data (Attrib Table)... gp.SelectData_management(Output_Staging_Geodatabase, "Attrib", ) # Process: Make Table View... gp.MakeTableView_management(Attrib_Table, joined, Select_Set_Name, "", "EntID EntID VISIBLE;OwnerID OwnerID VISIBLE;AttrFlag AttrFlag VISIBLE;MSSet MSSet VISIBLE;AtrTag AtrTag VISIBLE;AtrHndl AtrHndl VISIBLE;AttrType AttrType VISIBLE;AttrStr AttrStr VISIBLE;AttrLong AttrLong VISIBLE;AttrDbl AttrDbl VISIBLE") # Process: Pivot Table... gp.PivotTable_management(joined, "'Attrib.OwnerID';'OwnerID'", "AttrTag", "AttrStr", Pivoted_AttrTags_by_OwnerID) # Process: Add Join2... gp.AddJoin_management(points_new2, "Point.EntID", Pivoted_AttrTags_by_OwnerID, "OwnerID", "INNER", ) # Process: Copy Features... gp.CopyFeatures_management(points_new3, blocks, "", "0", "0", "0") except: # If an error occurred while running a tool print the messages print gp.GetMessages()