Skip to main content
17-Peridot
October 6, 2023
Question

WT Part

  • October 6, 2023
  • 1 reply
  • 1425 views

Hi Guys,

 

I would appreciate your help finding a solution - I am working on WT Parts, and wherever I create a WT Part it's only stored in one Library, not in the same context.

 

Thanks in Advance,

Amir

 

 

1 reply

Fadel
23-Emerald I
October 6, 2023

are you creating the parts using API ?

Buiꓘa
17-Peridot
October 6, 2023

Thank you for the replay Mr. Fadel,

 

I tried to make a .class using eclipse for this & and i don't have an idea about API. Please brief on this.

 

Regards,

Amir

Fadel
23-Emerald I
October 6, 2023

can you follow the same approach below for WTDocument, the same should work for WTPart :

String name = "TSTest";//name
String number = "TSTest";//number
String lifeCycleName = "Basic";//lifecycle name
String container_path = "/wt.inf.container.OrgContainer=demo organization/wt.pdmlink.PDMLinkProduct=Product-Test";//the container where the document will be created/located
String folder_path = "/Default";//folder path
WTDocument doc = WTDocument. newWTDocument();
doc.setName(name);
doc.setNumber(number);

WTContainerRef containerRef = WTContainerHelper.service .getByPath(container_path);
doc.setContainerReference(containerRef);

Folder folder = FolderHelper.service .getFolder(folder_path,containerRef);
FolderHelper.assignLocation((FolderEntry)doc,folder);

LifeCycleTemplate lct = LifeCycleHelper.service .getLifeCycleTemplate(lifeCycleName , doc.getContainerReference());
doc = (WTDocument) LifeCycleHelper. setLifeCycle(doc, lct);
 

doc = (WTDocument) wt.fc.PersistenceHelper.manager.store(doc);
Buiꓘa