Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I am using Windchill PDMLink Release 11.2 and Datecode with CPS 11.2.0.2
Is it possible to create a copy of EPM Document in Workspace through API?
(EPM document is already added to workspace through API.)
@RK_10318816 wrote:
I am using Windchill PDMLink Release 11.2 and Datecode with CPS 11.2.0.2
Is it possible to create a copy of EPM Document in Workspace through API?
(EPM document is already added to workspace through API.)
Have a look at EnterpriseHelper.service.newMultiObjectCopy(), EnterpriseHelper.service.saveMultiObjectCopy, EnterpriseHelper.service.newCopy(), and EnterpriseHelper.service.saveCopy().
https://www.ptc.com/en/support/article/cs59135
https://www.ptc.com/en/support/article/cs108185
Hello Jones,
I have used this below API as you mentioned, but this is copying the EPM document in the container folder.
EnterpriseHelper.service.saveCopy()
My requirement is to create a copy in workspace for temporary use.
@RK_10318816 wrote:
Hello Jones,
I have used this below API as you mentioned, but this is copying the EPM document in the container folder.
EnterpriseHelper.service.saveCopy()
My requirement is to create a copy in workspace for temporary use.
You have to do the following:
EPMWorkspace creoWorkspace = <a workspace>
EPMDocument sourceModel = <a cad model>
WTContainer workspaceContainer = creoWorkspace.getContainer();// used below to set copied model's container
// Add sources to workspace if needed
WTCollection missingSources = new WTArrayList();
missingSources.add(sourceModel);
EPMWorkspaceHelper.manager.addToWorkspace(creoWorkspace, missingSources);
// See https://community.ptc.com/t5/Windchill/Using-newMultiObjectCopy-to-copy-EPMDocuments/m-p/388102
EPMContextHelper.setApplication(EPMApplicationType.toEPMApplicationType("EPM"));
// do the copy
EPMDocument modelCopy = (EPMDocument) EnterpriseHelper.service.newCopy(sourceModel);
// Set container, folder, etc
modelCopy.setNumber(<newNumber>);
modelCopy.setCADName(<newCadName>);
modelCopy.setName(<newName>);
modelCopy.setContainer(workspaceContainer);
FolderHelper.assignLocation((FolderEntry) modelCopy, creoWorkspace.getFolder());