Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi All,
I'm trying for the following functionality,
I'm having the EPMDocument with the some representation, I need to create Interference Detection Definition (IDD) to that representation, the IDD is the type of the WTDocument and its primary content is .pvc file of the representation.
Currently I could able to create WTDocument with the type IDD without PVC attachement, becuase I didn't found the API to create PVC file against to representation.
Can anyone help me with the API that will generate the PVC file fro the representation.
Thanks in advance
ChandraMouli Panduri
Following is the code snippet which create new document i.e., IDD and also creates a new PVC file against to the representation and attach as a primary content to that new document.
PVC file is nothing but it is consist of all the information of the representataion in xml format. I will attached sample PVC file.
I have tested and its working.
String lifeCycleName = "Basic";//lifecycle name
String container_path = "/wt.inf.container.OrgContainer=CRD/wt.pdmlink.PDMLinkProduct=PD3";//the container where the document will be created/located
String folder_path = "/Default/IDD";//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(doc, folder);
LifeCycleTemplate lct = LifeCycleHelper.service .getLifeCycleTemplate(lifeCycleName , doc.getContainerReference());
doc = (WTDocument) LifeCycleHelper. setLifeCycle(doc, lct);
TypeDefinitionReference typeDefRef1 = TypedUtilityServiceHelper.service.getTypeDefinitionReference("com.ptc.InterferenceDetectionDefinition");
doc.setTypeDefinitionReference(typeDefRef1);
doc = (WTDocument) wt.fc.PersistenceHelper.manager .store(doc);
QueryResult epmReps = RepresentationHelper.service.getRepresentations(epm);
if (epmReps != null) {
while (epmReps.hasMoreElements()) {
Representation representation = (Representation) epmReps.nextElement();
System.out.println("sucesfully the load re"+representation.getName());
if(representation.getName().equalsIgnoreCase("testasm2")){
representation = (Representation) epmReps.nextElement();
BatchClashDefinitionModel paramBatchClashDefinitionModel = new BatchClashDefinitionModel((Versioned)epm, representation, Locale.ENGLISH);
paramBatchClashDefinitionModel.setName("assembly name");
paramBatchClashDefinitionModel.setUseLatestVariantSpec(true);
paramBatchClashDefinitionModel.setRepublishRepresentation(REPUBLISH_CONSTANT.DO_NOT_REPUBLISH);
paramBatchClashDefinitionModel.setAssemblyFeatures("false");
paramBatchClashDefinitionModel.setMode(MODE_CONSTANT.APPROXIMATE);
paramBatchClashDefinitionModel.setUnits(UNITS_CONSTANT.MM);
paramBatchClashDefinitionModel.setSelectedRepresentation(representation.getName());
paramBatchClashDefinitionModel.setRepresentationByNameExist(true);
paramBatchClashDefinitionModel.setClashReportName(epm.getNumber()+"_1report");
paramBatchClashDefinitionModel.setJobName(epm.getNumber()+"_1");
paramBatchClashDefinitionModel.setJobDescription("******descriptions****");
paramBatchClashDefinitionModel.setSubmitForClashing(true);
BatchClashHelper.saveContent(doc, paramBatchClashDefinitionModel);
// PersistenceHelper.manager.refresh(doc);
System.out.println("sucesfully the load representaion"+doc); } } } }
Thanks,
ChandraMouli Panduri