Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
I am doing the save as for the EPMDocument while doing save it is giving some error. iam able to get the owner application but iam not able to set the owner application for newly saveas
[error is"The value of "Owner Application" cannot be set to null, since it is a "required" attribute."]
private EPMDocument saveAsCADAssembly(EPMDocument emptyCADAssembly, String name) throws WTException {
try {
System.out.println("While Save as partName: " + name);
// Get the owner application from the original CAD assembly
EPMApplicationType ownerAppl = emptyCADAssembly.getOwnerApplication();
System.out.println("Owner Application: " + ownerAppl.toString());
RevisionControlled[] originals = new RevisionControlled[1];
CopyObjectInfo[] copyInfoArray = null;
originals[0] = emptyCADAssembly;
copyInfoArray = EnterpriseHelper.service.newMultiObjectCopy(originals);
EPMDocument copy = (EPMDocument) copyInfoArray[0].getCopy();
// Set the owner application for the newly saved copy
copy.getOwnerApplication();
// Set the owner application for the newly saved copy
copy.setNumber(name + ".SLDASM");
copy.setName(name + ".SLDASM");
copy.setContainer(emptyCADAssembly.getContainer());
copyInfoArray = EnterpriseHelper.service.saveMultiObjectCopy(copyInfoArray);
System.out.println("emptyCADAssembly return: " + emptyCADAssembly.getNumber() + "------" + emptyCADAssembly.getName());
} catch (Exception e) {
e.printStackTrace();
}
return emptyCADAssembly;
}
Hi @AR_9920456
Before you create the EPMDocument use following method to set the application
wt.epm.EPMContextHelper.setApplication(wt.epm.EPMApplicationType.toEPMApplicationType("PROE"));
here is the list of apps:
PROE, CADDS5, CATIA, OTHER, PRODESKTOP, MENTORB, ACAD, HELIX, CCD, UG, IDEAS, CADENCE, MENTORE, SOLIDWORKS, SOLIDDESIGNER, ME10, CATIAV5, INVENTOR, MENTORD, PADS, PROTEL, ORCAD, ZUKENCR5, CADSTAR, VISULA, PCAD, ARBORTEXT, WINDCHILL, CADENCE_SCH, MENTORB_SCH, MENTORE_SCH, PADS_SCH, ORCAD_SCH, ZUKENCR5_SCH, CADSTAR_SCH, VISULA_SCH, PCAD_SCH, PROTEL_SCH, RSD, MATHCAD, ISODRAW, COCRMOD, COCRDRAFT, GRAPHICSEDITOR, SEDGE, CADENCE_ADW_DM, MSTATION, CADENCE_APD, GENERIC_ECAD, GALAXY, ZUKENCR5GW_SCH, MEDUSA, STHENO, BLUEPRINTPCB, CAM350, CATIAV6, ECADNEUTRAL, ZUKENCR8DF, ZUKENCR8DGW_SCH, CADENCE_SDA_SCH, AUTODESK_REVIT, ALTIUM_NEXUS, AUCOTEC_ENGI_BASE, CADENCE_ALLEGRO_EDM, CADENCE_ORCAD_EDM, E_PLAN, MENTOR_CAPITAL_HARNESS, MENTOR_EDM, MENTOR_EDX, PULSONIX, SOLIDWORKS_ELECTRICAL, ZUKEN_DS_CR, ZUKEN_DS_E3
PetrH