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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How to set OOTB Part Attributes, Version & Iteration, using java code (Windchill API's) ?

ptc-5136769
1-Visitor

How to set OOTB Part Attributes, Version & Iteration, using java code (Windchill API's) ?

Hello,

I have created a WTPart using Java code + Windchill API's. There are setter methods available for setting some attribute like Name, Number, Type, Source etc.

Is there any method / API to set the Version and Iteration of the created part through code ? Can I set the values of Version and Iteration to be say, C and 5 directly ? Or creating a default Part of A.1 and revising / checking out is the only option ?

It would be really helpful if someone could help me with Windchill API's / Code snippets to set Part Version / Iteration OR Revise / Check out a part till the desired Version / Iteration is reached.

ACCEPTED SOLUTION

Accepted Solutions
mrane
12-Amethyst
(To:ptc-5136769)

Yes, it is possible to load objects out of sequence. For setting the version one can use VersionControlSErverHerlper API's as shown below.

VersionIdentifier vid = VersionIdentifier.newVersionIdentifier();

VersionControlServerHelper.setVersionIdentifier(the_versioned, vid, false /* validateIncreasing */);

Similarly for iteration one can use IterationIdentifier API's. As shown below

IterationIdentifier iid = IterationIdentifier.newIterationIdentifier();

VersionControlHelper.setIterationIdentifier(the_iterated, iid);

A detailed code snippet can be found at <WT_HOME>\src\com\wt\doc\LoadDoc.java

-Malavika

View solution in original post

3 REPLIES 3

akumar-2
1-Visitor
(To:rionm)

Hi,

I wanted to assign version of EPMDoc object to WTDoc object while creation WTDoc.

Suppose EPMDoc has version A then WTDoc of same version should create in system.

is it possible?if so then plz let me know how i can achieve this through code.

mrane
12-Amethyst
(To:ptc-5136769)

Yes, it is possible to load objects out of sequence. For setting the version one can use VersionControlSErverHerlper API's as shown below.

VersionIdentifier vid = VersionIdentifier.newVersionIdentifier();

VersionControlServerHelper.setVersionIdentifier(the_versioned, vid, false /* validateIncreasing */);

Similarly for iteration one can use IterationIdentifier API's. As shown below

IterationIdentifier iid = IterationIdentifier.newIterationIdentifier();

VersionControlHelper.setIterationIdentifier(the_iterated, iid);

A detailed code snippet can be found at <WT_HOME>\src\com\wt\doc\LoadDoc.java

-Malavika

Announcements


Top Tags