AutoCAD Civil 3D .NET API ProfilePVI.Elevation allows us to get or set the elevation value of the PVI. There was some issue around setting a negative elevation value using ProfilePVI.Elevation API in Civil 3D 2012 and the same is addressed now in Civil 3D 2013 .NET API.
Here is a VB.NET code snippet which demonstrates how to set a negative elevation value to a PVI object in AutoCAD Civil 3D 2013:
Using (trans)
' Select the Profile
Dim promptEntOp As New PromptEntityOptions(vbCrLf + "Select a Profile : ")
Dim promptEntRs As PromptEntityResult
promptEntRs = ed.GetEntity(promptEntOp)
If promptEntRs.Status PromptStatus.OK Then
ed.WriteMessage("Exiting! Try Again !")
Exit Sub
End If
Dim idEnt As ObjectId = promptEntRs.ObjectId
'' Get the Profile object
Dim profile As Profile = trans.GetObject(idEnt, OpenMode.ForRead)
Dim o_PVI As ProfilePVI = profile.PVIs.Item(1)
ed.WriteMessage(vbCrLf + "PVI Station : " + o_PVI.Station.ToString() + " " + "PVI Elevation : " + o_PVI.Elevation.ToString())
' Try chnaging the PVI Elevation value now
Try
o_PVI.Elevation = -3.0 '' This value is specific to a test DWG file
ed.WriteMessage(vbCrLf + "PVI Elevation after Change : " + o_PVI.Elevation.ToString())
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, )
Exit Sub
End Try
End Using

Leave a Reply