using OpenRail Designer CE - 2021 Release 2 - Version 10.10.21.04 (but I guess the version is not crucial in this case ;-)
My question is similar to Stanislav's question in Developers and Programming forum (where not answered).
When SpeedTable is obtained from Alignment using Alignment.ActiveSpeedTable property, the functionality is limited: As asked in the linked discussion, e.g. for speed schema (DesignSpeed class), it is not possible to receive its name, which makes the data useless, because DesignSpeed class publishes only start and end speed, but no information for what speed schema it is defined.
I found that in parallel to Bentley.CifNET.GeometryModel.SDK.SpeedTable class, another SpeedTable class, with better functionality, exists in Bentley.CifNET.GeometryModel namespace. I assume it is a part of implementation of Speed Table dialog, but it is not "public SDK".
Is there a way to instantiate this "better and more complex" class for selected alignment? Despite of the same name and similar functionality, they are "different animals" ;-) because SpeedTable from SDK is inherited from ModelEntity, whereas internal SpeedTable inherits NamedEntityReferenced and IStationPoints.
Of course, if simpler / alternative answer exists for Stanislav's question how to obtain speed schema name for specific DesignSpeed class (e.g. to access EC data directly), it would be great :-)
Try below code to access 'true' SpeedTable (only to read data). My personals experience is SDK classes return sometimes incorrect data or non at all.
Note: selectedElement is object selected on the view:
Bentley.DgnPlatformNET.Elements.Element selectedElement = hitPath.GetHeadElement();
ConsensusConnectionEdit con = ConsensusConnectionEdit.GetActive();
AlignmentEdit al = (Alignment.CreateFromElement(con, selectedElement)) as AlignmentEdit;
Bentley.CifNET.GeometryModel.LinearEntity2dInPlan align = (Bentley.CifNET.GeometryModel.LinearEntity2dInPlan)al.DomainObject;
Thanks, will try it ;-)
I will see what approach I choose: EC Query code is complex, because analaysis of relationship classes and hoping over more EC instances is required. On the other hand, it's "safe", because accessing EC data is a standard API operation and works until civil EC data model is changed.
Your code is simple, but uses unpublished API (I think anything public has *SDK* in namespace), so is a "subject to change".
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point