Dim i As Integer For i = 0 To pTinAdv.TriangleCount -1 Set pTinTriangle = pTinAdv.GetTriangle(i) dim poly as IPolygon set poly = new polygon 'set polygon spatial reference dim polyPtColl as IPointCollection set polyPtColl = poly dim pt as IPoint set pt = new Point 'set point spatial reference (same as TIN) dim j as integer for j = 0 to 2 pTinTriangle.Node(j).QueryAsPoint pt polyPtColl.AddPoint(pt) next poly.Simplify Set pPolyLayer = pScene.Layer(1) Set pPolyFC = pPolyLayer.FeatureClass Set pFeat = pPolyFC.CreateFeature On Error Resume Next Set pFeat.Shape = poly pFeat.Store Next You may also write something like this: Set pTinTriangle = pTinAdv.GetTriangle(i) dim ring as Iring pTinTriangle.QueryAsRing ring dim poly as IPolygon set poly = new polygon 'set poly spatial reference (same as TIN) dim polyGeoColl as IgeometryCollection set polyGeoColl = poly polyGeoColl.AddGeometry(ring) poly.simplify 'set shape on feature
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 pZAwarePoly As IZAware Dim pPolyLayer As IFeatureLayer2 Dim pPolyFC As IFeatureClass Dim pFeat As IFeature Dim i As Integer For i = 1 To pTinAdv.TriangleCount Set pTinTriangle = pTinAdv.GetTriangle(i) Dim pPolygon As IPolygon Set pPolygon = New polygon Set pZAwarePoly = pPolygon pZAwarePoly.ZAware = True Dim pPointColl As IPointCollection4 Set pPointColl = pPolygon Dim pPoint As IPoint Set pPoint = New Point Dim j As Integer For j = 0 To 2 pTinTriangle.Node(j).QueryAsPoint pPoint pPointColl.AddPoint pPoint Next pPolygon.SimplifyPreserveFromTo Set pPolyLayer = pScene.Layer(1) Set pPolyFC = pPolyLayer.FeatureClass Set pFeat = pPolyFC.CreateFeature On Error Resume Next Set pFeat.Shape = pPolygon pFeat.Store Next pSxDoc.UpdateContents pSxDoc.Scene.SceneGraph.Invalidate pPolyLayer, True, True pSxDoc.Scene.SceneGraph.RefreshViewers