This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Configuration Question - using a CFG in a project folder?

Our workspace uses the Project menu to specify Client and task. Task being Survey or Design, Client being well, client - DOT, federal agency, county or municipality, etc.

This is done by adding some hidden variables that are used at the site level but assigned in the Project.pcf. Doing this gets the client variables in front of any user variables to modify the normal priority of user and project variables. Our folder structure is segregated by year and then a main project folder.

To assign reference file search folders, we use an MVBA to create a variable pointing to the project's root folder and use that variable for any variable that needs know the project folder locations. It is necessary to do this because the _DGNDIR variable is not assigned until one is actually in a file. This works so well that I was even able to place a parallel workspace for SE on our network for the occasional times that we need to work on an old project. This required an MBE macro to replace the MVBA macro - which  was able to do by running an MDL function within the MBA macro to read a CFG file, created a few lines earlier, to assign some new variables. The same macro then deletes the temporary CFG file as it is not needed any more and I do not want to leave the server or the user's PC cluttered with temporary files.

However, on some projects, I need to modify the standard search folders for various reasons. Rather than add unique PCF files for those projects, I am considering the practice of placing a CFG folder in a project and placing any special variable assignments in a CFG file in that folder. Then I would add code to my MVBA to look for this file in this folder and if found read its contents.

I was hoping to find that someone else is doing something similar to see it they have any pointers on what worked and what did not work. TIA 

Parents
  • Bump!

    Posted this in 2009. Have managed to live without this so far, but some new issues are causing me to think that this is a workflow whose time has come.

    If anyone has any thoughts., please post.

    FYI

    The following code is what we used in V7 to emulate what we did in V8. I found that while there were MDL  functions that I could call to define a CFG variable, I could not figure out how to pass the value of a variable. So for fixed values, I could use this:

       status = MbeCExpressionLong("mdlSystem_defineCfgVar(""_AB_Survey"", ""Survey\\"", 4)")

    But to get values that were derived at run time, I found I could build a temporary CFG file, and then use this code to read the file and one read, erase the file.

       'These variables need to vary which required a different solution. We found we could

       'create a scratch CFG file and read it to assign any remaining variables.

       Open "AB_TEMP.CFG" For Append Access Write Lock Read Write As #1

       Print #1, "_AB_Proj_Name = " & us_AB_Proj_Name

       Print #1, "_AB_Proj_Year = " & us_AB_Proj_Year

       Close

       ' MbeSendKeyin "DR=AB_TEMP.CFG" ' Uncomment if debugging is required. Allows one to View

           ' the CFG file if necessary.

       ' Use this mdl function to process the newly created scratch CFG file.

       status = MbeCExpressionLong("mdlSystem_processCfgVarFile(""AB_TEMP.CFG"",4)")

       ' Delete the scratch CFG file as it has served its purpose

       Kill "AB_TEMP.CFG"

    So I wondered, is there a VBA functions that can read a CFG file or do I need to also use the MDL function?


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
  • Does it have to read the cfg or can the variables already be set. Variables and their values are easy to call up in VGA.



  • Wow, how did I miss this responce for so long.
    The idea behind this is that we could place a very project specific cfg file in a project's folder and place in it variables needed for only that project.
    We only create PCF files to load client workspaces and if we need more specific variables, use VBA to do this. But some projects need special folder paths for references that others do not, so making a vba that searches for a standard named cfg file in a standard location within any project would allow a project by project sustomization without adding dozens of PCF files.

    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
Reply
  • Wow, how did I miss this responce for so long.
    The idea behind this is that we could place a very project specific cfg file in a project's folder and place in it variables needed for only that project.
    We only create PCF files to load client workspaces and if we need more specific variables, use VBA to do this. But some projects need special folder paths for references that others do not, so making a vba that searches for a standard named cfg file in a standard location within any project would allow a project by project sustomization without adding dozens of PCF files.

    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
Children