i must be missing it in the SDK. but i cant find how to remove a GCS (Geographic coordinate system) from a model.
i see Bentely.GeoCoordinateNET.DgnGCS ToModel() to set a GCS, but im missing for to just remove one.
i only see the COM DeleteGCS call.
im looping dgn files and loading them in the background and then looping the models. if i already have the file loaded and got the model from the .net side. is there a way to then get the Interop side (COM) to get that model? so if i have Bentley.DgnPlayformNET.DgnModel. is there a way to get my ComApp to find that DgnModel?? so i can then call the deleteGCS method. i dont think i can load the file from the COM side if i already loaded it from the .net side, can I?
not sure how to properly handle that, it would be easy if i was just using the active model but im not.
Will this work passing the DgnModel.GetModelId() as the parameter? (your .net model's id)
Bentley.Interop.MicroStationDGN.ModelReference comModelReference = Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp.MdlGetModelReferenceFromModelRefP(dgnModel.GetModelId());
that does not work.
Maybe someone from bentley can confirm that removing a GCS from a model is missing from the .net side of the SDK???
FWIW the MicroStationAPI provides the DgnGCS class.
DgnGCS
It has methods to assign itself to a DGN model.
Regards, Jon Summers LA Solutions
Jon Summers said:It has methods to assign itself to a DGN model.
Yes, but the question is how to remove GCS, not how to create it and assign to the model.
John Drsek is right: Whereas C++ API offers static DgnGCS methods CreateGCS() and DeleteFromModel(), NET wrappers contains only constructor, but not the delete method.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
John Drsek said:so if i have Bentley.DgnPlayformNET.DgnModel. is there a way to get my ComApp to find that DgnModel?
I am not sure it is possible, because plenty of COM features are available for active model only, not models loaded at background.
John Drsek said:but i cant find how to remove a GCS (Geographic coordinate system) from a model.
Because GCS is stored as model application data (DgnGCS inherits BaseGCS and DgnModelAppData classes in C++), maybe the workaround can be to delete proper application data. There is DgnModel.RemoveApplicationData() method available in NET, but it is not clear what should be used as "key".