cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing the assigned type of an object via the API

Valued Contributor
Valued Contributor

Is it possible to access the assigned type of an object in the object tree via the API?

 

For example: 'Fixture', 'Clamp', 'Gripper', 'Gun', etc. rather than the underlying class such as TxDevice or TxComponent.

 

I'm using PS V12.1 and V13.1.2.

 

Thanks.

6 REPLIES

Betreff: Accessing the assigned type of an object via the API

Valued Contributor
Valued Contributor

Betreff: Accessing the assigned type of an object via the API

Valued Contributor
Valued Contributor

Thanks for pointing me in that direction, but I'm afraid that solution doesn't work.

 

Casting ITxObject to ITxPlanningObject fails -- at least on my system. I managed to retrieve that field, however, using this method:

 

TxObjectList objectList = TxApplication.ActiveSelection.GetItems();
foreach (ITxObject obj in objectList)
{
    ITxProcessModelObject processModelObject = obj as ITxProcessModelObject;
    ITxPlanningObject planningObject = processModelObject.PlanningRepresentation.GetField("prototype") as ITxPlanningObject;
    string planningType = planningObject.PlanningType;
    MessageBox.Show(obj.Name + " " + planningType);
}

Incidentally, how would we know to do this? Is any of this properly documented anywhere?

 

Thanks again.

Betreff: Accessing the assigned type of an object via the API

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi LTW,

 

Are you familiar with the Tecnomatix.NET.chm, this is the SDK Manual.

You can find it under your Tecnomatix installation folder (eMPower\TecnomatixSDKHelp).

When you open it, go to About Tecnomatix.NET Classes and Interfaces -> Planning Object Classes and Interfaces 

Check the Mapping and Connectivity Between Representations.

You can check also the Knowledge Base section , there are some videos and presentations.

 

Best Regards,

DianaG

 

Betreff: Accessing the assigned type of an object via the API

Valued Contributor
Valued Contributor

Hi, LTW!

 

What you need is just to check if the processModelObject  is not null. 

TxObjectList objectList = TxApplication.ActiveSelection.GetItems();
foreach (ITxObject obj in objectList)
{
    ITxProcessModelObject processModelObject = obj as ITxProcessModelObject;
    if ( processModelObject  == null) continue;
    ITxPlanningObject planningObject = processModelObject.PlanningRepresentation.GetField("prototype") as ITxPlanningObject;
    string planningType = planningObject.PlanningType;
    MessageBox.Show(obj.Name + " " + planningType);
}

A-S-E

 

Betreff: Accessing the assigned type of an object via the API

Valued Contributor
Valued Contributor

DianaG,

 

I do have the SDK manual, and I do try to use it. Unfortunately, it's mostly just autogenerated text from the API metadata. It generally doesn't tell me anything more than Visual Studio's intellisense does.

 

Could you please let me know, for example, where in the SDK manual it informs me that the 'Type' field that is displayed in the Properties viewer in Process Simulate is accessed via processModelObject.PlanningRepresentation.GetField("prototype") cast to ITxPlanningObject? Are these literal strings listed anywhere?

 

Thanks

 

 

Betreff: Accessing the assigned type of an object via the API

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi LTW,

 

Thank you for the feedback. We are working on improving the documentation, still your question is about server side fields.

You can check the Accessing Arbitrary Fields topic in the SDK Help about them. These fields you can find in the eMServer customization - there are regular and relation fields.

 

In the SDK you can find the About Tecnomatix.NET Classes and Interfaces section that provides an overview of the API capabilities. Each version we list the new functionality in the What's New section.

 

Best Regards,

DianaG