Select to view content in your preferred language

cad in geoprocessing service

3736
10
10-06-2016 05:51 AM
ZachTagar
Emerging Contributor

I want to use the CAD to Geodatabase tool as a service, where a user can upload a dwg file and have it shown on a web map as map service. Trouble is that the dwg file is always a 'constant' parameter as it cannot be passed by the browser. I need the user to pass files they receive as part of their workflow. Any suggestions?  

10 Replies
MapsGeek
Emerging Contributor

can you please elaborate a little about that error ?
when i run the script from ArcMap it successfully creates a dataset with the features inside the scratch geodatabase, on the published service i get the same error as Nagorneac Constantin‌ when i run from web appbuilder however when i check the job output in the server directories i find that the scratch geodatabase has been created and features inside as well.
this tool here does the same function i or " we " need but i have no clue how to do the same since i have no knowledge in python, i also used you methodology using model builder and it worked but couldn't get the file to be imported dynamically, the service always copied the used CAD file to the server and made it as a constant.

when i run the published service from Arcmap i get an error

these are the parameters i add to the script

this is the current code in the script 

import arcpy, os

inFile = arcpy.GetParameterAsText(0)

referenceScale = arcpy.GetParameterAsText(1)

inFileName = os.path.basename(inFile)

outFile = os.path.join(arcpy.env.scratchFolder,inFileName)

arcpy.AddMessage("Copying input data set to the scratch folder...")
arcpy.Copy_management(inFile,outFile)

outGDBPath = arcpy.env.scratchGDB

outDataSetName = "{0}_ToGDB".format(inFileName.rstrip(".dwg"))

sr = arcpy.SpatialReference(102100)

arcpy.AddMessage("Running CAD to GDB tool...")
arcpy.CADToGeodatabase_conversion(outFile,
                                  outGDBPath,
                                  outDataSetName,
                                  referenceScale,
                                  sr)

outData = os.path.join(arcpy.env.scratchGDB,outDataSetName)

arcpy.SetParameter(2,outData)
0 Kudos