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

RE: Displaying levels in attachment using OpenDesignForProgramming

$
0
0

[quote user="James Manfield"]For Each oAttachment In myDGN.Models("Drawing").Attachments[/quote]

There are two tests in that line.  The explicit test is whether a model named Drawing exists.  The implicit test is that at least one attachment exists.

Used Debug.Assert to check that assumption...

Dim oModel As ModelReference
Set oModel = myDGN.Models("Drawing")
Debug.Assert Not oModel Is Nothing
If Not oModel Is Nothing Then
  Debug.Print "No. attachments=" & CStr(oModel.Attachments.Count)
  If 0 < oModel.Attachments.Count Then
    For Each oAttachment In oModel.Attachments
Next oAttachment End If End If

If you OpenDesignFileForProgram, check to see if you have any attachment.  If the VBA method is a wrapper around mdlWorkDgn_open, then it won't have any attachments.  If you don't have any attachment, then you won't see any levels.

[quote user="James Manfield"]If Right(FSOFile.Name, 4) = ".dgn" Then[/quote]

Article Check a Design File with MicroStation VBA shows how to verify that a file is a DGN file.  It relies on an MDL function rather than the file extension.  That way, you can check whether any file is a DGN file, irrespective of its extension.


Viewing all articles
Browse latest Browse all 7260

Trending Articles



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