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

Re: [v8i VBA] TextNode to View Independent?

$
0
0

Hi Bob,

That was one of my thoughts too.  I just did this with justification.  Here is my test code below.  I ran this on a file with one text element and one text node (two lines of text).  The results were:  1) The individual text element became view independent--good.  2) The textnode did not become view independent.  I've done three things to verify what is going on... a) I've added a "+" to each line of the textnode text to verify that the elements are rewritten properly, and b) I bring up a message box with the View Independent status which says the textnode element = False, and the two text subelement are both TRUE.  c) When I rotate my view, the textnode rotates with the view.

--Thanks,
--Robert Arnold

Sub TestVI()
    Dim ScanCriteria As ElementScanCriteria
    Dim ScanEnumerator As ElementEnumerator
    Dim Element As Element
    Dim ElemEnum As ElementEnumerator
    Dim MyTextNode As TextNodeElement
    Dim MyID As DLong
    
    Set ScanCriteria = New ElementScanCriteria
    ScanCriteria.ExcludeNonGraphical
    ScanCriteria.ExcludeAllTypes
    ScanCriteria.IncludeType msdElementTypeText
    ScanCriteria.IncludeType msdElementTypeTextNode
    
    Set ScanEnumerator = ActiveModelReference.Scan(ScanCriteria)
    Do While ScanEnumerator.MoveNext
        Set Element = ScanEnumerator.Current
        Select Case Element.Type
        Case msdElementTypeText
            Element.AsTextElement.IsViewIndependent = True
            Element.Rewrite
        Case msdElementTypeTextNode
            Set MyTextNode = Element
            MyID = MyTextNode.ID
            Set ElemEnum = MyTextNode.GetSubElements
            Do While ElemEnum.MoveNext
                ElemEnum.Current.AsTextElement.IsViewIndependent = True
                ElemEnum.Current.AsTextElement.Text = ElemEnum.Current.AsTextElement.Text & "+"
                ElemEnum.Current.Rewrite
            Loop
            
            Set MyTextNode = ActiveModelReference.GetElementByID(MyID)
            Dim Results As String
            Results = "TextNode Element is VI = " & MyTextNode.IsViewIndependent & vbCrLf
            Results = Results & "Individual line results ="
            Set ElemEnum = MyTextNode.GetSubElements
            Do While ElemEnum.MoveNext
                Results = Results & " " & ElemEnum.Current.AsTextElement.IsViewIndependent
            Loop
            
            MsgBox Results
        End Select
    Loop
    RedrawAllViews
End Sub

Viewing all articles
Browse latest Browse all 1677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>