I'm wanting to obtain area measurements just like the flood MeasureArea command in Microstation. However, I want the user to obtain these measurements through my addin rather than that tool. I want to use the exact same function that MeasureArea --> Flood uses in microstation but I'll be modifying the data obtained for my user and that's why I need the addin.
I've not yet found a C# method for addins for obtaining a measureArea --> flood measurement once the user has clicked a coordinate in the DGN file. Does a method exist?
Search for flood in VBA help.
Regards, Jon Summers LA Solutions
Are all these VBA methods available to C# addins? I don't see GetFloodBoundary anywhere for C# in Visual Studio intellisense. I'm new to Microstation development. How much functionality can the C# addin objects perform? Is it necessary for advanced functionality to use the MicrostationAPI and C++?
Unknown said:Are all these VBA methods available to C# addins?
When developing using a .NET language, you need to reference MicroStation's VBA COM server via a .NET InterOp.
There's a huge range of functions in VBA, documented in VBA help .
Unknown said:Is it necessary for advanced functionality to use the MicrostationAPI and C++?
That depends on what you mean by 'advanced functionality'.
Yes, .NET assembly includes all COM functions and types. Even more, it also supports some functions not available in VBA.
C# also supports all MDL functions and can simulate all MDL structures.
In my application, I've referenced:
Bentley.General.1.0
bentley.interop.microstationdgn
bentley.microstation
bentley.microstation.interfaces.1.0
bentley.windowing
ustation
You all have been a big help on these forums and I appreciate the time taken. I've done C# development for years but this is the first time I've developed for Microstation and the hard part is trying to find what you need.
Can anyone point me to the function in C# for GetFloodBoundary? In the answers above, you mention I need to reference MicroStation's VBA COM. Is one of the references above including that?
Unknown said:Is one of the references above including that?
Yes, it is bentley.interop.microstationdgn
Unknown said:Can anyone point me to the function in C# for GetFloodBoundary?
Probably now I understand what confuses you.
MVBA hides usage of Application class and usage of MicroStationDGN namespace, so you can use its functions directly. In .NET there is no any default object, so you must explicitly use a MicroStationDGN.Application interface instace.
To obtain an instance of MicroStationDGN.Application interface you need assembly bentley.microstation. There is a class Bentley.MicroStation.InteropServices.Utilities, which has a property ComApp.
Use it as follows:
using BIM = Bentley.Interop.MicroStationDGN;...BIM.Application ustn = Bentley.MicroStation.InteropServices.Utilities.ComApp;BIM.Element floodBoundary = ustn.GetFloodBoundary(...);
HTH
Answer Verified By: zCane75
Thanks. I was able to find it after following the code above!
DanPaul, give an example of how to use this function.At me it always returns null.
using BCOM = Bentley.Interop.MicroStationDGN; using BMI = Bentley.MstnPlatformNET.InteropServices; ....... BCOM.Application app = BMI.Utilities.ComApp; DgnModelRef modelRef = Session.Instance.GetActiveDgnModelRef(); double denominator = modelRef.GetModelInfo().UorPerMaster; BCOM.Element[] elms = app.ActiveDesignFile.Fence.GetContents().BuildArrayFromContents(); BCOM.Point3d seedPoint = new BCOM.Point3d(); seedPoint.X = ev.Point.X / denominator; seedPoint.Y = ev.Point.Y / denominator; seedPoint.Z = ev.Point.Z / denominator; BCOM.Element result = app.GetFloodBoundary(elms, null, seedPoint, 1, true, 100, BCOM.MsdFillMode.Outlined);
What does not work?
Hi Andrew,
you replied to 5 years old discussion ... and even more related to the different version of MicroStation!
Please create the new and follow this forum Best practices including versions (MicroStation, Visual Studio / NET platform) specifications.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Andrew Kadyshev said:DanPaul, give an example
As Jan wrote, this post is five years old. Sadly, Dan Paul is no longer active on this Forum. He was an excellent contributor.
Tell us which version (e.g. 10.x.y.z) of MicroStation you are using.
Hi Jon!
I use v10.01.00.15.
Andrew Kadyshev said:I use v10.01.00.15.
This is quite old version, I guess Interop API documentation was not even published as a part of SDK.
Is there any reason why the latest MicroStation Update 7 is not used? All APIs are cleaned and enhanced in every version, so sometimes the upgrade solves the problems.
With regards,