Skip to main content
12-Amethyst
January 29, 2024
Solved

Easier way to iterate CAD Documents

  • January 29, 2024
  • 2 replies
  • 1165 views

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

Best answer by Rocket_Max

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

2 replies

17-Peridot
January 29, 2024

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

avillanueva
23-Emerald I
23-Emerald I
January 29, 2024

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.