alcaraz

How does IZ.InterpolateFromSurface work?

Discussion created by alcaraz on Dec 1, 2011
Latest reply on Dec 6, 2011 by alcaraz
Hi, I am trying to convert a tin to a 3D polygon feature class. Could someone help me with this code? I am not sure it is correct.

I got this error "The geometry has null Z values" on the line  "Set pFeat.Shape = pPoly"

Hope Neil to be there!!! Thanks, Mar


Dim pSxDoc As ISxDocument
Set pSxDoc = ThisDocument

Dim pScene As IScene
Set pScene = pSxDoc.Scene

Dim pTinLayer As ITinLayer
Set pTinLayer = pScene.Layer(0)

Dim pTin As ITin
Set pTin = pTinLayer.Dataset

Dim pTinAdv As ITinAdvanced2
Set pTinAdv = pTin

Dim pTinTriangle As ITinTriangle
Dim pTinPoly As ITinPolygon
Dim pPoly As IPolygon5
Dim pZAware As IZAware
Dim pPolyLayer As IFeatureLayer
Dim pPolyFC As IFeatureClass
Dim pFeat As IFeature
Dim pFunSurf As IFunctionalSurface
Dim pIZ As IZ

Dim i As Long
For i = 1 To pTinAdv.TriangleCount

Set pTinTriangle = pTinAdv.GetTriangle(i)

Set pTinPoly = pTinAdv.ExtractPolygon(pTinTriangle, Nothing, False)

Set pPoly = pTinPoly.AsPolygon(Nothing, True)

Set pPolyLayer = pScene.Layer(1)

Set pPolyFC = pPolyLayer.FeatureClass

Set pZAware = pPoly
pZAware.ZAware = True

Set pFunSurf = pTin

Set pIZ = pPoly
pIZ.InterpolateFromSurface pFunSurf

Set pFeat = pPolyFC.CreateFeature
Set pFeat.Shape = pPoly        "The geometry has null Z values"
pFeat.Store

Next

Outcomes