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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Customization To Link a Ref Doc to a WTPart Without Iterating the WTPart

pwilliams-3
11-Garnet

Customization To Link a Ref Doc to a WTPart Without Iterating the WTPart

10.1 M040

In our manufacturing process we perform some testing and the results are recorded in a document.  We want to manage this document inside of Windchill as a reference document.  We also want to link this document to the corresponding WTPart.  However, the WTPart is in the RELEASED state and therefore cannot be modified to link the document.  Has anyone else had this requirement and if so how did you solve it?

My first thought would be to create an event listener that prevents the checkout and iteration of the WTPart if this specific type of reference document is being linked.  However during my research I am finding it difficult to find the right event or events to veto.

Thanks,

Patrick Williams

1 REPLY 1

Follow code work fine without checking out the primary WTDocument and add the reference document. Try to change WTDocument wtd to WTPart wtp in code below:

public static void addDescribeFileToDoc(WTDocument wtd, File file) throws Exception

  {

  byte[] byteArray = FileUtils.readFileToByteArray(file);

  ContentHolderHelper.setContents(wtd, byteArray, ContentRoleType.SECONDARY, file.getName(), "", false);

  }

Top Tags