cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Change Object type using API

SOLVED
Newbie

Change Object type using API

Hi Everyone,

I need help in changing Object type using API.

I want to know if any method exists that can change the object type.

Regards

Sudeep

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Change Object type using API

Hi Prabhash,

During Migration, there were some parts migrated with wrong type. Hence i needed the API and i found it.

TypeHelper.setType((Persistable)partObj, TypeHelper.getTypeIdentifier("internal_name"));

PersistenceServerHelper.update(partObj);

partObj = (WTPart)PersistenceHelper.manager.refresh(partObj);

6 REPLIES 6

Re: Change Object type using API

Sudeep, I have not come across any API , that can be used to do so. Let's wait what others have to say.

Just curious, what is your business case, that you are looking for such an API.

Kindly share, if you find anything related to this.

Highlighted

Re: Change Object type using API

Do you need an API or is a utility that PTC has acceptable?

If the utility is acceptable, you can refer to this Knowledgebase Article

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS7287&art_lang=en&posno=2&q=change%20objec...

We've used this pretty successfully, we've also made some slight tweaks to the output SQL to add additional clauses to filter the objects to be changed.

Re: Change Object type using API

Hi Prabhash,

During Migration, there were some parts migrated with wrong type. Hence i needed the API and i found it.

TypeHelper.setType((Persistable)partObj, TypeHelper.getTypeIdentifier("internal_name"));

PersistenceServerHelper.update(partObj);

partObj = (WTPart)PersistenceHelper.manager.refresh(partObj);

Re: Change Object type using API

Hi Stephen,

Good to know that there is a utility for this.

But i had to convert only set of parts whose numbers had to be read from a file and also update many custom attributes on conversion.

So i think using a API is a better option. This is the code i used.

TypeHelper.setType((Persistable)partObj, TypeHelper.getTypeIdentifier("internal_name"));

PersistenceServerHelper.update(partObj);

partObj = (WTPart)PersistenceHelper.manager.refresh(partObj);

Re: Change Object type using API

Glad you found what you were looking for. We did end up customizing the SQL that the tool outputs to allow us to put in a set of object numbers to convert, but we did not need to touch any attributes.

Re: Change Object type using API

Hi spai,

 

could you please provide me a import statement this two methods TypeHelper.setType(),  TypeHelper.getTypeIdentifier();

It would me more helpful for me.

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________ Check out the Windchill Tips Board! We're talking about Whirlpool's use of digital twin, augmented reality, and data-driven design!

The NAVIGATE WORKING GROUP is here! Come innovate with PTC!

Sign up for a Working Group