cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Activating Simp Rep XToolkitBadInputs

LH_10747950
10-Marble

Activating Simp Rep XToolkitBadInputs

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());
				}

 

 

 

 

 

 

 

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions

Maybe, a problem is:

Note
Creo Object TOOLKIT Java supports simplified representation of Assemblies only, not Parts.

View solution in original post

2 REPLIES 2

Maybe, a problem is:

Note
Creo Object TOOLKIT Java supports simplified representation of Assemblies only, not Parts.

Ah, I missed that, thank you very much.

Announcements


Top Tags