Friday, March 05, 2010

Set Elevation Points on a Feature Line (API)

Sometimes the Civil 3D API can be a bit confusing. Sometimes the API does a similar task in one place and a totally different way in another place. Setting elevation point(s) on a feature line is one such case. It can be a bit confusing on trying to figure out what exactly is required. Below is some sample code that shows how to set elevation points, assuming you already have a feature line created.

        Dim dPointPL(8) As Double
dPointPL(0) = 2010: dPointPL(1) = 2010
dPointPL(3) = 2579: dPointPL(4) = 2579
dPointPL(6) = 3010: dPointPL(7) = 2510

' SetPointElevation Method sets the elevation by input point.
Dim dPointElev(2) As Double
dPointElev(0) = 2010: dPointElev(1) = 2010: dPointElev(2) = 43
oFeatureLine2.SetPointElevation dPointElev

' SetPointsElevation Method sets the elevation by input points.
Dim vPointsPL As Variant
vPointsPL = dPointPL
vPointsPL(2) = 67
vPointsPL(5) = 79
vPointsPL(8) = 109
oFeatureLine2.SetPointsElevation vPointsPL

If I remember correctly you need to make sure the point is on the feature line before setting the point elevation.

No comments:


Blog Widget by LinkWithin