Tag Archives: arcgis

ArcGIS Add in Config.esriaddinx

In ArcGIS 10, the add-in package does not automatically build a workable xml config file for you. You have to add the follow piece of code in yourself between the Tags.

 <ArcMap>

      <Commands>
        <Button class="[exact name of button file]" 
                caption="[shown in addin manager]" 
                tip=""  
                message="" 
                image="Images\Button12.png">

          <Help heading="">Help</Help>
        </Button>

      </Commands>

 </ArcMap>

Use ArcScene tags, for example, if it is an add in for ArcScene.
For toolbox, declare all button tags first. And then Add tag.
Do not use “&” in your xml file.

Zaware

It is necessary to declare a Zaware for a 3d point before the Z value can be defined.

Dim pPoint1 As IPoint
Set pPoint1 = New Point
pPoint1.PutCoords 1, 1
Dim pZAware As IZAware
Set pZAware = pPoint1
pZAware.ZAware = True
pPoint1.z = 11.1

ArcGIS Intersections

Dim pTopo As ITopologicalOperator
Set pTopo = pF1.Shape ‘ store the line 1 shape in the topo op
If Not pTopo.IsSimple Then pTopo.Simplify
Dim pGeom As IGeometry
Set pGeom = pTopo.Intersect(pF2.Shape, esriGeometry0Dimension) ‘ get intersection with line 2
If pGeom.IsEmpty Then
MsgBox “The intersection of the 2 geometries is empty or consists of points”
Exit Sub
Else
Dim ppcl As IPointCollection
Set ppcl = pGeom
MsgBox ppcl.Point(0).X & “, ” & ppcl.Point(0).Y
End If

esriGeometry0Dimension are points (IPointCollection)
esriGeometry1Dimension are lines (IPolyline)
For more information:
http://edndoc.esri.com/arcobjects/9.1/componenthelp/esriGeometry/esriGeometryDimension.htm

Getting a user’s selected feature in ArcGIS VBA/VB.NET

Dim pFL2 As IFeatureLayer
Set pFL2 = pMap.Layer(0)

Set pF2 As IFeature

Dim pfs As IFeatureSelection
Set pfs = pFL2
Dim id As Long
id = pfs.SelectionSet.IDs.Next
Set pF2 = pFL2.FeatureClass.GetFeature(id) ‘ this is line 2

Then you can do stuff on the Ifeature pF2 and pf2.Shape