Appologies for asking such a simple question:
given that I have a pointer to a MSElement as below, how could I get a pointer to a MSElementDescr? Since MSElementDescr is dynamically created, I'm assuming that there is some mdl funciton that takes in a MSElement paramter and provided a pointer to the element descriptor after creating the descriptor. But I have not been able to find such a mdl function, does one exist?
MSElement *elP;
Hi Brenden,
Brenden OReilly said:given that I have a pointer to a MSElement as below
Can you share more information? Where MSElement comes from? Is it "in memory" object or it was read from DGN file?
Brenden OReilly said:how could I get a pointer to a MSElementDescr?
When you need to work with element descriptor, create it ;-)
I recommend to read SDK documentation (specifically Element Descriptors chapter in MicroStation Programmer Guide), where internal structure of the descriptors is explained in detail.
Brenden OReilly said:I'm assuming that there is some mdl funciton that takes in a MSElement paramter and provided a pointer to the element descriptor after creating the descriptor.
Yes, but what from available functions is the best, depends on context.
Brenden OReilly said:But I have not been able to find such a mdl function, does one exist?
What about e.g. mdlElmdscr_new()?
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Brenden OReilly
Thanks. I think mdlElmdscr_new() is the function that I am looking for. I know that I will have to free the memory allocated for the descriptor too.
Brenden OReilly said:I know that I will have to free the memory allocated for the descriptor too.
Yes :-)
My experience is that in every old C code, I am analyzing (and from time to time porting to V8i or CE), I found memory leaks caused by not freed MSElementDscr pointer.
And it is where C++ can help a lot, because even with old C style code, properly implemented classes can takes care (in their destructors) of potentially not released memory. And not talking about smart pointers, used widely in CE API.