Skip to main content
7-Bedrock
September 24, 2024
Question

API to link non latest EPM Document to WTPart using EPMBuildRule

  • September 24, 2024
  • 3 replies
  • 1349 views

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

3 replies

avillanueva
23-Emerald I
23-Emerald I
September 24, 2024

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?

7-Bedrock
September 24, 2024

Hi @avillanueva ,

I want to do it via code.

18-Opal
September 26, 2024

@BA_10780502 

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

joe_morton
18-Opal
18-Opal
September 30, 2024

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.

HelesicPetr
22-Sapphire II
22-Sapphire II
October 1, 2024

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

 

10-Marble
October 5, 2024

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