Hi,
Can you guys tell me where I can access matrix3dzero and all the other matrix functions in dotNET?
Are these functions detailed in vba help still the best way to manipulate matrices?
Thanks
These are members of MicroStationDGN.Application class... ...there is the question, what is the best? Probably it is not the best, but as I can say, now it is the only published way to manipulate those structures in .NET.
Dan
Steve: Are the functions detailed in VBA help still the best way to manipulate matrices?
Are the functions detailed in VBA help still the best way to manipulate matrices?
If by that you mean MicroStation element transforms & matrices then how else would you do it? There are third-party linear algebra libraries available for C#. For example …
However, none of those knows anything about MicroStation. When you write Element.Transform t, that transform has to be something that MicroStation understands.
Regards, Jon Summers LA Solutions
Thanks Dan,
Sorry, intelisense didn't list it but it was there :)
Jon, as you are helping me with the vba program I was just seeing how easy it is to port across to dotNET (because I'm more familiar with the forms in it (& I generally like it heaps more) that will be required for my program) and whether there are new functions or I can just apply functions from the vba help.
Cheers,
steve
Sorry to trouble you with what is probably a dumb question, but how is it implemented?
If I have:
BCOM.Matrix3d rotation = BCOM.Application.Matrix3dZero(); app.CreateTextElement1(null, "hello", ref originPt, ref rotation);
the error is:
An object reference is required for the non-static field, method, or property. 'Bentley.Interop.MicroStationDGN.Application.Matrix3dZero()'
I'm sure this is fundamental C# but I can't find a solution. Matrix3dZero() returns a zero value of type Matrix3D, so how do I assign that to rotation?
Steve: I was just seeing whether there are new functions or I can just apply functions from the VBA help.
I was just seeing whether there are new functions or I can just apply functions from the VBA help.
.NET knows nothing about MicroStation or its API. When working with MicroStation VBA objects, you must use the MicroStation VBA COM server via the InterOp.
You must have an instance of Application object since Matrix3dZero() is a non-static method... So you can't invoke it that way...
BCOM.Matrix3d rotation = app.Matrix3dZero(); // app == instance of Application class
but if you need just zero matrix, it's faster to use just its constructor.
BCOM.Matrix3d rotation = new BCOM.Matrix3d();
Thanks very much Dan.
Steve: Matrix3dZero() returns a zero value of type Matrix3D …
Matrix3dZero() returns a zero value of type Matrix3D …
Matrix3d is a User-Defined Type (UDT); in other words, pure data. Matrix3dZero() returns a Matrix3d with all elements zero, which is of little practical use.
For a zero rotation, you need to pass an identity matrix, provided by method Matrix3dIdentity.
Hi Jon,
Thanks, I didn't realise that.
Steve