Skip to main content
15-Moonstone
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

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

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

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

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

Thanks Aditya.

I got it.

Best Regards,

Aditya

Translate