Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [Connect update 4 VBA] Text Node problem

$
0
0

There are two problems at this time to address.

Item 1.  It is not correct to attempt to modify certain properties; like IsViewDependent; on child/component SubElements of a complex.  Certain properties should be applied at the complex header to ensure consistent behavior with all child elements.  Setting a try TextElement IsViewDependent property is valid; however if the Text Element is a component of a Text Node then you need to set the IsViewDependent property at the Text Node header (not SubElement level).  Please see and test the code sample below to see one way of attempting this type of handling/processing.

Item 2.  We have identified an issue (Defect 656101) related to behaviors rewriting certain child components of complex elements (e.g. Text in a Text Node) that fail.  This will be corrected in MicroStation CONNECT Edition Update 5 once released.

HTH,
Bob (and Artur)

Sub TEST_ProcessTextElements()
    
    Dim oEE As ElementEnumerator
    Dim oEl As Element, oText As textElement
    Set oEE = ActiveModelReference.GetSelectedElements
    
    Do While (oEE.MoveNext)
        
        ' Process Text and Text Nodes
        Set oEl = oEE.Current
        Select Case oEl.Type
        
        Case msdElementTypeText
            ProcessTextElement oEl
            
        Case msdElementTypeTextNode
            ProcessTextNode oEl
        
        Case Default
            Exit Sub
        
        End Select
        
    Loop

End Sub

Sub ElementSetViewDependent(oEl As Element, bViewDependent As Boolean)
    
    Dim oPH As PropertyHandler
    Set oPH = CreatePropertyHandler(oEl)
    oPH.SelectByAccessString ("ViewDependent")
    oPH.SetValue (bViewDependent)

End Sub

Sub ProcessTextNode(oEl As Element)
    
    ' Process Text Node properties not applicable to Text Components here.
    '    e.g. Set View Dependent(Text Node Property vs. Text Element "simple" Properties - invalid)
    ElementSetViewDependent oEl, False
        
    ' ### Process additional "simple" (non component) Text Element properties
    Dim ee As ElementEnumerator
    Set ee = oEl.AsTextNodeElement.GetSubElements
    Do While (ee.MoveNext)
        If (ee.Current.Type = msdElementTypeText) Then
            ProcessTextElement ee.Current
        End If
    Loop
    
End Sub

Sub ProcessTextElement(oEl As Element)
    
    Dim bComponent As Boolean
    bComponent = ActiveModelReference.GetElementByID(oEl.id).IsComponentElement
    
    Select Case bComponent
        Case False ' Simple Text Elements - Can be view dependent
            ElementSetViewDependent oEl, False
        Case True ' Process additional Text SubElements of Text Node
        ' ### Cannot set view dependent properties of Text child component(SubElements) of a TextNode
    End Select

End Sub

Viewing all articles
Browse latest Browse all 7260

Trending Articles