Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
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?
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.
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).
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
Kaushik, in my task child part number depends on parent part number.
Is there any way to get parent number?
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
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
What listener?
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
Where do you guys learn all of this? I was under the assumption only PTC tech employees have access to this type of training?