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

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

API to build Part Structure

ademarco
6-Contributor

API to build Part Structure

Hello Community,

 

I am working on some coding to Link an EPMDocument to a WTPart, and then build the WTPart structure. I've got the association portion working but am having difficulty with the build task. I found this in the Windchill API to build structures:
BuildHelper.service.buildTarget(WTCollection alwaysBuild, WTCollection buildIfNotAlreadyBuilt, BuildResolverDelegate[] buildResolverDelegate, ConfigSpec configSpec)

 

I feed this a collection containing my working copy of the WTPart, and it appears to run without issue. 

It returns a WTValuedMap, which I am not familiar with.  My question is there any I need to do with the WTValued Map to update the working copy of my WTPart object prior to service.checkin?  Or has anyone had any success with using the BuildHelper.service ?

 

Snippet:
\\Checkout OBJ_prt

\\create WRK_Prt = workingcopyof (OBJ_Prt)

\\Create links to EMPDoc

\\add WRK_prt to WTCollection alwaysBuild.  No buildresolverDelegate, no config spec.

 

WTValuedMap myMap = BuildHelper.Service.BuildTargets(alwaysBuild)

 

\\CI_Prt = ...service.check(ONJPrt)

 

 

 

1 REPLY 1
ademarco
6-Contributor
(To:ademarco)

Got it to work. Not sure if it is correct, but I get the results I am shooting for.

Snippet:

//WRK_prt = workingcopy of checkedout OBJ_prt
Link cadpartlink = EPMBuildRule.newEPMBuildRule(OBJ_epm, WRK_prt);
Link savedlink = (Link)PersistenceHelper.manager.save(cadpartlink);

WTCollection wtCol = new WTHashSet();
wtCol.add(WRK_prt);
WTValuedMap vMap = (WTValuedMap) BuildHelper.service.buildTarget(wtCol,null,null,null);

Iterator iter = vMap.entrySet().iterator();
outLog.println("iter set");
WTKeyedMap.WTEntry entry = (WTKeyedMap.WTEntry)iter.next();
outLog.println("WTEntry Set");

WRK_prt = (WTPart)entry.getKeyAsPersistable();

WTPart CI_prt = (WTPart)WorkInProgressHelper.service.checkin(OBJ_prt, "");

Announcements

Top Tags