Layer 3D to feature class generates an empty output

682
2
01-04-2021 12:22 AM
AndresKasekamp
New Contributor III

I have a multipatch layer, whose elevation settings are set on the ground. I want to convert it to a feature class using "Layer 3D To Feature Class". When I use the geoprocessing tool, it correctly generates an output. However, when I run the tool through Python, it generates an empty output.

The multipatch features:

AndresKasekamp_0-1609747813998.png

General idea of the script, adding the layer to the scene and converting it to Feature Class:

import arcpy

arcpy.env.workspace = r"D:\AGOL_automaatne_update\AGOL_update\AGOL_update.gdb"
arcpy.env.overwriteOutput = True

aprx = arcpy.mp.ArcGISProject(r"D:\AGOL_automaatne_update\AGOL_update\AGOL_update.aprx")
sc = aprx.listMaps("ETAK_extrude")[0]

multipatch = r"D:\AGOL_automaatne_update\AGOL_update\AGOL_update.gdb\FS_multipatch1"

sc.addDataFromPath(r"{}".format(multipatch))

multipatch_lyr = [lyr for lyr in sc.listLayers() if lyr.dataSource == "{}".format(multipatch)][0]

arcpy.Layer3DToFeatureClass_3d(in_feature_layer=multipatch_lyr, out_feature_class="multipatch_m_2")

aprx.save()

 

 

 

Tags (3)
0 Kudos
2 Replies
JakeMaps
New Contributor

seeing the same thing - you every figure this out?

0 Kudos
YILILUO
New Contributor

Instead of using the multipatch_lyr, try save it to the lyrx. And use the lyrx path for the in_feature_layer parameter.

arcpy.management.SaveToLayerFile(multipatch_lyr, path_to_lyrxNone"CURRENT")

arcpy.ddd.Layer3DToFeatureClass(path_to_lyrx, path_to_multipatch)
0 Kudos