For years, Microsoft has provided developers with the tools needed to produce software applications. Beginning in 2005, Microsoft began to offer a free version of the Visual Studio software to enable anyone with a computer to write their own software applications.
The promis.e V8i software allows the development of custom plug-ins using the Microsoft .NET Framework. Whether you are an experienced software developer with access to the professional versions of Visual Studio, or you are just getting started with the Express Edition, this guide will help you develop your first promis.e V8i Plug-in.
Any version of Visual Studio 2005 or 2008 and any .NET language can be used to develop plug-ins for promis.e. This guide covers using Visual Basic 2008 Express Edition, as it will be the easiest product to obtain and use for most Promis.e users. However, a more advanced version of Visual Studio may be used, just as the C# language may be used.
The following URL is the starting point for downloading the Express Edition products from Microsoft. Download and install the Visual Basic 2008 Express Edition, unless you have a desire to use an alternate product. A download link may need to be searched for, but Visual Basic 2008 Express Edition could be downloaded from the following link when this article was last updated.
Upon completion of the install, start Visual Basic. Your screen will look something like this:
Create your first plug-in by following these steps:
When there are errors in a program, it is often helpful to run the program line-by-line in order to find where a problem is occurring. It is possible to set up Visual Studio to launch MicroStation or AutoCAD (or simply promise.exe if using promis.e V8i Standalone SELECTseries 5 or higher) and start promis.e. You can then have breakpoints set in your code in order to watch and debug the execution of your program.
The first step is to enable advanced build configurations. Go to Tools > Options… Under Project and Solutions>General, check Show advanced build configurations if it is not already checked. Click OK.
Go to Build > Configuration Manager... Select Debug as the Active solution configuration. Click Close.
Right-click MyPlugin in the Solution Explorer and select Properties. Select the Debug tab. The following items need to be set:
Command line arguments:
"C:\Program Files\Bentley\promis-e\EctEcad.dgn" "-wsms_dgnapps=C:\Program Files\Bentley\promis-e\EctEcad.ma" "-r" -wc"C:\Program Files\Bentley\promis-e\support\promisev8i.cfg"
At this point, the project has been set up to build under the Debug configuration, which will include additional data in the build that Visual Studio will use to enable line-by-line debugging of the plug-in. The Start Options that were just set will direct MicroStation to load the promis.e environment. The only thing that hasn’t been done yet is to tell Visual Basic to launch MicroStation. The method of doing this depends on whether you are using Visual Studio Express Edition or Professional Edition.
If you are using Visual Basic Express Edition, there is no option in the Debug settings to launch an external application. This feature was intentionally left out of the Express Edition user interface. Fortunately, there is a workaround to this by editing a project file.
Save the project. Use Windows Explorer to go to the project folder. (If you are not sure where the project folder is, select MyPlugin in the Solution Explorer. The project folder will be listed in the Properties window.) Look for the file “MyPlugin.vbproj.user”.
Open this file in Notepad. If the file is not present, make sure you have followed the other steps in this section and have saved the project.
Two new elements need to be added to the XML, StartAction and StartProgram. The content of the MyPlugin.vbproj.user file should end up looking similar to the following. The StartAction and StartProgram elements that must be added are shown in blue.
Note: The actual path to use for ustation.exe (MicroStation) or draft.exe (PowerDraft) depends on where the software is installed.
Close and reopen the project in Visual Basic in order for the updated file settings to be loaded. Open Class1.vb and set a breakpoint at the line “MsgBox("This my plug-in!")”. Go to Debug > Start Debugging. The project will build and MicroStation will start and load promis.e. From the Plug-ins menu, select My Plugin, as you did earlier. This time, execution will pause at the breakpoint.
Note: If you get any errors related to LoaderLock you can ignore them and click continue to proceed. If you wish you can turn of LoaderLock by deselecting it in Debug > Exceptions > Managed Debugging Assistants.
If you are using Visual Studio Professional, setting up the debugging environment is a somewhat easier than in the Express Edition. In addition to the Start Options set earlier in the Debug page, you should also select Start external program and enter the path to the main MicroStation executable.
To debug promis.e V8i Standalone (SELECTseries 5 or higher), follow the instructions above, but use the settings in this section instead.In the Debug tab of the Properties dialog make these settings:Command Line Arguments: "C:\ProgramData\Bentley\promis-e V8i(M)\Config\Ecad.dgn"Working Directory: C:\Program Files (x86)\Bentley\promise V8i\promise\To execute an External program enter this: C:\Program Files (x86)\Bentley\promise V8i\promise\promise.exe
To debug promis.e using AutoCAD, follow the instructions above, but use the settings in this section instead.
In the Debug tab of the Properties dialog make these settings:
Command Line Arguments: "C:\Program Files\Bentley\promis-e\ECAD.dwg" /b "C:\Program Files\Bentley\promis-e\autocad2007\autoload2009.scr"
Working Directory: C:\Program Files\Bentley\promis-e\autocad2007\
To execute an External program enter this: C:\Program Files\AutoCAD 2009\acad.exe
Note: The actual external program path to use depends on the location of acad.exe. If AutoCAD 2006 is used, use the autocad2006 subfolder and the script file in that folder. If AutoCAD 2007 – 2009 is used, use the autocad2007 subfolder and the appropriate script file in that folder.
ctw, the paths below should be what you are looking for. I'll update the article with them.
C:\Program Files (x86)\Bentley\promise V8i\promise\promise.exe
C:\Program Files (x86)\Bentley\promise V8i\promise
I am using promis.e 08.11.12.101, what is the command line argument, working directory & start external program to be key in. I am using visual studio community 2013
For Windows 7 64-bit, Microstation version, here are the command line arguments:
"C:\ProgramData\Bentley\promis-e V8i(M)\Config\EctEcad.dgn" "-wsms_dgnapps=C:\Program Files (x86)\Bentley\promis-e\EctEcad.ma" "-r" -wc"C:\Program Files (x86)\Bentley\promis-e\Support\promisev8i.cfg"
I'm trying to debug an API using Autocad 2010 and Windows 7. Everything works fine with the plugin but it doesn't hit the breakpoint.
I'm compiling the program in the program data folder:
And then I copy the files to the Program Files folder:
C:\Program Files\Bentley\promise V8i\promise\plugins\MyAPI
Anyone has an idea of what I'm doing wrong?
For example, here's what I had to use for SS6 acad 2011 on Win 7 64-bit for command line arguments and working directory
"C:\ProgramData\Bentley\promis-e V8i(A)\Config\ECAD.dwg" /b "C:\Program Files\Bentley\promise V8i\promise\AutoCAD2010x64\AutoLoad2011x64.scr"
C:\Program Files\Bentley\promise V8i\promise
which paths do you need?
Could we get an update that shows the correct paths for Windows 7, Promis-e V8i SELECT series 7, etc.?
To find the Plug-Ins menu on the AutoCAD platform, type in MENUBAR 1 at the command line. After running your plug-in, observe the command line to find the command you can use as an alternative means of running your plug-in. It would be something like:
You can use this information to create a custom button. Consult your AutoCAD documentation to find out how to do this.
After following this I was unable to test it due to not having a Plug-in menu? It shows up in the plug-in manager but I have no way to launch the plug-in. Anyone have any Ideas? (running ss5 over autocad)
Is there a sample using C++? I am not very familiar with basic, but I can't get my own C++ project to recognize the IPluginBase class as a class that can be inherrited. I had to install vs 2008 express in order to get VS 2010 to target .net 3.0.
Thanks is advance
When making an addin for Substation SS2, make sure to target .net framework 3.0. I am using VS 2010, and the default was .net 4.0. Theoretically this can be changed after you create the project, but I wasn't able to. If I chose to target 3.0 during project creation, I had no problem getting this sample to compile and run.