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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

API to link non latest EPM Document to WTPart using EPMBuildRule

BA_10780502
6-Contributor

API to link non latest EPM Document to WTPart using EPMBuildRule

Version: Windchill 12.1

 

Use Case: I want to attached non latest EPMDocument to WTPart using EPMBuildRule


Description:

Hello All,

I want to attached non latest EPMDocument to WTPart using EPMBuildRule but it is always taking latest version of EPMDocument.

How can we do that?

Thanks

6 REPLIES 6
avillanueva
22-Sapphire II
(To:BA_10780502)

Are you trying to do this via a code customization or manually from a workspace? Curious as to why you would want to do this?

Hi @avillanueva ,

I want to do it via code.

@BA_10780502 

Post your code so that we can see where you are going wrong.

Could you describe a little more what the end goal is?

 

I recently looked into something that may be related. If you have:

  • CAD document 1 rev A with Owner link to WTPart 1
  • CAD document 1 rev B with Owner link to WTPart 2

Every time you do a build of a CAD assembly using that CAD document, the resulting WTPart structure will use WTPart 2.

 

I'm not sure what your end goal is, but setting the links may not be enough. I think the Build action itself uses the latest version of the CAD.

Hi @joe_morton 

Actually, the link is a version to version so iteration to iteration. 

You can have links between each iteration EPM-WTP 

PetrH

 

I could use some more context here, and note as @HelesicPetr  states below, the EPMBuildRule link is actually between versions, not between iterations (take a look at the database table - the values are BRANCHIDA3A5 and BRANCHIDA3B5 which point to BRANCHIDITERATIONINFO).

That said, a code fragment to create one is below -- this does not run a build or anything else, it just creates the link.

WTPart workingPart = (WTPart)WorkInProgressHelper.service.checkout(wtPart, WorkInProgressHelper.service.getCheckoutFolder(), "").getWorkingCopy();
EPMBuildRule epmBuildRule = EPMBuildRule.newEPMBuildRule(epmDocument, workingPart, CADHelper.OWNERLINK);
PersistenceHelper.manager.store(epmBuildRule);
WorkInProgressHelper.service.checkin(workingPart, "Link with CAD");

 

Announcements


Top Tags