VBA: pattern informations

How do I get pattern informations of a pattern placed with "associative pattern" and "associative region boundary" with VBA?

Parents
  • Hi Jacqueline,

    Unknown said:
    How do I get pattern informations of a pattern placed with "associative pattern" and "associative region boundary" with VBA?

    There are no such methods / properties in MicroStation VBA available, but you can use PropertyHandler to access parameters availables in Element Information dialog.

    If Associative Region Boundary switch is on, a result of patterning is Associative Region, which is impemented as a cell element. So the whole process is to find a proper cell, create property handler and to access values using their Access Strings.

    Simple example:

    Option Explicit
    
    Public Sub GetPatternParams()
    
        Dim regionBoundary As CellElement
        Set regionBoundary = ActiveModelReference.GetElementByID(DLongFromLong(10892))
        
        Dim ph As PropertyHandler
        Set ph = CreatePropertyHandler(regionBoundary)
        
        ph.SelectByAccessString ("HatchAngle")
        Dim patternAngle As Double
        patternAngle = ph.GetValue * 180 / Pi
        
        MsgBox "Pattern angle: " & patternAngle
    
    End Sub

    With regards,

     Jan

    Answer Verified By: Mini 

Reply
  • Hi Jacqueline,

    Unknown said:
    How do I get pattern informations of a pattern placed with "associative pattern" and "associative region boundary" with VBA?

    There are no such methods / properties in MicroStation VBA available, but you can use PropertyHandler to access parameters availables in Element Information dialog.

    If Associative Region Boundary switch is on, a result of patterning is Associative Region, which is impemented as a cell element. So the whole process is to find a proper cell, create property handler and to access values using their Access Strings.

    Simple example:

    Option Explicit
    
    Public Sub GetPatternParams()
    
        Dim regionBoundary As CellElement
        Set regionBoundary = ActiveModelReference.GetElementByID(DLongFromLong(10892))
        
        Dim ph As PropertyHandler
        Set ph = CreatePropertyHandler(regionBoundary)
        
        ph.SelectByAccessString ("HatchAngle")
        Dim patternAngle As Double
        patternAngle = ph.GetValue * 180 / Pi
        
        MsgBox "Pattern angle: " & patternAngle
    
    End Sub

    With regards,

     Jan

    Answer Verified By: Mini 

Children