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

Re: VBA test if dgn checked out from ProjectWise

$
0
0

Stephanie,

There are two cases typically involed with with MicroStation and ProjectWise integration from a VBA perspective.

One is how to tell if your MicroStation session is integrated with ProjectWise so your VBA code can react accordingly.

The first case is rather easy to do by check to see if ProjectWise's MicroStation integration is actively loaded (mcm.ma).  Here is some code to do that check:

Sub TEST_MDLIsLoaded()

   Dim bResult As Boolean

   bResult = MDLIsLoaded("mcm")

   Debug.Print "MDLIsLoaded: " & bResult

End Sub

Public Function MDLIsLoaded(sAppName As String) As Boolean

   Dim strExpr As String

   ' Find MDL application by name

   strExpr = "mdlSystem_findMdlDesc(""" & sAppName & """)"

   MDLIsLoaded = MicroStationDGN.Application.GetCExpressionValue(strExpr)

End Function

The second is to call/declare Native code C functions from the ProjectWise API in VBA.  This gets tricky since you will likely be declaring quite a bit of C code to call in VBA.  In fact, most developers in this situation end up coding simple wrapper functions in a C/C++ library (.dll) that can be called from VBA in a simple and more straight-forward sense w/o needing to declare as many external functions and types that will be required.  It also makes debugging your code and the ProjectWise API much more simple and straight-forward.

WRT your more specific question.  Currently there is no MicroStation (or ProjectWise) configuration variable stating which document(s) are checked out on a client.  Depending on the workflow and/or restrictions, this could be a very large number of documents and their respective paths.  In the ProjectWise API you could use: aaApi_IsDocumentCheckedOutToMe() where you can provide a project number and computer node, or you can check the active MicroStation design file currently open to see if it is checked out (to you) using mdmMain_getActiveMDocument().

HTH,

Bob


Viewing all articles
Browse latest Browse all 1677

Trending Articles



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