De capa 3D a clase de entidad (3D Analyst)

Resumen

Exporta capas de entidades con propiedades 3D definidas a una clase de entidad multiparche.

Uso

Sintaxis

Layer3DToFeatureClass_3d (in_feature_layer, out_feature_class, {group_field})
ParámetroExplicaciónTipo de datos
in_feature_layer

La capa de entidad de entrada que tiene propiedades 3D definidas.

Feature Layer
out_feature_class

La clase de entidad multiparche de salida.

Feature Class
group_field
(Opcional)

El campo en la clase de entidad de entrada que identifica las entidades que se combinarán dentro de la misma entidad multiparche. Los atributos resultantes se establecerán en uno de los registros de entrada.

Field

Ejemplo de código

Ejemplo 1 de Layer3DToFeatureClass (ventana de Python)

The following sample demonstrates the use of this tool in the Python window:

import arcpy
from arcpy import env

arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.Layer3DToFeatureClass_3d("Points_3D.lyr", "Test.gdb/trees")
Ejemplo 2 de Layer3DToFeatureClass (secuencia de comandos independiente)

The following sample demonstrates the use of this tool in a stand-alone Python script:

'''****************************************************************************
Name: Layer3DToFeatureClass Example
Description: This script demonstrates how to use the 
             Layer3DToFeatureClass tool to create multipatches from all
             layers in a target workspace. The layer files are assumed to have
             been saved wtih 3D rendering from ArcScene.
****************************************************************************'''
# Import system modules
import arcpy
from arcpy import env
import exceptions, sys, traceback

try:
    # Obtain a license for the ArcGIS 3D Analyst extension
    arcpy.CheckOutExtension("3D")
    
    # Set environment settings
    env.workspace = "C:/data"
    
    # Use the ListFiles method to identify all layer files in workspace
    if arcpy.ListFiles("*.lyr"):
        for lyrFile in arcpy.ListFiles("*.lyr"):
            # Set Local Variables
            outFC = "Test.gdb/{0}".format(lyrFile[:-4]) #Strips '.lyr' from name
            #Execute Layer3DToFeatureClass
            arcpy.Layer3DToFeatureClass_3d(file, outFC)
    else:
        "There are no layer files in {0}.".format(env.workspace)

except arcpy.ExecuteError:
    print arcpy.GetMessages()
except:
    # Get the traceback object
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    # Concatenate error information into message string
    pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\
          .format(tbinfo, str(sys.exc_info()[1]))
    msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2))
    # Return python error messages for script tool or Python Window
    arcpy.AddError(pymsg)
    arcpy.AddError(msgs)

Entornos

Temas relacionados

Información de licencia

ArcView: Requiere 3D Analyst
ArcEditor: Requiere 3D Analyst
ArcInfo: Requiere 3D Analyst

7/10/2012