I want to get a DGN file's brand (i.e. Its workspace and workset). I've made some progress...
if (DgnWorkSetInfo.ExistsOnDgnFile(dgnFile)) { using (DgnWorkSetInfo info = DgnWorkSetInfo.ExtractFromDgnFile(dgnFile)) { string s = $"Workset name '{info.Name}'"; } }
I'd also like to get the workspace name. Unfortunately, while the MicroStationAPI has IDgnWorkSetInfoPtr->GetWorkSpaceName(), the .NET equivalent doesn't seem to exist. Have I missed something?
IDgnWorkSetInfoPtr->GetWorkSpaceName()
SDK example ../Miscellaneous/CheckWorkSetPaths shows how to do this using C++.
../Miscellaneous/CheckWorkSetPaths
This code should work:
DgnWorkSet dgnWorkSet = WorkSpaceManager.ActiveWorkSet; string workSetName = dgnWorkSet.Name; string workspaceName = dgnWorkSet.WorkSpaceName;
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thanks! How did you find WorkSpaceManager? It's not documented and it's not used in the SDK examples.
WorkSpaceManager
However, it doesn't answer the more general question: how to get a particular DGN file's workspace branding (when that file is not the active DGN file). That is, if I open a DGN file as a working file, how do I extract the branding info using .NET?
Regards, Jon Summers LA Solutions
As usually, using a process I described several times already: using NET Reflectory. But any free tool like DnSpy would be probably enough too.
The discussed case was simpler than it often is, because native code equivalent is known. So it's about:
Regards,