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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

How do I create wtpart subtype using api's?

RandyJones
19-Tanzanite

How do I create wtpart subtype using api's?

Windchill PDMLink 10.2 M020

I have created a subtype of wtpart ie:
com.mydomain.MyPart

How do I create one of these using the java api's?

For a "normal" wtpart I have this:
WTPart wtp = WTPart.newWTPart("MYPARTNUMBER", "NAME OF WTPART");

Does anybody have something to get me started to create a new com.mydomain.MyPart subtype?

In the oir for this the objType is specified like this:
objType="wt.part.WTPart|com.mydomain.MyPart"

Thanks

--
2 REPLIES 2

You can refer below artical to create softtype of wtpart using API's




https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS83161&posno=7&q=LWCNormalizedObject%20wtpart&nav=ptcdoctype||SFSolution||Document%20Type||Article&source=Searchhttps://support.ptc.com/appserver/cs/view/solution.jsp?n=CS83161&posno=7&q=LWCNormalizedObject%20wtpart&nav=ptcdoctype||SFSolution||Document%20Type||Article&source=Search



https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS138252&posno=4&q=LWCNormalizedObject%20&nav=ptcdoctype||SFSolution||Document%20Type||Article&source=Search



Thanks,


Shreyas

Hi Randy,


You can do this by:


private WTPart createSoftType(String number, String name, Folder folder) {
WTPart newSoftPart = WTPart.newWTPart(number, name);
FolderHelper.assignLocation(newSoftPart, folder);
TypeIdentifier typeidentifier = TypeHelper.getTypeIdentifier("WCTYPE|wt.part.WTPart|com.mydomain.MyPart");
WCTypeIdentifier wctypeidentifier = (WCTypeIdentifier) typeidentifier;
TypeDefinitionReference typeDefinitionReference = TypedUtilityServiceHelper.service.getTypeDefinitionReference(wctypeidentifier.getTypename());
newSoftPart.setTypeDefinitionReference(typeDefinitionReference);
ViewHelper.assignToView(newSoftPart, ViewHelper.service.getView("Design"));
return (WTPart) PersistenceHelper.manager.save(newSoftPart);
}


Regards

Top Tags