Skip to main content
15-Moonstone
April 18, 2016
Question

How to attach a Part to a Document using Windchill API ?

  • April 18, 2016
  • 2 replies
  • 5640 views

Hi All,

How do we attach a WTPart or a WTDocument to a WTdocument in the related objects using API ?

Can anyone tell like which API is used exactly ?

Thanks in Advance,

Aditya

2 replies

aachanta15-MoonstoneAuthor
15-Moonstone
April 18, 2016

Like inserting a document in the sense.

WTDocument -> Information Page -> Related Objects ->

So how do we add a Where Used Document  or References Document or Referenced By Documents or Parts using Windchill API.

Kindly let me know the solution if anyone is aware of it.

Thanks and Regards,

Aditya Achanta

1-Visitor
April 19, 2016

Please refer to the API Below :-

ReferencedBy

WTDocument workable = (WTDocument)WorkInProgressHelper.service.workingCopyOf(doc);
wt.doc.WTDocumentDependencyLink  dependlnk= wt.doc.WTDocumentDependencyLink.newWTDocumentDependencyLink(workable,referenceddoc);
PersistenceServerHelper.manager.save(dependlnk);

UsedBy

WTDocumentUsageLink usage_link = WTDocumentUsageLink.newWTDocumentUsageLink(parent_document,(WTDocumentMaster)child_document.getMaster());
usage_link.setStructureOrder(0);
PersistenceServerHelper.manager.save(usage_link);

Thanks,

Aditya

aachanta15-MoonstoneAuthor
15-Moonstone
April 20, 2016

Hi Aditya,

Thank you.

But how about attaching a WTPart -DESCRIBES PARTS for a WTDocument in Related Objects ?

Can you please suggest API even for that ?

Thanks and Regards,

Aditya

1-Visitor
April 26, 2016

Hi Aditya,

Sorry for the late response, you can probably use :-

if(!WorkInProgressHelper.isWorkingCopy(wtpart))

this checks if the WTPart instance under consideration is the workingCopy, if not then Checkout.

Thanks,

Aditya

aachanta15-MoonstoneAuthor
15-Moonstone
April 28, 2016

Thanks Aditya.

I got it.

Best Regards,

Aditya