3DAnalystUI


Supported with:
  • ArcView with 3D Analyst
  • ArcEditor with 3D Analyst
  • ArcInfo with 3D Analyst
Library dependencies: Version, System, SystemUI, Geometry, GraphicsCore, Display, Server, Output, Geodatabase, GISClient, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB, DataSourcesRaster, DataSourcesNetCDF, GeoDatabaseDistributed, GeoDatabaseExtensions, Carto, NetworkAnalysis, Location, GeoAnalyst, Animation, Maplex, Geoprocessing, NetworkAnalyst, Schematic, SpatialAnalyst, 3DAnalyst, GlobeCore, EngineCore, TrackingAnalyst, Framework, Desktop.Addins, GeoDatabaseUI, DisplayUI, OutputUI, Search, Catalog, CatalogUI, CartoUI, DataSourcesRasterUI, ArcCatalog, ArcCatalogUI, ArcMap, ArcMapUI, AnimationUI, Editor, GeoReferenceUI, EditorExt, LocationUI, GeoDatabaseDistributedUI, GeoprocessingUI, OutputExtensions, OutputExtensionsUI, ArcScan, NetworkAnalystUI, SpatialAnalystUI, SchematicUI

Additional library information: Contents, Object Model Diagram

To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
The 3DAnalystUI library provides user interfaces (UIs) that support export objects in the 3DAnalyst library. The 3DAnalyst extension object is implemented by this library.
 
Developers extend this library when they create UI functions for corresponding components they have created in the 3DAnalyst library.

See the following sections for more information about this namespace:

DDDEnvironment

DDDEnvironment is the 3D Analyst extension object. It's used to check and set 3D Analyst license properties from custom ArcGIS Desktop tools and commands. These tools and commands can check for the existence of the extension as well as its license status before offering functionality dependent on the extension.

This object is a singleton object and is not cocreatable. It must be acquired through an ExtensionManager object. The two functions in the following code show how to turn on and off a 3D Analyst license. Ensure that the esriSystem assembly, where the ExtensionManager coclass resides, is referenced.
[VB.NET]
Function TurnOn3DLicense() As Boolean
    
    Dim returnValue As Boolean
    
    Try
    
    Dim objID As UID = New UIDClass
    objID.Value = "esri3DAnalystUI.DDDEnvironment"
    
    Dim extensionManagerAdmin As IExtensionManagerAdmin = New ExtensionManagerClass
    extensionManagerAdmin.AddExtension(objID, 0) 'Add the extension first.
    
    Dim extensionManager As IExtensionManager = CType(extensionManagerAdmin, IExtensionManager)
    Dim extension As IExtension = extensionManager.FindExtension(objID)
    Dim extensionConfig As IExtensionConfig = CType(extension, IExtensionConfig)
    
    If extensionConfig Is Nothing Then 'Couldn't find the extension.
        MessageBox.Show("Can't find the extension!")
        returnValue = False
    Else
        extensionConfig.State = esriExtensionState.esriESEnabled
        returnValue = True
    End If
    
    Catch ex As Exception
    MessageBox.Show(ex.InnerException.ToString, "TurnOn3DLicense()")
    End Try
    
    Return returnValue
    
End Function


Function TurnOff3DLicense() As Boolean
    
    Dim returnValue As Boolean
    
    Try
    
    Dim objID As UID = New UIDClass
    objID.Value = "esri3DAnalystUI.DDDEnvironment"
    
    Dim extensionManager As IExtensionManager = New ExtensionManagerClass
    Dim extension As IExtension = extensionManager.FindExtension(objID)
    
    If extension Is Nothing Then 'Couldn't find the extension.
        MessageBox.Show("Can't find the extension!")
        returnValue = False
    Else
        Dim extensionConfig As IExtensionConfig = CType(extension, IExtensionConfig)
        extensionConfig.State = esriExtensionState.esriESDisabled
        returnValue = True
    End If
    
    Catch ex As Exception
    MessageBox.Show(ex.InnerException.ToString, "TurnOff3DLicense()")
    End Try
    
    Return returnValue
    
End Function
[C#]
public bool TurnOn3DLicense()
{
    bool returnValue = false;

    try
    {
        UID objID = new UIDClass();
        objID.Value = "esri3DAnalystUI.DDDEnvironment";

        IExtensionManagerAdmin extensionManagerAdmin = new ExtensionManagerClass();
        object obj = 0;
        extensionManagerAdmin.AddExtension(objID, ref obj); 
            //Add the extension first.

        IExtensionManager extensionManager = (IExtensionManager)
            extensionManagerAdmin;
        IExtension extension = extensionManager.FindExtension(objID);
        IExtensionConfig extensionConfig = (IExtensionConfig)extension;

        if (extensionConfig == null)
        //Couldn't find the extension.
        {
            MessageBox.Show("Can't find the extension!");
            returnValue = false;
        }
        else
        {
            extensionConfig.State = esriExtensionState.esriESEnabled;
            returnValue = true;
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.InnerException.ToString(), "TurnOn3DLicense()");
    }

    return returnValue;
}


public bool TurnOff3DLicense()
{
    bool returnValue = false;

    try
    {
        UID objID = new UIDClass();
        objID.Value = "esri3DAnalystUI.DDDEnvironment";

        IExtensionManager extensionManager = new ExtensionManagerClass();
        IExtension extension = extensionManager.FindExtension(objID);

        if (extension == null)
        //Couldn't find the extension.
        {
            MessageBox.Show("Can't find the extension!");
            returnValue = false;
        }
        else
        {
            IExtensionConfig extensionConfig = (IExtensionConfig)extension;
            extensionConfig.State = esriExtensionState.esriESDisabled;
            returnValue = true;
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.InnerException.ToString(), "TurnOff3DLicense()");
    }
    return returnValue;
}

SceneExport

Three-dimensional (3D) scenes can be exported to a variety of image formats as static snapshots or to Virtual Reality Modeling Language (VRML) files. VRML is an industry standard 3D graphics format. ISceneExport2dDialog and ISceneExportFile2dDialog are UIs for creating image snapshots. ISceneExport3dDialog, supported in ArcScene only, is a UI for exporting to VRML. The following ArcScene code shows how to open a scene export dialog box. You can subsequently change the parameter settings on the dialog box once it's open. The code is similar in ArcGlobe (without the VRML reference).
ISceneExportFile2dDialog has more UI options and is designed to replace ISceneExport2dDialog.
[VB.NET]
Public Sub SceneExporter(ByVal sxDocument As ISxDocument)
    
    Dim scene As IScene = sxDocument.Scene
    
    Dim envelope As IEnvelope = New EnvelopeClass
    Dim xMin As Double = 100
    Dim yMin As Double = 100
    Dim xMax As Double = 300
    Dim yMax As Double = 200
    envelope.PutCoords(xMin, yMin, xMax, yMax)
    
    'Open the 2D scene export dialog.
    Dim sceneExportFile2dDialog As ISceneExportFile2dDialog = New SceneExportFile2dDialogClass
    sceneExportFile2dDialog.DoModal(envelope, 150)
    
    'Open the 3D scene export dialog.
    Dim sceneExport3dDialog As ISceneExport3dDialog = New SceneExport3dDialogClass
    sceneExport3dDialog.DoModal()
    
End Sub
[C#]
public void SceneExporter(ISxDocument sxDocument)
{
    IScene scene = sxDocument.Scene;

    IEnvelope envelope = new EnvelopeClass();
    double xMin = 100;
    double yMin = 100;
    double xMax = 300;
    double yMax = 200;
    envelope.PutCoords(xMin, yMin, xMax, yMax);

    //Open the 2D scene export dialog.
    ISceneExportFile2dDialog sceneExportFile2dDialog = new
        SceneExportFile2dDialogClass();
    sceneExportFile2dDialog.DoModal(envelope, 150);

    //Open the 3D scene export dialog.
    ISceneExport3dDialog sceneExport3dDialog = new SceneExport3dDialogClass();
    sceneExport3dDialog.DoModal();
}