Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
MicroStation
  • Product Communities
MicroStation
[Archived] AskInga Wiki Preprocessor directives for processing configuration files
    • Sign In

    • -AskInga
      • +3D MicroStation
      • +AccuDraw Secrets
      • +Animation - Rendering
      • +Behind The Scenes
      • +Cells
      • +Colours
      • +Conversion - Translation
      • +Coordinate Input
      • +Design Settings
      • +Dimensions
      • +DWG
      • +EDG
      • +Element Manipulation
      • +Element Properties
      • +Element Selection
      • +Freeware - Shareware
      • +Interface Look And Feel
      • +Internet - E-Links - Links
      • +Keyins
      • +Levels
      • +Line Styles
      • +Models
      • +MSM Archive
      • +Other
      • +Presentations
      • +Printing - Plotting
      • +Programming - Automation
      • +Rasters - Images
      • +References
      • +Tags - Data Fields - Fields
      • +Text - Fonts - Annotation
      • +Views
      • +Windows - Interacting With
      • -Workspaces - Configuration
        • All about saving DWG files
        • Auto-open a file to a specific model
        • Change the MicroStation Manager workspace options
        • Complete list of MicroStation V8's configuration variables
        • Compress your UPF file
        • Configuration variable operators
        • Configuration variable processing
        • Configure your compress options
        • Control the output location of MicroStation Packages
        • Convert MDF files to DGNLIB
        • Create new UPF every time you start MicroStation
        • Creating a configuration file
        • Current working directory
        • Customized Standards Checker Reports
        • Degeek MS DESIGN HISTORY REVISION NUMBER FORMAT
        • Deleting your UPF while retaining most settings
        • Digging into your workspace
        • Disable stuff MicroStation can or can't do
        • Do you really need to restart MicroStation when editing variables?
        • Edit Project variables via workspace configuration
        • Get rid of MicroStation Text Window
        • Have only one UPF regardless of the workspace you are using
        • How to figure out what the command line switches are
        • How to set WORKDIR DGNDIR after starting MicroStation
        • Learning about workspaces
        • List the configuration variables
        • Lock down your variables
        • Managing MicroStation backup directories
        • MicroStation J and V8 workspaces on the same computer
        • MicroStation J enhanced workspace functionality
        • MicroStation J Workspaces
        • Monitor your UPF file
        • Move your custom interface from one machine to another
        • MS_RFDIR limitations
        • Open V7 files without reconfiguring V8
        • Open Windows Explorer to location of workspace files
        • Preprocessor directives for processing configuration files
        • Quickly restore the defaults with a command line switch
        • Referencing other configuration variables
        • Regarding the last line in a configuration file
        • Report your variables with Expand Echo keyin
        • Return to the MicroStation Manager
        • Run Debug from a modified icon
        • Run debug from the command prompt DOS window
        • Set temporary variables with the Expand Set keyin
        • Set up a seed file for your UPF file
        • Setting the MS_OPENV7 variable
        • Sharing your workspace
        • Shawn Foster's BE 2005 presentations
        • Show all configuration variables not just some
        • Show full path of active file in title bar
        • Specify sub-folders when making a new project
        • Specify the folder for msdebug.txt
        • Temporary files
        • The types of configuration variables
        • The User Preference File [UPF]
        • Total length of file paths
        • Transcending the workspace and time continuum
        • Understanding configuration variables
        • Understanding MicroStation BASIC configuration variables
        • Use a library legend to help manage your library definitions
        • User interface hierarchy
        • Viewing and determining the configuration variables
        • What happens when you launch MicroStation?
        • What is a workspace?
        • Working with V7 files in V8
        • Workspace root
        • You're the CAD Manager, now what?
    • graffiti

     
     Questions about this article, topic, or product? Click here. 

    Preprocessor directives for processing configuration files

    AskInga logo

    Original Article Date: March 26, 2004

    When MicroStation is launched it processes a variety of configuration files which contain very specific instructions. These instructions contain bits of code referred to as preprocessor directives which control the way in which MicroStation processes these files. This article will give you a bit of a tour to help you understand what's going on behind the scenes.

    Preprocessor directives begin with a % and you can find may excellent examples in the msconfig.cfg file.

    NOTE: Opening and looking at this most important configuration files is one thing...editing it is something quite different and could very easily cause MicroStation to not load at all. Use extreme caution when handling this file.

    %include [filename or variable]
    The %include processor tells MicroStation to process the file or variable specified.
    For example,in mslocal.cfg you'll find a line instructing MicroStation to go and process msconfig.cfg as shown below.

    %if expression
    This statement will execute additional lines of code until it reaches an %endif, only when the expression is true.
    The available expressions are:

      defined (file or variable) True if the variable is defined
      exists (file or variable) True if the variable exists.
      || Logical OR
      && Logical AND
      ! Negate
      ( ) Grouping



    For example:
    %if defined (file or variable)
    If the variable is true, then continue executing additional lines of code.

    For example:
    %if exists (file or variable)
    If the file or variable exists, then continue processing.

    %else
    This directive indicates that MicroStation should continue executing code when the last %if is false.

    %elif expression
    In this case, MicroStation should execute the following lines of code if the previous %if was false and the expression is true.

    %endif
    This is the end of a conditional block. All sections of code that begin with %if will end with an %endif:

    %error string
    This fun command will print the message as specified in the string and then exit MicroStation.

    %undef variable name
    This directive will undefine and delete the configuration variable specified by variable name. To keep the variable defined with a translation of NULL, use variable name = [space]

    %level value
    This specifies the level of processing and many examples of this can be found in msconfig.cfg

    %lock variable name
    This very powerful directive will lock down the named configuration variable with its current value. For example, the following snippet is from the delivered civil.pcf file and clearly illustrates MS_DESIGNSEED getting defined and then getting locked.

    AskInga Article #198

    • Askinga
    • Article
    • WorkSpacesConfiguration
    • Share
    • History
    • More
    • Cancel
    • Danielle Schutz Created by Bentley Colleague Danielle Schutz
    • When: Thu, May 22 2008 11:06 AM
    • Inga Morozoff Last revision by Bentley Colleague Inga Morozoff
    • When: Tue, Jun 8 2010 2:46 PM
    • Revisions: 4
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies