VBA with dgn's in ProjectWise

(Using Micorstation v8i)  Here is some simple code I could use to get a dgn that is in ProjectWise: 

Set myFile = OpenDesignFileForProgram("PW_WORKDIR:dms00251\46977-B-RD-DS-dck.dgn")

The problem is I have to hard code the path of the file.  I know Microstation uses the MSDIR configuration variable to search the current file system, so i don't know if there's a way to incorporate that?.....basically, what's an easy way of accessing files in ProjectWise with VBA instead of accessing the file that's in the working directory (i.e. my C:/ drive)?




  • dksaluki: I know Microstation uses the MSDIR configuration variable

    That's true in a normal user configuration, but isn't true with ProjectWise. PW is using its own variables and folders …

    • PW_WORKDIR: PW's top-level working folder
    • dms00251: one of many sub-folders having names invented by PW

    You can evaluate PW_WORKDIR using VBA (ActiveWorkspace.ExpandConfigurationVariable ("PW_WORKDIR")), but you become stuck with the sub-folder name.

    Regards, Jon Summers
    LA Solutions

    Regards, Jon Summers
    LA Solutions

  • Dear dksaluki,

    This is difficult question.

    The code you sketch is not going to work – only the checked out files are available locally (and some deleted files depending on your settings!). Trying to open file that are in ProjectWise means ProjectWise will have to check-out the file this means direct contact between your code and ProjectWise (=ProjectWise SDK) your example is just file based.

    Using VBA with ProjectWise is not an easy task, the time spent converting data types between C and VB can be a large portion of the programming time.

    Using MDL code you can use the ProjectWise SDK for MDL to open files in ProjectWise when driven from Microstation.

    Driving the whole process from ProjectWise is usually easier but the options are dependent on what you are trying to do.

    What you are try to achieve ?

    Best Regards,

    Ian Emery