How to start a MDL program using c++ in Microstation?

Hi,

I am new to MDL programming.

Can anyone tell complete procedure to create an MDL C++ application?

  • kalaiarasi said:
    Can anyone tell complete procedure to create an MDL C++ application?

    • Download & install the MicroStation SDK
    • About 40 example MDL projects are installed

    Installation creates a \MicroStation\mdl folder that contains tools, include files and library files.

    From MicroStation V8i the MDL examples are each implemented in a C++  (.cpp) file.  The examples can be built using the supplied make file (*.mke), using Bentley's make tool bmake.exe.  They build a Windows DLL and an MDL application resource (*.ma).

    The SDK also delivers a development shell mstndevvars.bat that sets up the right Windows environment.

     
    Regards, Jon Summers
    LA Solutions

  • Hi,

    Thank you for your reply. I have installed the Microstation SDK.

    But I dont know how to buid the solution. Can you please tell me the procedure to build the example?

  • kalaiarasi said:
    I dont know how to buid the solution
    1. Open a Windows command prompt
    2. Run mstndevvars.batto set up the environment
      1. You'll find mstndevvars.bat in \MicroStation\mdl\bin
    3. Build using bmake.exe
      1. The environment set up should enable Windows to find the Bentley tools in \MicroStation\mdl\bin
    4. The argument to bmake.exe is the name of your make (.mke) file
    5. If building one of the delivered examples: bmake basic

     
    Regards, Jon Summers
    LA Solutions

  • Examples are installed into my documents folder by default.

    Start MicroStation Developer Shell under Programs > Bentley > MicroStation v8i (Select Series 2)

    With cd (change directory) command go to an example's folder. You may copy and paste long path after cd command.

    Run below command;

    bmake -a basic.mke

    This will compile example called basic. "-a" options builds all components of the project again. If you don't use this switch compiler will only build changed files according to mke file.

    Launch MicroStation.

    From Utilities > MDL Applications menu, select application and load it. Then you will see what the example is doing.

    Regards,

    Ahmet Sedat ALIS

    Kind regards,

    Sedat Alis
    AEC Technology Inc.

  • Hi..

    Thank you for the reply..

    What are all the environment variables i need to set?

  • I described you to compile examples with bmake.

    If you are using Visual Studio then there is more information on below page;

    www.la-solutions.co.uk/.../MdlDll.htm

    If you installed MicroStation SDK after Visual Studio, all environment variables are set automatically. But you still need to configure Visual Studio as described on above page.

    Kind regards,

    Sedat Alis
    AEC Technology Inc.

  • kalaiarasi said:
    What are all the environment variables i need to set?

    You should not need to set any environment variable.  When you execute mstndevvars.bat it sets environment variables for you in the current command window. 

    Type Windows command set before and after running that batch file to see the new environment variables.

     
    Regards, Jon Summers
    LA Solutions

  • PMFJI, but after you install the MicroStation SDK, you can go to the Windows Start menu to initiate the MicroStation Developer Shell

    That will run mstndevvars.bat, which is created during the SDK installation and takes into account your specific environment (e.g. version of MicroStation installed for locations of various files, where MicroStation and the SDK were installed, etc.)

    From there, you can change folder to where the source code and .MKE file are that you want to compile and proceed from there.

      

  • Hi..

    When I am tried to execute mstndevvars.bat I got the below error.

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>mstndevvars.bat

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>REM To not see this informat

    ion echo to the screen

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>REM set ECHO as an environme

    nt variable in your system configuration.

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>REM For more information see

    the MicroStation SDK README.

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>REM ** SET MS **

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>set msdrive=

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>set mssource=

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>SET MS=

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>for %I in ("") do set MS=%~s

    I

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>set MS=

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>IF "." == "." goto USAGE_Err

    or

    #-----------------------------------------------------------------------

    # ERROR: Bad parameter

    # Usage = MSTNDEVVARS.BAT [MicroStation dir] [MicroStation SDK dir]

    # e.g. C:\Windows\system32\cmd.exe /x /k "C:\Program Files\Bentley\MicroStation\

    mdl\bin\mstndevvars.bat C:\Program Files\Bentley\MicroStation\ C:\Program Files\

    Bentley\MicroStationSDK\"

    #-----------------------------------------------------------------------

  • Hi..

    I tried to initiate the MicroStation Developer Shell as you said.

    But am getting the same error as shown in below

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>REM To not see this informat

    ion echo to the screen

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>REM set ECHO as an environme

    nt variable in your system configuration.

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>REM For more information see

    the MicroStation SDK README.

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>REM ** SET MS **

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>set msdrive=

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>set mssource=

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>SET MS=

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>for %I in ("") do set MS=%~s

    I

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>set MS=

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>IF "." == "." goto USAGE_Err

    or

    #-----------------------------------------------------------------------

    # ERROR: Bad parameter

    # Usage = MSTNDEVVARS.BAT [MicroStation dir] [MicroStation SDK dir]

    # e.g. C:\Windows\system32\cmd.exe /x /k "C:\Program Files\Bentley\MicroStation\

    mdl\bin\mstndevvars.bat C:\Program Files\Bentley\MicroStation\ C:\Program Files\

    Bentley\MicroStationSDK\"

    #-----------------------------------------------------------------------

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>GOTO end

    C:\Program Files (x86)\Bentley\MicroStation\mdl\bin>