mzdijjw2

How to use Analyst3DTools Inside3D?

Discussion created by mzdijjw2 on Aug 23, 2013
Hi all,

I have been trying using the Inside3D method of the Analyst3DTools, but so far I have no luck. It keeps giving me an error: "Error HRESULT E_FAIL has been returned from a call to a COM component."

From the documentation, I read that the Inside3D method needs 3 inputs, 2 feature classes and 1 table. I guess the featureclasses are not the problem. However, I am not sure about the table. I am not sure of the requirement of the table that can be run by the Inside3D. Is it okay to have a new table without any fields, or is it okay if I use existing tables with fields created already?

I give you my script below. I hope someone can help me with this.

Dim insideBhMpTable As ITable
        Dim workspace As IWorkspace
        workspace = modCommon.openAccessWorkspace(gdbBox.Text)
        Dim tempFeatWorkspace As IFeatureWorkspace
        tempFeatWorkspace = CType(workspace, IFeatureWorkspace)


        Dim uid As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UIDClass
        uid.Value = "esriGeoDatabase.Object"

        Dim fields As ESRI.ArcGIS.Geodatabase.IFields
        Dim objectClassDescription As ESRI.ArcGIS.Geodatabase.IObjectClassDescription = New ESRI.ArcGIS.Geodatabase.ObjectClassDescriptionClass
        fields = objectClassDescription.RequiredFields
        Dim fieldsEdit As ESRI.ArcGIS.Geodatabase.IFieldsEdit = CType(fields, ESRI.ArcGIS.Geodatabase.IFieldsEdit) ' Explicit Cast
        Dim field As ESRI.ArcGIS.Geodatabase.IField = New ESRI.ArcGIS.Geodatabase.FieldClass

        ' Create a user defined text field
        Dim fieldEdit As ESRI.ArcGIS.Geodatabase.IFieldEdit = CType(field, ESRI.ArcGIS.Geodatabase.IFieldEdit) ' Explicit Cast

        ' Setup field properties
        fieldEdit.Name_2 = "SampleField"
        fieldEdit.Type_2 = ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeString
        fieldEdit.IsNullable_2 = True
        fieldEdit.AliasName_2 = "Sample Field Column"
        fieldEdit.DefaultValue_2 = "test"
        fieldEdit.Editable_2 = True
        fieldEdit.Length_2 = 100

        ' Add the field to the field collection
        fieldsEdit.AddField(field)
        fields = CType(fieldsEdit, ESRI.ArcGIS.Geodatabase.IFields) ' Explicit Cast

        ' Use IFieldChecker to create a validated fields collection.
        Dim fieldChecker As ESRI.ArcGIS.Geodatabase.IFieldChecker = New ESRI.ArcGIS.Geodatabase.FieldCheckerClass()
        Dim enumFieldError As ESRI.ArcGIS.Geodatabase.IEnumFieldError = Nothing
        Dim validatedFields As ESRI.ArcGIS.Geodatabase.IFields = Nothing
        fieldChecker.ValidateWorkspace = CType(workspace, ESRI.ArcGIS.Geodatabase.IWorkspace)
        fieldChecker.Validate(fields, enumFieldError, validatedFields)

        insideBhMpTable = tempFeatWorkspace.CreateTable("TEMP_TBL_BH_" & suffixSignature, validatedFields, uid, Nothing, "")
        
        Dim GP As Geoprocessor = New Geoprocessor()

        Dim insideBhMultiPatch As Inside3D
        Try
            insideBhMultiPatch = New Inside3D(tempVoxelFeatCls, tempBHMultipatchFeatCls, insideBhMpTable)

            GP.Execute(insideBhMultiPatch, Nothing)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try


Or maybe someone knows any example of Inside3D script? The documentation is really lack of example.

Thank you.

Outcomes