laptop and a wrench

Bug

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

Last Published: August 19, 2020 ArcGIS for Desktop
Bug ID Number NIM056080
SubmittedApril 6, 2010
Last ModifiedJune 5, 2024
Applies toArcGIS for Desktop
Version found9.3.1
Program languageVBA
Operating SystemWindows OS
Operating System VersionXP
StatusWill Not Be Addressed

Additional Information

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.

Workaround

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); } }

Steps to Reproduce

Bug ID: NIM056080

Software:

  • ArcGIS for Desktop

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