How to access system tables (x,y,z coordinates) with VBA for custom profile graph

220
3
11-19-2012 08:21 AM
DillianaRasheva
New Contributor
Hi all,

I am fairly new to Arc Objects and VBA. (Just finished Getting to Know Arc Objects book.) I need to create a custom profile graph using VBA (programmatically).

I am not sure how to access the system tables where x,y,z coordinates are stored in order to get these to create a profile graph of 3D line. I am interested in the interfaces that I need to access, along with which object model diagram they are on. Snippets will be very appreciated.

(Profile graph is a button in ArcMap 10 that prints a 3D profile of a 3D line feature over a surface.)

Thanks,
Dilliana
Tags (2)
0 Kudos
3 Replies
JaySandhu
Esri Regular Contributor
I am assuming that you want to list the X,Y,Z coordinates of every line in your feature class. Use the following VBA as a starting points and customize for your needs:
Jay Sandhu

Public Sub ListLineCoordinates()
  Dim pMxDoc As IMxDocument
  Set pMxDoc = ThisDocument
 
  Dim pFLayer As IFeatureLayer
  Set pFLayer = pMxDoc.SelectedLayer
 
  Dim pFeatureClass As IFeatureClass
  Set pFeatureClass = pFLayer.FeatureClass
 
  Dim pFeature As IFeature
  Dim pPoint As IPoint
  Dim pPCol As IPointCollection
  Dim numLines As Long, pointCount As Long, i As Long, j As Long
  Dim X As Double, Y As Double, Z As Double
 
  Dim pQ As IQueryFilter
  Set pQ = New QueryFilter
  pQ.WhereClause = ""
  numLines = pFeatureClass.FeatureCount(pQ)
 
  For i = 1 To numLines
      Set pFeature = pFeatureClass.GetFeature(i)
   
      Set pPCol = pFeature.ShapeCopy
      pointCount = pPCol.pointCount
      For j = 0 To pointCount - 1
        Set pPoint = pPCol.Point(i)
        X = pPoint.X
        Y = pPoint.Y
        Z = pPoint.Z
        Debug.Print i, j, X, Y, Z
      Next j
  Next i
End Sub
0 Kudos
DillianaRasheva
New Contributor
Hi Jay, I get an automation error (-2147219118). Please, see the attachment.

Is Create Profile Graph from 3D Analyst ext. customizable (names of axis, name of graph, etc. ?) I have not been able to find such information for quite a while.  Which objects/interfaces I need to access in order to customize it?

Thanks,
Di.
0 Kudos
DillianaRasheva
New Contributor
Jay,
I found what caused an error - the Point index. See bellow.

Set pPoint = pPCol.Point(j)

Thank you very much!
Dilliana
0 Kudos