laptop and a wrench

Bug

Cannot import vertical multipatches into SDE.

Last Published: August 25, 2014 No Product Found
Bug ID Number NIM011541
SubmittedSeptember 10, 2007
Last ModifiedApril 2, 2025
Applies toNo Product Found
Version found9.2
Version Fixed9.3
StatusFixed

Workaround

Use the following code:Option Explicit' Use to ensure multipatch footprints are 'simple' relative to target spatial referencePublic Sub FileMultiPatchToSDE() On Error GoTo EH ' First layer in doc contains input multipatch feature class ' Second layer is target SDE multipatch feature class. You can make the FC with ArcCatalog ' (an empty FC with the proper spatial reference) then place it in the doc. Dim pDoc As IMxDocument Set pDoc = ThisDocument ' Get input Dim pFL As IFeatureLayer Set pFL = pDoc.ActiveView.FocusMap.Layer(0) Dim pInFC As IFeatureClass Set pInFC = pFL.FeatureClass Dim pInFCur As IFeatureCursor Set pInFCur = pInFC.Search(Nothing, True) Dim pInF As IFeature Set pInF = pInFCur.NextFeature ' Get output - assumed to reside in SDE feature dataset Set pFL = pDoc.ActiveView.FocusMap.Layer(1) Dim pOutFC As IFeatureClass Set pOutFC = pFL.FeatureClass Dim pWE As IWorkspaceEdit If (pOutFC.FeatureDataset Is Nothing) Then Dim pDS As IDataset Set pDS = pOutFC Set pWE = pDS.Workspace Else Set pWE = pOutFC.FeatureDataset.Workspace End If pWE.StartEditing False pWE.StartEditOperation Dim pOutGDS As IGeoDataset Set pOutGDS = pOutFC Dim pSR As ISpatialReference Set pSR = pOutGDS.SpatialReference Dim pOutCursor As IFeatureCursor Set pOutCursor = pOutFC.Insert(True) Dim pOutBuffer As IFeatureBuffer Set pOutBuffer = pOutFC.CreateFeatureBuffer Do While (Not pInF Is Nothing) ' Get the shape Dim pMP As IMultiPatch2 Set pMP = pInF.ShapeCopy ' Snap and simplify projected footprint relative to output spatial ref Dim pTransform As ITransform3D Set pTransform = pMP Dim pGeom As IGeometry Set pGeom = pTransform.ProjectToPlane(Nothing, Nothing, Nothing) Set pGeom.SpatialReference = pSR pGeom.SnapToSpatialReference Dim pTopo As ITopologicalOperator2 Set pTopo = pGeom pTopo.IsKnownSimple = False pTopo.Simplify ' Check if simplify was able to generate a clean footprint. If not (e.g., feature with ' no 2D area, like a vertical cylinder with no top and bottom) use the 2D bounding box ' as the footprint. For completeness, this test should also check for an axis aligned ' vertical feature (e.g., wall) that would yield a 0 area envelope. That would be another ' special case. Dim pGC As IGeometryCollection Set pGC = pTopo If (pGC.GeometryCount = 0) Then Set pGeom = pMP Set pMP.XYFootprint = EnvelopeAsPoly(pGeom.Envelope) Else Set pMP.XYFootprint = pTopo End If Set pOutBuffer.Shape = pMP pOutCursor.InsertFeature pOutBuffer Set pInF = pInFCur.NextFeature Loop Set pOutBuffer = Nothing Set pOutCursor = Nothing pWE.StopEditOperation pWE.StopEditing True Exit SubEH: Debug.Print Err.DescriptionEnd SubPublic Function EnvelopeAsPoly(pEnvelope As IEnvelope) As IPolygon Dim xmin As Double, ymin As Double, xmax As Double, ymax As Double pEnvelope.QueryCoords xmin, ymin, xmax, ymax Dim pt As IPoint Dim pRing As IPointCollection Set pRing = New Ring Set pt = New esriGeometry.Point pt.X = xmin pt.Y = ymin pRing.AddPoint pt pt.Y = ymax pRing.AddPoint pt pt.X = xmax pRing.AddPoint pt pt.Y = ymin pRing.AddPoint pt pt.X = xmin pRing.AddPoint pt Dim pPoly As IGeometryCollection Set pPoly = New esriGeometry.Polygon pPoly.AddGeometry pRing Set EnvelopeAsPoly = pPolyEnd Function

Steps to Reproduce

Bug ID: NIM011541

Software:

  • No Product Found

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options