cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the softclass type .NET

Valued Contributor
Valued Contributor
Hi How do I go about getting the type of the planning object through .NET see attached picture of what I am looking for. This is what I have ITxPlanningObject PlanningObject = TxApplication.ActiveDocument.Selection.GetPlanningItems.Item(0); string Object_type = PlanningObject.GetField("type"); But this just returns a empty string. Thanks
6 REPLIES

Betreff: How to get the softclass type .NET

Genius
Genius

I think it doesn't work in disconnected.

See a similar problem in Get prototype name

Betreff: How to get the softclass type .NET

Valued Contributor
Valued Contributor
Hi

Thanks but this is connected mode. I have np problem getting the prototype path. I need the type as displayed in my attached picture.

Thanks any help will be greatly appreciated

Re: How to get the softclass type .NET

Experimenter
Experimenter

 Hi,

 

Did you have a look into the PlanningType property of your ITxPlanningObject? It should return the string you are looking for.

 

Snippet

String planningType = planningObject.PlanningType;

 

Edit:

Forgot to mention it, I guess you want to go a little further than just retrieving a string. But once you got the string, you can use the TxPlanningTypeMetaData class to get some more information:

 

Snippet

TxEmsGlobalServicesProvider servicesProvider = new TxEmsGlobalServicesProvider();
TxPlanningTypeMetaData metaData = servicesProvider.GetTypeMetaData(planningType);

 

With that, you can find out which fields you have access to etc. But please don't ask me why they implemented it this way ;-)

Re: How to get the softclass type .NET

Creator
Creator

Did you manage to solve the problem?

I've got a similar problem.

When I try to get which type of object I have using:

String planningType = planningObject.PlanningType;

I just get PMToolInstance

 

Re: How to get the softclass type .NET

Valued Contributor
Valued Contributor

Hi

 

Please below I got the prototype from the instance with

 

Prototype = Instance.PlanningRepresentation.GetField("masterObj")

 

and then

 

Prototype.PlanningType

 

Regards

 

 

Re: How to get the softclass type .NET

Creator
Creator

Thank you for your answer.

It doesn't solve my problem completely, but it takes me a bit closer to my goal.

 

Regards