Skip to main content
20-Turquoise
September 16, 2014
Question

How do I create wtpart subtype using api's?

  • September 16, 2014
  • 2 replies
  • 3863 views
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

September 17, 2014

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

11-Garnet
September 17, 2014

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