Import From CAD (Conversion)

License Level:BasicStandardAdvanced

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.

LegacyLegacy:

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

Syntax

ImportCAD_conversion (Input_Files, out_personal_gdb, {spatial_reference}, {Explode_Complex})
ParameterExplanationData 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.

  • DO_NOT_EXPLODE_COMPLEXThe tool processes each complex object as a single point feature.
  • EXPLODE_COMPLEXThe tool expands the geometry of complex objects into their subentities, which are then added to the appropriate feature classes in the output feature dataset.
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()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
10/24/2012