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

RE: Displaying levels in attachment using OpenDesignForProgramming

$
0
0

Hi James,

this code works for active model:

Option Explicit

' Application entry point
Public Sub FindLevelsInReferences()
 
    MessageCenter.AddMessage "--- Levels in references ---", "", msdMessageCenterPriorityInfo, False
    IterateThrougAllReferences
 
End Sub
 
' Iterate through all attachments
Private Sub IterateThrougAllReferences()
 
    Dim att As attachment
     
    For Each att In ActiveModelReference.Attachments
        If (AttachmentCanBeProcessed(att)) Then
            PrintLevelsInAttachment att
        End If
    Next
 
End Sub
 
' Do any testing if the attachment should be processed
Private Function AttachmentCanBeProcessed(att As attachment) As Boolean
 
    If (att.AttachModelName = "Default") Then
        AttachmentCanBeProcessed = True
    Else
        AttachmentCanBeProcessed = False
    End If
     
End Function
 
' Print information about attachment
Private Sub PrintLevelsInAttachment(att As attachment)
 
    Dim lvl As Level
     
    For Each lvl In att.Levels
        MessageCenter.AddMessage att.AttachName & ": " & lvl.Name, "", msdMessageCenterPriorityInfo, False
    Next
 
End Sub

You can use it to test it with your test dataset (files) and to adapt it to be called from your code.

With regards,

  Jan


Viewing all articles
Browse latest Browse all 7260

Trending Articles



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