int hitPartIndex;             hitPartIndex = gcPolyline.GeometryCount;             hitPartIndex--;               IGeometry geometry = gcPolyline.get_Geometry(hitPartIndex);                var pointCollection = (IPointCollection4)geometry;                int indextransformPoint;               indextransformPoint = pointCollection.PointCount;               indextransformPoint--;                Double zOffset = Convert.ToDouble( textBox3.Text);                MessageBox.Show("zOffset = " + textBox3.Text);                            if (zOffset == 0 )                   return gcPolyline as IPolyline;             IPoint TestPoint;             TestPoint = pointCollection.get_Point(0);             TestPoint.X = pointCollection.get_Point(0).X;             TestPoint.Y = pointCollection.get_Point(0).Y;             TestPoint.Z = pointCollection.get_Point(0).Z + zOffset;              MessageBox.Show("test.z = " + TestPoint.Z.ToString());              var transform3D = (ITransform3D)TestPoint;             transform3D.Move3D(0, 0, zOffset);             pointCollection.UpdatePoint(indextransformPoint, TestPoint);Solved! Go to Solution.
        IApplication m_application;          public frmSetHeight()         {             InitializeComponent();         }          private void btnCancel_Click(object sender, EventArgs e)         {             this.Close();         }          private void btnOK_Click(object sender, EventArgs e)         {             m_application = AddHeight.ArcScene.Application;             ISxDocument pDoc =  ArcScene.Document;             IFeatureLayer pFtrLyr = GetCurrentFeatyreLayer();             IFeatureSelection pFtrSel = pFtrLyr as IFeatureSelection;                          IQueryFilter pFilter = new QueryFilterClass();             pFilter.WhereClause = "";             ICursor cursor;             pFtrSel.SelectionSet.Search(pFilter, false, out cursor);             IFeatureCursor pFtrCsr = cursor as IFeatureCursor;             IFeature pFtr = pFtrCsr.NextFeature();                          while(pFtr != null)             {                 ITransform3D trans3D = pFtr.Shape as ITransform3D;                 double dx = 0;                 double dy = 0;                 double dz = Convert.ToDouble(textBox1.Text);                  trans3D.Move3D(dx, dy,dz);                 pFtr.Store();                 pFtr = pFtrCsr.NextFeature();                              }                pDoc.Scene.SceneGraph.Invalidate (pFtrLyr, true, true );             pDoc.Scene.SceneGraph.RefreshViewers();         }          private IFeatureLayer GetCurrentFeatyreLayer()         {             var pLayer = ((ISxDocument)m_application.Document).SelectedLayer;             return pLayer as IFeatureLayer;         }IZAware zAware = TestPoint as IZAware; zAware.ZAware = true;
            int hitPartIndex = 0;
            hitPartIndex = gcPolyline.GeometryCount;
            hitPartIndex--;
              IGeometry geometry = gcPolyline.get_Geometry(hitPartIndex);
           
              var pointCollection = (IPointCollection4)geometry;
              int indextransformPoint = 1;
              indextransformPoint = pointCollection.PointCount;
              MessageBox.Show("indexTransformPoint = " + indextransformPoint.ToString() + 
                  "\nhitPartIndex = " + hitPartIndex.ToString());
              indextransformPoint--;
              Double zOffset = Convert.ToDouble( textBox3.Text);
              MessageBox.Show("zOffset = " + textBox3.Text);
              if (zOffset == 0 )
                  return gcPolyline as IPolyline;
            IPoint TestPoint;
            TestPoint = pointCollection.get_Point(indextransformPoint);
            TestPoint.X = pointCollection.get_Point(indextransformPoint).X;
            TestPoint.Y = pointCollection.get_Point(indextransformPoint).Y;
            TestPoint.Z = pointCollection.get_Point(indextransformPoint).Z + zOffset;
            
            var transform3D = (ITransform3D)TestPoint;
            transform3D.Move3D(0, 0, zOffset);
            var newTestPoint = (IPoint)transform3D;
            IZAware zAware = newTestPoint as IZAware;
            zAware.ZAware = true;
            pointCollection.UpdatePoint(indextransformPoint, newTestPoint);
            MessageBox.Show(pointCollection.get_Point(indextransformPoint).Z.ToString());
            m_application.RefreshWindow();
IPoint[] array = new IPoint[1];
            array[0] = newTestPoint;
            IGeometryBridge testBridge = new GeometryEnvironmentClass();
            //MessageBox.Show("until testBridge");
            try
            {
                testBridge.ReplacePoints(pointCollection, 0, 1, array);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            //MessageBox.Show("after testBridge"); 
 IPolyline pl = null; IFeature feature; pl = (IPolyline)feature.Shape; feature.Shape = ModifyVertexOfAPolyline((IGeometryCollection)pl);
        private IPolyline ModifyFirstVertexOfAPolyline(IGeometryCollection gcPolyline)
        {
            int hitPartIndex = 0;
            hitPartIndex = gcPolyline.GeometryCount;
            hitPartIndex--;
              IGeometry geometry = gcPolyline.get_Geometry(hitPartIndex);
              var pointCollection = (IPointCollection4)geometry;
              int indextransformPoint = 1;
              indextransformPoint = pointCollection.PointCount;
              MessageBox.Show("indexTransformPoint = " + indextransformPoint.ToString() + 
                  "\nhitPartIndex = " + hitPartIndex.ToString());
              indextransformPoint--;
              Double zOffset = Convert.ToDouble( textBox3.Text);
              if (zOffset == 0 )
                  return gcPolyline as IPolyline;
            IPoint TestPoint;
            TestPoint = pointCollection.get_Point(indextransformPoint);
            IZAware zAware = TestPoint as IZAware;
            zAware.ZAware = true;
            TestPoint.X = pointCollection.get_Point(indextransformPoint).X;
            TestPoint.Y = pointCollection.get_Point(indextransformPoint).Y;
            TestPoint.Z = pointCollection.get_Point(indextransformPoint).Z + zOffset;
            var transform3D = (ITransform3D)TestPoint;
            transform3D.Move3D(0, 0, zOffset);
            TestPoint = (IPoint)transform3D;
            var newTestPoint = (IPoint)transform3D;
            pointCollection.UpdatePoint(indextransformPoint, TestPoint);
            MessageBox.Show(pointCollection.get_Point(indextransformPoint).Z.ToString());
            m_application.RefreshWindow();
            return pointCollection as IPolyline;
        }
 IPolyline pl = null; IFeature feature; pl = (IPolyline)feature.Shape; feature.Shape = ModifyVertexOfAPolyline((IGeometryCollection)pl); feature.Store();
        IApplication m_application;          public frmSetHeight()         {             InitializeComponent();         }          private void btnCancel_Click(object sender, EventArgs e)         {             this.Close();         }          private void btnOK_Click(object sender, EventArgs e)         {             m_application = AddHeight.ArcScene.Application;             ISxDocument pDoc =  ArcScene.Document;             IFeatureLayer pFtrLyr = GetCurrentFeatyreLayer();             IFeatureSelection pFtrSel = pFtrLyr as IFeatureSelection;                          IQueryFilter pFilter = new QueryFilterClass();             pFilter.WhereClause = "";             ICursor cursor;             pFtrSel.SelectionSet.Search(pFilter, false, out cursor);             IFeatureCursor pFtrCsr = cursor as IFeatureCursor;             IFeature pFtr = pFtrCsr.NextFeature();                          while(pFtr != null)             {                 ITransform3D trans3D = pFtr.Shape as ITransform3D;                 double dx = 0;                 double dy = 0;                 double dz = Convert.ToDouble(textBox1.Text);                  trans3D.Move3D(dx, dy,dz);                 pFtr.Store();                 pFtr = pFtrCsr.NextFeature();                              }                pDoc.Scene.SceneGraph.Invalidate (pFtrLyr, true, true );             pDoc.Scene.SceneGraph.RefreshViewers();         }          private IFeatureLayer GetCurrentFeatyreLayer()         {             var pLayer = ((ISxDocument)m_application.Document).SelectedLayer;             return pLayer as IFeatureLayer;         }