Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hello Community,
I am looking for a quicker way to iterate an object to a specific iteration. For example, if the CAD document is in A.1 version, I want to iterate it to A.7. Instead of doing a check-out and check-in 6 times, is there any better way to do it?
Thanks.
HS
Solved! Go to Solution.
Interesting requirements, OOTB cannot achieve it, you need customization, refer to this code
API VersionControlHelper.setIterationIdentifier(Iterated iteration, IterationIdentifier identifier)
Demo
// iterate part from A.1 to A.5
WTPart newPart = (WTPart) VersionControlHelper.service.newIteration( part, true );
//Refresh the old iteration
part = (WTPart)PersistenceHelper.manager.refresh(part);
//Build the relationship between the new and old iteration
newPart =(WTPart)VersionControlHelper.service.supersede(part, newPart);
//Set the iterationIdentifier of new iterations
VersionControlHelper.setIterationIdentifier((Iterated)newPart,IterationIdentifier.newIterationIdentifier(Series.newSeries("wt.vc.IterationIdentifier", "5")));
//Store the new iteration
PersistenceHelper.manager.store(newPart);
Interesting requirements, OOTB cannot achieve it, you need customization, refer to this code
API VersionControlHelper.setIterationIdentifier(Iterated iteration, IterationIdentifier identifier)
Demo
// iterate part from A.1 to A.5
WTPart newPart = (WTPart) VersionControlHelper.service.newIteration( part, true );
//Refresh the old iteration
part = (WTPart)PersistenceHelper.manager.refresh(part);
//Build the relationship between the new and old iteration
newPart =(WTPart)VersionControlHelper.service.supersede(part, newPart);
//Set the iterationIdentifier of new iterations
VersionControlHelper.setIterationIdentifier((Iterated)newPart,IterationIdentifier.newIterationIdentifier(Series.newSeries("wt.vc.IterationIdentifier", "5")));
//Store the new iteration
PersistenceHelper.manager.store(newPart);
Why would you do this? What's the use case here? Iterations are meant to just track interim edits. For example, purging can wipe them all out since previous iterations should have no consequence over time. The iteration number should not matter.