Hi,
with the function
Element.GetFromElementRef
I get a
Bentley.DgnPlatformNET.Elements.Element object
then I need to read the XData of the object. Till now i used
element.GetXData1(AppName);
but this functions need a
Bentley.Interop.MicroStationDGN.Element
So my question is, how to come from one the the other? And why there are two differnet Element classes without an esy way to convert.
E.g. a contructor that uses the other class
Greetings
Markus
Hi Markus,
Markus Hannweber said:And why there are two differnet Element classes...
You should be aware that in MicroStation CONNECT Edition, when working with managed API, there are two completely separate sets of API: old one and new one.
Markus Hannweber said:...without an esy way to convert.
Because these APIs use different memory. I remember "how to jump from one to another" was discussed several times in the past and I think there is no answer other than save to element to model, remember its ID and to read it using this ID from the second API.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi, thanks for the very fast answer.
So I undertand it better. but still I din't find a way, to don't come from one object to the other.
Is threre anywhere source code to how it should be done?
Markus Hannweber
Markus Hannweber said:but still I din't find a way, to don't come from one object to the other. Is threre anywhere source code to how it should be done?
I thought I wrote it in my previous post: there is no answer other than save to element to model, remember its ID and to read it using this ID from the second API
These two API are pines and apples, so when you want to use a method from Interop assembly like Element.GetXData(), you have to read an element using method also from Interop assemlby (e.g. ActiveModelReference.GetElementByID).
When you don't work with elements, you can combine both API versions freely. I can imagine e.g. to create primitive command using new API (inherited from DgnPrimitiveTool) but to use other functions from old Interop API.
thanks for info. So I will see how to do it