0

I try to convert CSV point data to DXF CAD data. CSV file has about 270,000 points. I searched this issue and it is because ArcGIS is 32bit, and Background Processing Tool 64bit software is required to enable 64bit processing for Python. But unfortunately I have Background Processing Tool for ArcGIS 10.5, my ArcGIS version is 10.5.1. From forums, another solution is seperating csv data and then using "APPEND_TO_EXISTING_FILES" in ExportCAD_conversion tool, so I assigned csv data to a Pandas dataframe, I chunked it to 5 dataframes and I converted 5 dataframes to csv. And I used the export tool within a function:

def export_DXF(csv_path):
    dxf_folder = "..\\Outputs\\DXF"
    dxf_path = "..\\Outputs\\DXF\\switch.DXF"
    gdb_path = "output_data.gdb"
    point_feature_class_dir = "\\switch"
    point_feature_class = "switch"
    if not os.path.exists(dxf_folder):
        os.makedirs(dxf_folder)
    spatial_ref = arcpy.Describe(get_input() + '\ELE_DD_SEPARATOR_POINT').spatialReference
    featureclass_path = 'output_data.gdb\\switch'
    directory_gdb = os.getcwd()
    print("Koordinat sistemi: ", spatial_ref.Name)
    if arcpy.Exists(gdb_path):
        arcpy.Delete_management(gdb_path)
        print ("gdb path has been deleted.")
    arcpy.CreateFileGDB_management(directory_gdb, gdb_path)
    if arcpy.Exists(featureclass_path):
        arcpy.Delete_management(featureclass_path)
    arcpy.MakeXYEventLayer_management(csv_path, 'Point_X', 'Point_Y', featureclass_path, spatial_ref, '#')
    arcpy.FeatureClassToFeatureClass_conversion(featureclass_path, gdb_path, point_feature_class)
    print ("CSV tablosundan Feature Class olusturma islemi tamamlandi.")
    arcpy.ExportCAD_conversion(gdb_path + point_feature_class_dir, 'DXF_R2013', dxf_path,
                               'Ignore_Filenames_in_Tables', 'APPEND_TO_EXISTING_FILES', '#')
    dosya_sil(csv_path)
    dosya_sil(dxf_path + ".xml")
    print "dxf dosya donusumu tamamlandi."

in a function within for loop:

a=0
path_array = [switch1.csv, switch2.csv, switch3.csv, switch4.csv, switch5.csv]
for i in path_array:
    a = a + 1
    csv_path=("..\\Outputs\\" + i)
    export_DXF(csv_path,a)

However, when I run the script, first it creates one DXF and file size is 90MB, in second loop it appends second DXF, the file size is 180MB and then it waits for a long time without any output. Is there any solution exporting huge CSV file to DXF?

  • In GIS, 270k points is not that much. Maybe there are limitations in CAD-files, I dont know. Does it work when you try it manually? – BERA Jan 2 at 9:31
  • I didn't try to export manually but I had more points than this and I exported them with QGIS before. Also I think dxf can export million of points because AutoCAD supports point clouds. – ercishli Jan 2 at 9:55
  • 1
    If you have the wrong software installed, you should correct that before attempting anything else. – Vince Jan 2 at 13:25
  • Now I found the correct software. – ercishli Jan 3 at 5:39
1

I found installation of Background Processing Tool 64bit software for ArcGIS 10.5.1 software after setting up, and tried again, it worked.

  • It's great that you got it working but beware of background geoprocessing, it's a good idea in concept sometimes but is known to be slightly unstable, I find it best to turn it off; I had a bad experience running a process that was expected to run for a long weekend and it produced no output in the end, no errors, the code was correct, the results tab said it ran successfully but the output simply did not exist, after this I turned off background geoprocessing and the code ran fine and produced correct output... this is indicative of the unreliability of background geoprocessing. – Michael Stimson Jan 3 at 23:48
  • Yes I also thought this can make the processing unstable, and it can conflict 32 bit modules. I searched for a long time to solve the problem. Unfortunately I couldn't find any solution, I had to install Background Processing. Now it works like 32 bit version but the only difference it makes the script use more RAM. I also found another way using GDAL/OGR lib that can convert CSV to DXF however the output doesn't have attribute table. – ercishli Jan 4 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.