[SS10] Is there any way to get OpenRoads information on elements such as feature name and feature definition?

In looking for the answer to this, I found this post https://communities.bentley.com/products/programming/civil_programming/f/civil_programming_forum/181745/openroads-property-handler-expression which uses GetDisplayValue which doesn't come up anywhere in the VBA object browser. (For that matter, there's a use of "this" which gives no clarity as to where to look next.)

I did a search for GetElement in the object browser, and a method by this name applies to ElementCache and NamedGroupMember, and both of these methods return an Element which doesn't have GetDisplayValue.

Parents
  • Hi Derek,

    [SS10] Is there any way to get OpenRoads information

    I am confused a bit, because you use SS10 (SELECTseries 10?) named in subject, but also OpenRoads (Designer?), which is available only as CONNECT Edition. What product do you use?

    information on elements such as feature name and feature definition?

    Please be exact as much as possible. ORD data structure is very complex, typically no data are "on element", but are linked to individual elements, representing particular aspects of feature (horizontal geometry, vertical profile etc.). So the answer can be different whether you are interested in Feature name or geometry length or...

    To share DGN can help, or at least dialog with highlighted features you are interested would help.

    I found this pos

    The linked discussion is not about VBA API (or API at all), but about EC Expressions (specifically Item Types expressions, available in ORD), so the information cannot be transformed directly.

    an Element which doesn't have GetDisplayValue.

    Yes, it is expected result.

    VBA is very limited in this area, but it would be possible to PropertyHandler to access information, displayed in Properties dialog.

    With regards,

      Jan

Reply
  • Hi Derek,

    [SS10] Is there any way to get OpenRoads information

    I am confused a bit, because you use SS10 (SELECTseries 10?) named in subject, but also OpenRoads (Designer?), which is available only as CONNECT Edition. What product do you use?

    information on elements such as feature name and feature definition?

    Please be exact as much as possible. ORD data structure is very complex, typically no data are "on element", but are linked to individual elements, representing particular aspects of feature (horizontal geometry, vertical profile etc.). So the answer can be different whether you are interested in Feature name or geometry length or...

    To share DGN can help, or at least dialog with highlighted features you are interested would help.

    I found this pos

    The linked discussion is not about VBA API (or API at all), but about EC Expressions (specifically Item Types expressions, available in ORD), so the information cannot be transformed directly.

    an Element which doesn't have GetDisplayValue.

    Yes, it is expected result.

    VBA is very limited in this area, but it would be possible to PropertyHandler to access information, displayed in Properties dialog.

    With regards,

      Jan

Children
  • I use Geopak SS10. I guess it would be more precise to say "Civil" information or "Property" information. Stuff like name and feature definition.

    The linked discussion is not about VBA API (or API at all), but about EC Expressions (specifically Item Types expressions, available in ORD), so the information cannot be transformed directly.

    Fair enough. Somehow I woefully misinterpreted that whole thing. Probably because I came across it in my efforts to use VBA, the thread was in the civil programming forum, and from there apparently I didn't think twice. (Actually, looking at it again, my first wasn't a woeful misread, but it wasn't exactly on the nose either, and further research did pay off for me.)

    VBA is very limited in this area, but it would be possible to PropertyHandler to access information, displayed in Properties dialog.

    This sounds like it's what I'm looking for. Thanks for that. From here, I find my way to these sample subroutines in the V8i VBA help file:

    Sub ShowLineStringPropertyStrings(ele As LineElement)
        Dim oPH As PropertyHandler
        Set oPH = CreatePropertyHandler(ele)
        
        Dim lastSegment As String
        lastSegment = "Segments[" & (ele.VerticesCount - 2) & "]."
        
        ShowDisplayString oPH, lastSegment & "Start"
        ShowDisplayString oPH, lastSegment & "End"
        ShowDisplayString oPH, lastSegment & "Length"
        ShowDisplayString oPH, lastSegment & "Direction"
        ShowDisplayString oPH, lastSegment & "ElevationAngle"
        ShowDisplayString oPH, lastSegment & "DeltaX"
        ShowDisplayString oPH, lastSegment & "DeltaY"
        ShowDisplayString oPH, lastSegment & "DeltaZ"
        ShowDisplayString oPH, "TotalLength"
        ShowDisplayString oPH, "Thickness"
    End Sub
    
    Sub ShowLineStringPropertyValues(ele As LineElement)
        Dim oPH As PropertyHandler
        Set oPH = CreatePropertyHandler(ele)
        
        '  Segments. and Segments[0]. are equivalent
        ShowValue oPH, "Segments.Start", False, True
        ShowValue oPH, "Segments.End", False, True
        ShowValue oPH, "Segments.Length", False, False
        ShowValue oPH, "Segments.Direction", False, False
        ShowValue oPH, "Segments.ElevationAngle", False, False
        ShowValue oPH, "Segments.DeltaX", False, False
        ShowValue oPH, "Segments.DeltaY", False, False
        ShowValue oPH, "Segments.DeltaZ", False, False
        ShowValue oPH, "TotalLength", False, False
        ShowValue oPH, "Thickness", False, False
    End Sub
    
    Private Sub ShowDisplayString(oPH As PropertyHandler, accessString As String)
        On Error GoTo HandleError
        
        If Not oPH.SelectByAccessString(accessString) Then
            Debug.Print "NOT FOUND!!"
        Else
            Debug.Print oPH.GetDisplayString
        End If
        
        Exit Sub
    HandleError:
        Debug.Print Err.Description
    End Sub
    
    Private Sub ShowValue(oPH As PropertyHandler, accessString As String, isDlong As Boolean, isPoint As Boolean)
        On Error GoTo HandleError
        
        If Not oPH.SelectByAccessString(accessString) Then
            Debug.Print "NOT FOUND!!"
        Else
            If isPoint Then
                Dim pnt As Point3d
                
                pnt = oPH.GetValueAsPoint3d
                Debug.Print "(" & pnt.X & "," & pnt.Y & "," & pnt.Z & ")"
            ElseIf isDlong Then
                Debug.Print DLongToString(oPH.GetValueAsDLong)
            Else
                Debug.Print oPH.GetValue
            End If
        End If
        
        Exit Sub
    HandleError:
        Debug.Print Err.Description
    End Sub
    
    

    I find a hint in the inclusion of "Segments.Start", etc. From testing of the above subs, the following statements exhibit a solution to one of my goals:

    Private Function GetProperty(oPH As PropertyHandler, sProperty As String)
        'sample function call:
        '   FeatureName = GetProperty( CreatePropertyHandler(element), "FeatureName")
        '(though ordinarily you'd be calling it with a more permanent property handler, particularly if you have several values to check)
        If oPH.SelectByAccessString(sProperty) Then GetProperty = oPH.GetValue
    End Function
    

    (For a list of all properties valid for a given element, oPH.GetAccessStrings returns an array of strings.)

    Because it takes a property handler to get these values, I suppose the implication is that I would have to scan through an element enumerator as exhibited in the little loop above, then comparing values for each element, to identify the right element.

    Thanks very much for giving me the prompt I needed, Jan.

    Follow-up question: Is there any access through VBA to feature definitions and element templates?

    Answer Verified By: Derek Schmidt 

  • Is there any access through VBA to feature definitions and element templates?

    Please, ask in a new post.

    Regards,

      Jan