open design for program

Dear Experts,

In my opinion running batch process for functions like manipulating visibility of reference levels just takes long time. In contrast running the similar functions while using "OpenDesignForProgram" seems to be faster. Please find attached with this post a zip file which has an Excel document, a bas file, and few DGN for test.

Here is how this process is thought of. I know it might be a long route but I find this very quick if I figure out the issue I am having.  For using the attached files please download the zip file and unzip it to your desktop.

1) Open the attached Excel and give folder path in Cell C3. - The folder path is to the folder which contains all the DGNs for programming.

2) Click "Import". - This will populate column B with the names of DGN for programming.

3) Select all the cells in column B and minimize Excel. - This is our selection of files we want to run functions on.

2) Open MicroStation and open any file other than the ones in the above mentioned folder path.

3) Create a new mbva and import the .bas file into your VBA Editor.

4) Make sure you have references for EXCEL 12.0 or otherwise.

5) Run the macro. - If things are setup correctly then all should go well.

On a side note please make sure the DGNs in your desktop have the title block attached. I did updated them but they seem to change sometimes.

 

My issue is, the program runs just fine. No errors are generated. But when I open the DGN I don't see any changes with levels. The changes made are not saved in the DGNs.

When I make changes in DGNs manually by clicking the levels visibility turn off or on I usually have to do Save Settings. And then those settings are remembered. What would be the process to do this in VBA for the process I am following.

Your help on this would be a great help to me. I believe this will open a whole new set of processes for me to work on DGN files. Please let me know.

Sincerely,

Rabi

layervisibility.zip
  • You can't modify attachments since they are read only. You can modify only active model and probably you should read more about difference between model and attachment. Model is a content of design file while attachment is just reference to it..... To get this working as you need, you should open each of that attachment with use of method OpenDesignFileForProgram as well, since you need to do modifications... Then modify levels and save it... After this, if you need to see changes in some open design file, that has those attached, you would want to reattach them to see changes made outside...

    Dan

  • Rabi:

    Anybody?

    Open the attached …

    People who respond on these Forums do so voluntarily. We're happy to steer people in the right direction, point out misunderstandings with the APIs, or suggest improvements to fragments of code that you publish.

    What we don't provide is a free project analysis or code debugging service. If you have a complex project that requires specific versions of application A (MicroStation XM) and application B (Excel 12) then you asking a lot.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Jon Summers:

    What we don't provide is a free project analysis or code debugging service.

    Right!!

    Now I just opened that archive and looked into and found for the first sight that he modified attachment and rewrote models...

    Previously I didn't response just because I don't consider myself as expert... permanent rush is another reason...  

  • Dear Jon,

    All I was doing was to make it easier for you and all to look into a case which I was running into. I had my project running but was not working. Thus to pack everything into a zip file I thought would be easier for you and others to reproduce the situation. I have no intention to get your help for projects and ask your help for free. :)

    I have been trying to resolve and understand the thread topic for quite sometime and this was an effort to understand the process. I am sorry you took it otherwise.

    Anyways thanks for your help.

    Sincerely,

    Rabi

  • Hi,

    I have not downloaded your vba, but I saw the phrase "manipulating visibility of reference levels" in your description.  There is a different thread with info that may affect you:

    http://communities.bentley.com/Products/MicroStation/MicroStation_V8i/MicroStation_V8i_VBA/f/19570/t/33896.aspx

    In the above thread, it was discovered that the reference files do not load on the opendesignforprogram command.

    --Robert

  • I haven't looked at any of the code, but I might have an idea of the problem and it is touched on in the original post.
    As the original poster noted, to get some of the changes to stick require "Save Settings".
    However, this command is a method of Application object and not of Model or DesignFile.
    For this reason, there is no way I am currently aware of to "Save Settings" on a file opened with OpenDesignFileForProgram using available VBA methods.

    I have not yet researched MDL alternatives, and hopefully there is one.
    This has frustrated me for some time because certain changes can easily be made on many files using OpenDesignFileForProgram, but the resulting change cannot be saved.

    -G-

  • Gerald Hernandez:

    This has frustrated me for some time because certain changes can easily be made on many files using OpenDesignFileForProgram, but the resulting change cannot be saved.

    Dear Gerald,

    I am in the same boat at the moment. I realized my codes were working but couldn't find the save settings options for files opened with "OpenDesignFileForProgram". Thank you so much for sharing your experience. I hope we will find the MDL options if there is any. 

    Sincerely,

    Rabi