Hi
I've developed a Add-in for Microstation v8i with vb.net and I'm trying to figure out how to register key-ins so I can create a toolbar Icon to run my code from.
I've found some code in the programming wiki but can't seem to get it to work. Does anyone have any sample code for this.
Thanks
Dave
Hi Dave,
check this discussion, I posted there example C# and VB.NET addin projects. They provide information how to wrote "minimalistic addin with own key-ins".
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Unknown said:I'm not sure how to "attach" it to microstation.
There is nothing like "attach" in MicroStation. NET addins are loaded into MicroStation the same way as MDL and native C/C++ applications using key-in mdl load <application name> (to be correct, in the case of NET adddins it's mdl load <NET addin assembly name> ;-) If using my example project, the key-in will be mdl load vbnetaddin, because vbnetaddin.dll is produced by NET compiler.
The condition is that the addins have to be placed in a folder defined in MS_ADDINPATH configuration variable. By default this configuration points to MicroStation\mdlapps\ folder, so at the first step you can copy your addin to this folder and try to load it, but in a normal situation it's very bad idea to place your addins to mdlapps folder. Better approach is to create own application folder somehwere else (but has to be local folder, not network!), let's say C:\MyMstnAddins\, and to add the path to MS_ADDINPATH variable.
Unknown said:Until now I've been running a plugin via ECT.ECAD.API.PlugIn
I don't know promis-e, but MicroStation doesn't require such approach. If there is NET 3.5 assembly with correct addin structure (class is derived from Addin class, proper methods are implemented...), MicroStation takes care about loading process automatically (at a background, application loader is created and started).
Unknown said:just creates a Plugin menu and I run my code from there.
Use MicroStation customization tool to create own tool (placed in a toolbox). The tool key-in definition is [MdlTaskId]key-in, in the case of the example project it's [vbnetaddin]vbnetaddin command1. Task id is defined using main class attribute MdlTaskId:="<task id>" and often is the same as assembly name. If the application is not loaded yet (so its key-in is not available), it's loaded automatically and the key-in is used.
Unknown said:not sure where to start
Compile the example, place it to mdlapps folder and try to load it. If it works (it has to ;-), try to modify MS_ADDINPATH so you will be able to use different folder. The rest is a standard coding process ;-)
Jan,
So much for plans...I'm just getting back to this after three years. Is there a good example somewhere of how to write similar plug-ins for the Connect version of Microstation?
Daverode said:Is there a good example somewhere of how to write similar plug-ins for the Connect version of Microstation?
Things have changed. With MicroStation V8i, you were mostly calling into the VBA API from your VB.NET AddIn. MicroStation CONNECT has new .NET APIs DgnPlatformNet and MstnPlatformNet. However, those are not delivered with MicroStation, instead you must download the MicroStation CONNECT SDK.
The SDK delivers C# examples using those new APIs. I don't see any VB.NET examples.
Regards, Jon Summers LA Solutions
Daverode said:Is there a good example somewhere
as Jon wrote ... no :-(
It's important to realize that the main language for NET development is C# and VB.NET is (from more reason, some them are real and serious, some not) a seconday langauge, so often, not specifically when talking about MicroStation, examples are delivered in C# only.
But it depends on development skill: It's possible to check C# code, even if one is not able to write own C# code, and to follow the same structure and concept in VB.NET.
Alternatively it's also possible to compile C# examples (or to use some dll delivered with MicroStation) and to use decompiling tools like JustDecompile or .NET Reflector and to decompile back to VB.NET. It does not provide all information, especially how the original project was configured, but these details can be discussed as separate questions here.
Thanks for the reply. I could most likely figure out what to do based on C# code. I just need an idea of where to start. It's been a few years since I wrote the other programs we use, I'm just trying to get my head back into it. I was looking for the SDK in the download section and can't find it. Any idea how to go about getting that?
Thanks again,
Jon,
Thanks for the reply. Do you know where to download the SDK from? I can't seem to find it in the software download section.
Daverode said:Any idea how to go about getting the SDK?
I think that you, or your organisation, must be a member of the Bentley Developer Network (BDN). If you are a SELECT subscriber then I think that they will let you in. It's all a bit mysterious, what with having to know the secret handshake.
Try contacting bdn at bentley.com.
bdn
bentley.com