cancel
Showing results for 
Search instead for 
Did you mean: 

Get ObjectType from eMS Server

Creator
Creator

Hello,

I've been trying to find a way to determine the database type on the eMS Server.

Ie Lets say that I've got a TxCompoundResource. Is it possible to determine whether the object is a certain database type or not? I've been experimenting with the Tecnomatix.Planning Namespace without any luck.

 

Is it possoble or have I reached a dead end?

 

//Spjuger

3 REPLIES

Re: Get ObjectType from eMS Server

Hello Spjuger,

 

you could try the following code assuming a study with the object has been loaded:

var externalId = "external-id-of-the-object";
var txObject = TxApplication.ActiveDocument.GetObjectByProcessModelId(new TxProcessModelId(externalId)) as Tecnomatix.Planning.ITxPlanningObject;
var planningType = txObject.PlanningType;
// now check if type is ok for you

 

-

Andreas

Re: Get ObjectType from eMS Server

Creator
Creator

Hello Alexander,

Thanks for your answer. Yes this works for some objects like Compounds. (I've used whis method before)

But it does not work for component objects (objects that has a .cojt). Those kind of objects just have a PlanningType = "PmToolInstance"

Is it possible to aquire type for those objects aswell?

Re: Get ObjectType from eMS Server

Hi Spjuger,

 

in that case if you want to check the type of a tool instance you need to check the type of the prototype object. You can get the prototype object from a tool instance by using GetField Method of the ITxPlanningObject interface:

var externalId = "external-id-of-the-object";
var txObject = TxApplication.ActiveDocument.GetObjectByProcessModelId(new TxProcessModelId(externalId)) as Tecnomatix.Planning.ITxPlanningObject;
var prototypeObject = txObject.GetField("prototype") as Tecnomatix.Planning.ITxPlanningObject;
var planningType = prototypeObject.PlanningType;

I didn`t test the code so it may need some adjustments but i think you get an idea how to do it.

 

A tool instance is like a instance of a class in C# where the prototype object represents a class in Process Designer/Simulate.

 

-

Andreas