laptop and a wrench

Error

IRelationResult.RelationElement property does not work in VBA - returns "Invalid use of property" compile error.

Última publicación: August 19, 2020 ArcGIS for Desktop
Número de ID del error NIM056080
EnviadoApril 6, 2010
Última modificaciónJune 5, 2024
Relacionado conArcGIS for Desktop
Versión encontrada9.3.1
Lenguaje del programaVBA
Sistema operativoWindows OS
Versión de sistema operativoXP
EstadoWill Not Be Addressed

Información adicional

We apologize that we were unable to address this issue within the current product support cycle.  If the issue continues to affect your work in a supported release, please contact Technical Support.

Solución alternativa

Use C# code: public void OnClick() { try { IWorkspaceFactory wsFact = new FileGDBWorkspaceFactoryClass(); IFeatureWorkspace featWS = (IFeatureWorkspace)wsFact.OpenFromFile(@"<a href="file:C:/incidents/792309/Test.gdb" target="_blank">C:\incidents\792309\Test.gdb</a>", 0); IFeatureClass featClsPoly = featWS.OpenFeatureClass("Polygon"); IFeatureClass featClsLine = featWS.OpenFeatureClass("Polyline"); object obj = Type.Missing; IGeometryCollection geomCollGon = new GeometryBagClass() as IGeometryCollection; IFeatureCursor featCur = featClsPoly.Search(null, false); IFeature feat = featCur.NextFeature(); while (feat != null) { geomCollGon.AddGeometry(feat.ShapeCopy, ref obj, ref obj); feat = featCur.NextFeature(); } IGeometryCollection geomCollLine = new GeometryBagClass() as IGeometryCollection; featCur = featClsLine.Search(null, false); feat = featCur.NextFeature(); while (feat != null) { geomCollLine.AddGeometry(feat.ShapeCopy, ref obj, ref obj); feat = featCur.NextFeature(); } IRelationalOperatorNxM relOpNxM = geomCollGon as IRelationalOperatorNxM; IRelationResult relRes = relOpNxM.Crosses(geomCollLine as IGeometryBag); int count = relRes.RelationElementCount; int left, right; for (int i = 0; i < count; i++) { relRes.RelationElement(i, out left, out right); IGeometry geomGon = geomCollGon.get_Geometry(left); IGeometry geomLine = geomCollLine.get_Geometry(right); } } catch (Exception e) { MessageBox.Show(e.Message); } }

Pasos para reproducir

ID del error: NIM056080

Software:

  • ArcGIS for Desktop

Recibir notificaciones cuando cambie el estado de un error

Descargar la aplicación de soporte de Esri

Descubrir más sobre este tema

Obtener ayuda de expertos en ArcGIS

Contactar con el soporte técnico

Descargar la aplicación de soporte de Esri

Ir a opciones de descarga