There are many reasons why 'Layer 3D To Feature Class'will fail. Without more information, we cannot be sure why it failed in this case.
One clue is that you are converting billboards. The most recent ArcGIS Pro docs say:
The Layer 3D To Feature Class docs for ArcGIS Pro state "[Marker
symbols that are billboarded. The position of these 2D symbols are
dynamically oriented to face the camera position in a 3D scene, so
they have no fixed orientation that can be used for exporting.
It lists several other caveats why the conversion might not work.
You report that your "output had the same amount of entities only they all were having the same geometry."
You can check whether the geometry is MULTIPATCH or POLYGON on the Feature Layer Properties -> Source -> Geometry.
If grouping by ObjectID then you will have the same number of entities - i.e one multipatch for each polygon. In this case, what is the advantage of the conversion?
It makes sense to use this function to group a collection of 3D polygon faces into a single multipatch polyhedron.
Following on from where you started...
import arcpy, os
from arcpy import env
env.overwriteOutput = True
env.workspace = r"C:\DATA\DWG"
outFolder = r'C:\Your\Output\Path'
datasets = arcpy.ListDatasets()
for dataset in datasets:
filesets = arcpy.ListFiles(dataset)
for f in filesets:
print f
InPoint = os.path.join(env.workspace,f,"Point") # the CAD points
InLine = os.path.join(env.workspace,f,"Polyline") # the CAD polylines
InPoly = os.path.join(env.workspace,f,"Polygon") # the CAD polygons
SaniF = f.replace(" ","_").replace("-","_").replace(".","_") # remove invalid chars..
if int(arcpy.GetCount_management(InPoint).getOutput(0)) == 0:
arcpy.AddWarning("- No points")
else:
outPointShape = '{}_Point.shp'.format(SaniF)
arcpy.AddMessage('- Exporting Points')
arcpy.FeatureClassToFeatureClass_conversion(InPoint,outFolder,outPointShape)
if int(arcpy.GetCount_management(InLine).getOutput(0)) == 0:
arcpy.AddWarning("- No lines")
else:
outLineShape = '{}_Line.shp'.format(SaniF)
arcpy.AddMessage('- Exporting Line')
arcpy.FeatureClassToFeatureClass_conversion(InLine,outFolder,outLineShape)
if int(arcpy.GetCount_management(InPoly).getOutput(0)) == 0:
arcpy.AddWarning("- No polygons")
else:
outPolyShape = '{}_Poly.shp'.format(SaniF)
arcpy.AddMessage('- Exporting Polygons')
arcpy.FeatureClassToFeatureClass_conversion(InPoly,outFolder,outPolyShape)
You need to populate your output folder from your filesystem.
You can see from this example how the feature classes within the CAD file can be accessed by their feature type; CAD files feature classes always exist but may have no features so it's important to get a count of features before exporting.
I have set the overwriteOutput to True so you might need to be a bit careful with the creation of output names, shapefiles have name limitations so I have to sanitize the output name from the input name replacint dashes, spaces and points.. you might need to add other replaces depending on what you see in your data, the file should also start with a letter and not be the same as a SQL reserved word.
Best Answer