Bentley InRoads SDK [FAQ]


NOTE: This article applies to older versions of InRoads prior to the V8.5 versions.  More recent versions (V8.7-V8.11) deliver the SDK and help files with the product in the SDK directory.

Applies To 
 
Product(s):Bentley InRoads SDK
Version(s):V8.5 and prior
Environment: N/A
Area: N/A
Original Author:Bentley Technical Support Group

 

 

 

 

 

 

 

 

What is the Bentley InRoads SDK?

The Bentley InRoads SDK provides interfaces for Visual Basic, Visual C++, and MDL development tools that will allow you to create custom applications in the following areas:

Also included are the SDK help , Visual Basic and Visual C++ examples.

What hardware/software do I need to run the Bentley InRoads SDK?

InRoads SDK is available on request to members of the Bentley Developer Network . You will need a version of Bentley InRoads SDK that is compatible with the version of your Bentley InRoads installation. Below are the hardware and software requirements for InRoads SDK:

Hardware

Software

Note: Be sure to add the location of the InRoads dlls to your PATH environment variable for example: c:\bentley\SelectCAD\bin.

How do I use the Bentley InRoads SDK?

To use InRoads SDK, run the Setup.exe and install to the InRoads(SelectCAD) directory. An SDK subdirectory will be created.

Items that get installed with InRoads SDK include:

How do I compile Visual Basic applications for Bentley InRoads?

It depends on whether you are going to create an In-Process or Out-Of-Process application. Below is the process for both:

In-Process
Compile with Project Type as "ActiveX DLL". Use the installed VBSamples InProcess example as a template. Copy the contents of the InProcess directory to a new directory and rename the project (vbp) file. Either modify the startForm.frm or delete it and create a new startForm.frm. A startForm.frm is required.

Out-Of-Process
Compile with Project Type as "Standard EXE" . scadSDK_initialize() must be called before any other SDK functions. scadSDK_initialize verifies that there is a valid SelectCAD license, and it initializes the SDK functions. See the installed VBSamples OutOfProcess.

How do I run Visual Basic applications for Bentley InRoads?

Again, this depends on whether the application is In-Process or Out-Of-Process. Below are explanations for both:

In-Process
From the InRoads Explorer, go to Tools > Run Macro, then select the Visual Basic DLL file.

Out-Of-Process
Run the Visual Basic EXE file.

How do I debug Visual Basic applications for Bentley InRoads?

Below are the steps for debugging both the In-Process and Out-Of-Process applications:

In-Process (Requires MicroSoft Visual C++)

  1. Set the Project Properties before compiling the Visual Basic DLL.
    • Compile to native code.
    • Create symbolic debug info.
    • No optimization.
  2. Windows Task Manager (MicroStation and InRoads have to be open)
    • Go to process tab, right click ustation.exe, select debug.
    • VC++ opens
  3. VC++
    • Go to File > Open > startform.frm.
    • Now go to Project Settings > Debug tab > additional dlls and select Visual Basic DLL.
    • Set breakpoints in the startform.frm.
  4. InRoads
    • Go to Tools > Run Macro and select Visual Basic DLL. The focus will flip back to VC++ at the breakpoint.
    • Use VC++ debugging commands to step through code.

Out-Of-Process

  1. All you need to do to debug an Out-Of-Process application is, use the Visual Basic debugger commands.

How do I compile Visual C++ applications for Bentley InRoads?

Determine what type of application you have then follow the instructions below.

In-Process (Decide whether to create a modal or non-modal dialog box).

  1. Create a new project in VC++ using the MFC AppWizard (DLL).
    • Extension DLL using shared MFC DLL.
    • Generate source file comments.
  2. In order to have access to the InRoads SDK function signatures, set the Additional include directories under Project > Settings > C/C++ tab > Preprocessor Category to point to: the current location of the InRoads SDK for example; c:\Bentley\Selectcad\sdk.
  3. In order to link, go to the Project Settings dialog and the Link tab and set Object/library modules to: the current location of SCadSDK.lib. For example, C:\Bentley\SelectCAD\sdk\SCadSDK.lib.

    Note: On the Link tab, you must select the following options: Generate debug info and Link incrementally.

  4. Modify the Debug settings in order to debug VC++ application.
    • Remove the Debug configuration in the Build > Configurations dialog.
    • Add a new configuration.
    • After selecting the Add... button, give a new name (for example, Debug) for the Configuration.
    • Copy the settings from the Release Configuration.
    • Click OK and close the Build Configuration dialog.
    • Under Project > Settings > Debug tab, set the Executable for the debug session. For example; c:\bentley\program\microstation\ustation.exe.
    • On the C/C++ tab of the Project Settings dialog, under the General Category, Optimizations must be set to Disable(Debug).
    • Debug info must be set to either Program Database for Edit and Continue, Program Database or C7.
    • The remainder of the options under the General Category are fine if you created the configuration as a copy of the Release mode.
  5. Option to add a new dialog box.
    • Go to VC++ > Insert > Resource > Dialog > Dialog Properties > General and set ID to DLG_SDK_SampleApp then Set Caption to Sample App.
    • Add a class for the dialog by going to View > Class Wizard. From the MFC ClassWizard dialog, select the Add Class.
    • For the Class Information, set Name to something you choose for example; SDK_dlg, Pick the Base class(i.e. CDialog), Pick the Dialog ID(i.e. DLG_SDK_SampleApp).
    • Click Ok to dismiss the New Class dialog box.
    • Click Ok to Create the class and dismiss the MFC ClassWizard.
    • ClassWizard should have created two more files: SDK_dlg.cpp and SDK_dlg.h.
    • Add the following include file to the main project file, sample.cpp: "SDK_dlg.h".
    • Add the following include files to SDK_dlg.cpp: "SCadCogo.h" and "SCadDTM.h".
  6. StartCommand function is required in the primary project cpp file for example, sample.cpp.
    • Add the following function just after your application object is declared probably at the end of the file:

    // Uncomment the following line to create a non-modal dialog box
    //SDKsmpl *pDlg = NULL;
    int StartCommand ( )
    {
    HINSTANCE rscHndl;
    rscHndl = AfxGetResourceHandle ( );
    AfxSetResourceHandle ( GetModuleHandle ( "VCDtmTest.dll"));
    // Modal only remove these lines if you plan on creating a non-modal dialog
    SDKsmpl dlg;
    dlg.DoModal();
    // End of Modal
    // To create Non-Modal, uncomment the following lines
    //pDlg->Create ( IDD_DIALOG1, NULL);
    //if ( pDlg )
    // pDlg->ShowWindow(SW_SHOW);
    // End of Non-Modal code
    AfxSetResourceHandle ( rscHndl );
    return ( 0 ); // This should be 1 if you are running a non-modal application
    }

  7. Add the StartCommand function to the DEF file after EXPORTS:

    EXPORTS

    • ; Explicit exports can go here
    • StartCommand
  8. Now is a good time to Save all the files in the project and Rebuild All.
  9. Add something useful to this shell of an application.
    • At this point, the "do something" part of the application is designed. There are VC++ examples installed with InRoads SDK that will serve as a point of reference for creating a simple dialog and using InRoads SDK functions. See the installed VCSamples.

Out-Of-Process

  1. Create a new project in VC++ using the MFC AppWizard(EXE).
    • Select all Default settings except, choose "Dialog based application" and toggle off "Active X Controls".
  2. Whether compiling in Release or Debug mode:
    • Set the Additional include directories under Project>Settings>C/C++ tab>Preprocessor Category to point to the current location of the InRoads SDK ( i.e. c:\bentley\Selectcad\sdk).
    • In the Project>Settings>Link tab, set Object/library modules to the current location of the SCadSDK.lib (i.e. c:\bentley\SelectCAD\sdk\SCadSDK.lib).
    • Design dialog(optional).
    • Make sure to call scadSDK_initialize before calling any other SDK functions. Also include the necessary SCadXXX.h files for the InRoads SDK functions.

How do I run Visual C++ applications for InRoads?

See the instructions below:

In-Process

Out-Of-Process

How do I debug Visual C++ applications for InRoads?

For debugging Visual C++ applications see below:

In-Process

  1. Follow the steps listed in question 7 for creating the Debug build of the DLL.
  2. In Visual C++ start debugging application by setting a breakpoint first, then Start Debug(F5).
  3. MicroStation will open, load InRoads(i.e. mdl load C:\Bentley\SelectCAD\bin\ CivUstZR.ma).
  4. From the InRoads Explorer, Tools->Run Macro, then select the Visual C++ DLL file(Debug configuration).
  5. The screen will flip back to VC++ at the breakpoint, use the VC++ debugger commands to step through the code.

Out-Of-Process

  1. Compile the VC++ EXE in the Debug configuration. Use VC++ debugging commands to step through code.

See Also

Product TechNotes and FAQs

InRoads Product TechNotes FAQs And Support Video Clips

External Links

Bentley Technical Support KnowledgeBase

Bentley LEARN Server

Comments or Corrections?

Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!