Dynamic Work Area Configuration
The DMS_PROJECT variable can be used in the configuration settings block to return the moniker (datasource path) of the ProjectWise work area. A ProjectWise work area must be used; if a regular folder is used, the macro will not return any value and any relative paths that are constructed will only have the additive statements in the paths (such as /CELL or /DATA). This variable is used in conjunction with _DGNDIR in a configuration settings block to get the work area moniker of the DGN that is being opened. Because this discovery happens when the file is launched, relative paths can be used with the assurance that the correct definitions will be applied.
When a DGN is opened, the work area is discovered, assigned as part of the _USTN_PROJECTROOT variable using DMS_PROJECT, and then the relative paths are processed.
To build this configuration:
- Create a configuration settings block. For example: projectroot
- Assign the configuration variable _USTN_PROJECTROOT, and for a value enter $(DMS_PROJECT(_DGNDIR))
- Create a
configuration settings block at a lower priority level (meaning it will get
processed after the
projectroot configuration settings block) to
MS_CELL = $(_USTN_PROJECTROOT)Cell/
MS_DATA = $(_USTN_PROJECTROOT)data/
Because the _USTN_PROJECTROOT variable is dynamically determined before the MS_CELL and MS_DATA configuration variables, they will be populated with the correct work area moniker, and then be appended with the correct folder name, such as cell or data. Therefore, configuration can be created once, and using a standard set of work area names, new work areas can be added without the need for any additional configuration.
For added flexibility, a similar variable exists: DMS_PARENTPROJECT. This operates the same way that DMS_PROJECT does, but instead of returning the work area that contains the DGN, it returns the parent work area (if present) of the work area that contains the DGN. This allows for a sub-work area to exist, with the workspace configuration defined at the top level work area. DMS_PARENTPROJECT will not default to the first work area if the parent does not exist, the variables will be unresolved.
Additionally, DMS_PROJECT and DMS_PARENTPROJECT can be used in conjunction with other macros, such as parentdevdir and build, to provide a variety of pathing options.