- What is the Bentley InRoads SDK?
- What hardware/software do I need to run InRoads SDK?
- How do I use the Bentley InRoads SDK?
- How do I compile Visual Basic applications for Bentley InRoads?
- How do I run Visual Basic applications for Bentley InRoads?
- How do I debug Visual Basic applications for Bentley InRoads?
- How do I compile Visual C++ applications for Bentley InRoads?
- How do I run Visual C++ applications for Bentley InRoads?
- How do I debug Visual C++ applications for Bentley InRoads?
Question 1: What is the Bentley InRoads SDK?
Answer: 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:
- Digital Terrain Model Functions
- Coordinate Geometry Functions
- General Functions
Also included are the SDK help , Visual Basic and Visual C++ examples.
Question 2: What hardware/software do I need to run the Bentley InRoads SDK?
Answer: 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
- Pentium Class processor with sufficient memory to run Windows 98, Windows NT® 4.0, Windows 2000
Software
- Windows 98, Windows NT® 4.0, Windows 2000
- MicroSoft Visual Basic and/or MicroSoft Visual C++
Note: Be sure to add the location of the InRoads dlls to your PATH environment variable for example: c:\bentley\SelectCAD\bin.
Back to Index
Question 3: How do I use the Bentley InRoads SDK?
Answer: 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:
- Header and library files (in the root directory)
- A help directory containing sdk.hlp
- A samples directory containing Visual Basic and Visual C++ example applications
Question 4: How do I compile Visual Basic applications for Bentley InRoads?
Answer: 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.
Back to Index
Question 5: How do I run Visual Basic applications for Bentley InRoads?
Answer: 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.
Question 6: How do I debug Visual Basic applications for Bentley InRoads?
Answer: Below are the steps for debugging both the In-Process and Out-Of-Process applications:
In-Process (Requires MicroSoft Visual C++)
- Set the Project Properties before compiling the Visual Basic DLL.
- Compile to native code.
- Create symbolic debug info.
- No optimization.
- Windows Task Manager (MicroStation and InRoads have to be open)
- Go to process tab, right click ustation.exe, select debug.
- VC++ opens
- 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.
- 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
- All you need to do to debug an Out-Of-Process application is, use the Visual Basic debugger commands.
Back to Index
Question 7: How do I compile Visual C++ applications for Bentley InRoads?
Answer: 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).
- Create a new project in VC++ using the MFC AppWizard (DLL).
- Extension DLL using shared MFC DLL.
- Generate source file comments.
- 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.
- 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.
- 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.
- 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".
- 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
}
- Add the StartCommand function to the DEF file after EXPORTS:
EXPORTS
- ; Explicit exports can go here
- StartCommand
- Now is a good time to Save all the files in the project and Rebuild All.
- 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
- 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".
- 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.
Question 8: How do I run Visual C++ applications for InRoads?
Answer: See the instructions below:
In-Process
- From the InRoads Explorer go to Tools > Run Macro, then select the Visual C++ DLL file(Release configuration).
Out-Of-Process
- Run the Visual C++ EXE file.
Back to Index
Question 9: How do I debug Visual C++ applications for InRoads?
Answer: For debugging Visual C++ applications see below:
In-Process
- Follow the steps listed in question 7 for creating the Debug build of the DLL.
- In Visual C++ start debugging application by setting a breakpoint first, then Start Debug(F5).
- MicroStation will open, load InRoads(i.e. mdl load C:\Bentley\SelectCAD\bin\ CivUstZR.ma).
- From the InRoads Explorer, Tools->Run Macro, then select the Visual C++ DLL file(Debug configuration).
- The screen will flip back to VC++ at the breakpoint, use the VC++ debugger commands to step through the code.
Out-Of-Process
- Compile the VC++ EXE in the Debug configuration. Use VC++ debugging commands to step through code.