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

Get parent when creating WTPart

Get parent when creating WTPart

Hi.

I implement my own RuleAlgorithm (wt.rule.algorithm.RuleAlgorithm) and set it in OIR for WTPart. It works.

Question is How can i get info about parent WTPart for which i create child?

Can i get it from WTContainerRef in RuleAlgorithm.calculate method or may be from get parameters in wtpart creation form url?

Can anyone help me?

10 REPLIES 10

Re: Get parent when creating WTPart

Vasiliy, Windchill creates the wt.part.WTPartUsageLinkobject when you assign the child WTpart to the parent WTPart. It is a master to reference link, so master of Parent Part is attached to the each version of child WtPart.

To get the Parent information form the WTPart you can use nevigate APIs. Pass in the child Part and get the Parent information.

ParentWTPPart <----->wt.part.WTPartUsageLink<-------->ChildWTPart.

PersistenceHelper.manager.navigate(). for more information refer the Windchill API Doc.

Re: Get parent when creating WTPart

The problem is to get parent part (in RuleAlgorithm implementation or in OIR rule.xml) before child part is created (in "Creating a New Part" process).

Re: Get parent when creating WTPart

Hi,

What is your actual requirement ? Is your child part's number depends on Parent Part or in Parent Part's attribute ?

Actually its impossible to get parent part (in RuleAlgorithm implementation or in OIR rule.xml) before child part is created (in "Creating a New Part" process).

Cause at the time of WTPart creation there is no WTPartUsageLink. So from WTPart OIR its not possible to get the information you required.

Thanks and Regards,

Kaushik

Re: Get parent when creating WTPart

Kaushik, in my task child part number depends on parent part number.

Is there any way to get parent number?

Re: Get parent when creating WTPart

You can give task to Part creator to select the parent part. Create one IBA for WTPart let's say ParentPart write picker for that attribute/IBA and use that attribute/IBA as prefix in OIR for Number.

<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">


<Attr id="ParentPart"/>

<Arg>-</Arg>

<Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:5:0}</Arg>

</AttrValue>

Hope this helps !!!

Thanks,

Shreyas

Re: Get parent when creating WTPart

Hi Vasiliy,

Shreyas's idea is good but not sure whether it's feasible or not . Usually WTParts are created from some CAD application like AutoCAD,Creo etc.

If that's not the case then you can do what Shreyas said.

If not then from OIR its not possible you have to write a listener.

Thanks and Regards,

Kaushik

Re: Get parent when creating WTPart

What listener?

Re: Get parent when creating WTPart

Hi Vasiliy,

Write a listener to listen the event dispatched at the time of persisting WTPartUsageLink ..

Through that listener you can retrieve the parent and renumbered the child.

Thanks and Regards,

Kaushik

Re: Get parent when creating WTPart

Hi, thanks.

Here comes next question