Skip to main content
15-Moonstone
Apr 18, 2016 1:32 PM UTC
Question

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

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

9 replies

aachanta15-MoonstoneAuthor
15-Moonstone
Apr 18, 2016 1:56 PM UTC

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

Translate
1-Visitor
Apr 19, 2016 12:58 PM UTC

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

Translate
aachanta15-MoonstoneAuthor
15-Moonstone
Apr 20, 2016 5:02 AM UTC

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

Translate
1-Visitor
Apr 26, 2016 3:17 PM UTC

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

Translate
aachanta15-MoonstoneAuthor
15-Moonstone
Apr 28, 2016 9:45 AM UTC

Thanks Aditya.

I got it.

Best Regards,

Aditya

Translate