How can i get transition name from its id?

in hook Edm_Cmd_PostState i have recieved mlObjectID3(integer) with the ID of transition.

how can i resolve this ID to transition Name(string)?

can’t find how do it in API-help…

PS: make query to SQL server table [dbo].[Transitions] is not a good idea))))

I’m curious about why is query to SQL table not a good idea.

Thank you

I’m a so-so programmer, and I’m not sure that I can implement this with proper code security. the password will be sewn into the program.

but I came up with a scheme for how to do this without crutches, using built-in PDM methods.

for example, as described here, we grab all the transitions in the desired state.
https://help.solidworks.com/2019/English/api/epdmapi/Get_Files_State_Transitions_Example_CSharp.htm

each object has an ID property. we read it for each transition.
http://help.solidworks.com/2017/english/api/epdmapi/EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmObject5~ID.html

adding the ID-NAME data to the C# dictionary

and now we can resolve transition name from its ID)))

You’re explanation lead me to this:
GetObject(type, ID)
GetObject Method (IEdmVault5) - 2017 - SOLIDWORKS API Help

Type of object is 4
EdmObjectType Enumeration - 2017 - SOLIDWORKS API Help

cast it to transition then get the name from that?

3 Likes

brilliant! thx! but for now, its the biggest problem - IEdmBatchUnlock Interface
how to override version…

Hi Korbn,

You can use this:
IEdmTransition5 edmTransition =(IEdmTransition5) EdmVault.GetObject(EdmObjectType.EdmObject_Transition, 0);
string name = edmTransition.Name;

1 Like