(v8i SS3 VBA) Trying to bring in contours from ArcMap to MS but elvations are coming in incorrectly

The issue is that I the contours I have came from a .shp file and the line elevations are not being stored as elevations.  Instead they are being stored as string values in a property called "ELEVATION".  I have tried many different ways to get these come in with elevation so I can create a surface, but so far with no luck.  I was thinking that I could write a macro to get each line in my selection and pull the value from the property and set it as the line elevation.

 

What I have so far:

Public Sub ImportElevations()
Dim oElEnum As ElementEnumerator
Dim oEl As LineElement
Dim oPropHand As PropertyHandler
Dim getElevationFromCustom As String

Set oElEnum = ActiveModelReference.GetSelectedElements
oElEnum.Reset
While oElEnum.MoveNext
    Set oEl = oElEnum.Current
    Set oPropHand = CreatePropertyHandler(oElEnum.Current)
   
    If (oPropHand.SelectByAccessString("ELEVATION")) Then
    getElevationFromCustom = oPropHand.GetDisplayString
   
    ' Write getElevationFromCustom to line elevation
   
    End If
Wend
    oEl.Redraw msdDrawingModeNormal
    oEl.Rewrite
End Sub

Has anyone dealt with this before?

Thanks,

Matt

Parents
  • Matt,

    The ELEVATION element properties value you provided within the sample .dgn file can be get and set the property without any problems.  Presuming that you are not encountering any problem in doing so, to set an element's elevation (z depth points) you may want to refer to the MicroStation VBA Help file topic: "Flattening Elements" that provides some sample code to "flatten" an element to the current view depth setting.

    If Jan's suggestion does not help with your specific workflow/goal's end results maybe you could provide some additional details describing what your overall workflow would be.  And let us know if the goal is to modify elements elevation directly in the .shp file/project or creating elements at a desired elevation stored in a seperate output .dgn file having no further requirements to synchronize with the original .shp file/project elements.

    Bob



Reply
  • Matt,

    The ELEVATION element properties value you provided within the sample .dgn file can be get and set the property without any problems.  Presuming that you are not encountering any problem in doing so, to set an element's elevation (z depth points) you may want to refer to the MicroStation VBA Help file topic: "Flattening Elements" that provides some sample code to "flatten" an element to the current view depth setting.

    If Jan's suggestion does not help with your specific workflow/goal's end results maybe you could provide some additional details describing what your overall workflow would be.  And let us know if the goal is to modify elements elevation directly in the .shp file/project or creating elements at a desired elevation stored in a seperate output .dgn file having no further requirements to synchronize with the original .shp file/project elements.

    Bob



Children
No Data