Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
So I'm trying to call upon an existing simp rep called "Smd_Flat" and then activate it upon a solid sheet metal part in an assembly to get its flat pattern, however i keep getting a XToolkitBadInputs error. My code is below. This is for Creo Parametric 9.0.4.0.
The method loadPart(leaf); just loads the part in a new window as the simp prep couldnt be found in the window with the assembly.
Any help would be appreciated.
Assembly assembly = getAssembly();
ComponentPath[] partList = MzkCommonUtilitiesCode.listEachLeafComponent(assembly);
//Component path to solid array
Solid[] leafArray = new Solid[partList.length];
for (int j = 0; j < partList.length; j++) {
leafArray[j] = partList[j].GetLeaf();
}
//Going through all subcomponents to get key properties
for (int i =0; i < leafArray.length; i++) {
System.out.println("\n");
printMsg("starting loop");
//getting leaf values
Solid leaf = leafArray[i];
String partName = leaf.GetInstanceName();
if (!partName.startsWith("WP")) {
loadPart(partName);
Window creoPartWindow = proeSession.GetCurrentWindow();
//changing simp rep to flat pattern
SimpRep startingRep = leaf.GetActiveSimpRep();
SimpRep simpRep = leaf.GetSimpRep("Smd_Flat");
// Check that simp rep has been found
//printMsg("Smd_Flat simp rep = " + simpRep.GetName());
try {
printMsg("activating simp rep");
leaf.ActivateSimpRep(simpRep);
printMsg("activated simp rep");
}
catch (XToolkitError x) {
printMsg("Activate Simp Rep exception: " + x.GetMessage());
}
Solved! Go to Solution.
Maybe, a problem is:
Maybe, a problem is:
Ah, I missed that, thank you very much.