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

We are happy to announce the new Windchill Customization board! Learn more.

Change Object type using API

spai-2
1-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

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);

View solution in original post

7 REPLIES 7
Prabhash
5-Regular Member
(To:spai-2)

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.

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);

Lokeshwaran_S
5-Regular Member
(To:spai-2)

Hi spai,

 

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

It would me more helpful for me.

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%20object%20type&source=search

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.

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);

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.

Hi, Please share the sql here if possible, I am not able to access that link.

Top Tags