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

Setting the default value for the OOTB WTPart attributes via OIR

SOLVED
Regular Member

Setting the default value for the OOTB WTPart attributes via OIR

Can you tell me how I can set the default value for the OOTB WTPart attributes (End Item, Assembly Mode, Source, etc.) via OIR? We would like to set different default values across context.

Use case:

We have a library for purchased component. These parts should have a default value of Buy for Source. We manage our own products in product containers where the default value for Source should be Make.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Setting the default value for the OOTB WTPart attributes via OIR

1. Add the following Object Initialization Rule to your type (wt.part.WTPart)

<!-- set the Boolean IBA -->

    <AttrValue id="endItem" algorithm="wt.rule.algorithm.BooleanConstant">

        <Arg>true</Arg>

    </AttrValue>

<!-- set the String IBA -->

  <AttrValue id="source" algorithm="wt.rule.algorithm.StringConstant">

  <Arg>buy</Arg>

  </AttrValue>

  <AttrValue id="partType" algorithm="wt.rule.algorithm.StringConstant">

  <Arg>inseparable</Arg>

  </AttrValue>

<!-- specify AttrConstraint tag -->

  <AttrConstraint id="endItem" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

  <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

  </AttrConstraint>

  <AttrConstraint id="source" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

  <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

  </AttrConstraint>

  <AttrConstraint id="partType" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

  <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

  </AttrConstraint>

2. Edit the following  %WT_HOME%\codebase\com\ptc\core\rule\server\delegate\init\RuleConfigurableTypeAttribute.properties.xconf:

   <Property name="wt.part.WTPart" default="number,name,lifeCycle,lifeCycle.id,teamTemplate,teamTemplate.id,folder.id,organization.id,endItem,source,partType"/>

3. Run "xconfmanager -pF" in Windchill Shell and restart Windchill

View solution in original post

10 REPLIES 10

Re: Setting the default value for the OOTB WTPart attributes via OIR

You need to go to Type and Attribute manager, edit the type, then select the attribute. See panel on right

Re: Setting the default value for the OOTB WTPart attributes via OIR

Setting a default value for the End Item does not work.

Re: Setting the default value for the OOTB WTPart attributes via OIR

another related post with other options - Setting the default values for the OOTB WTPart attributes

Re: Setting the default value for the OOTB WTPart attributes via OIR

Darren, do you have an instruction how to realize the solution described in the mentioned related post? I don't see how I can define different default values for product containers and libraries.

Highlighted

Re: Setting the default value for the OOTB WTPart attributes via OIR

This way you define only one default value for all contexts. I want to differentiate across containers and libraries.

Re: Setting the default value for the OOTB WTPart attributes via OIR

I didn't know that its not possible to set the default value on this...Interesting.... I wonder if this applies to all modeled attributes or just this one? I have not personally tried to achieve this any other way, sorry I can't provide instructions.

Re: Setting the default value for the OOTB WTPart attributes via OIR

You would need to load dedicated OIRs in every product container to differentiate the default value. This is somehow manageable.

As far as I remember you need to specify modeled attributes in a WT. Property which should be altered by the OIR. We have done this for the partstructureoverride attribute in the past.

Re: Setting the default value for the OOTB WTPart attributes via OIR

1. Add the following Object Initialization Rule to your type (wt.part.WTPart)

<!-- set the Boolean IBA -->

    <AttrValue id="endItem" algorithm="wt.rule.algorithm.BooleanConstant">

        <Arg>true</Arg>

    </AttrValue>

<!-- set the String IBA -->

  <AttrValue id="source" algorithm="wt.rule.algorithm.StringConstant">

  <Arg>buy</Arg>

  </AttrValue>

  <AttrValue id="partType" algorithm="wt.rule.algorithm.StringConstant">

  <Arg>inseparable</Arg>

  </AttrValue>

<!-- specify AttrConstraint tag -->

  <AttrConstraint id="endItem" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

  <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

  </AttrConstraint>

  <AttrConstraint id="source" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

  <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

  </AttrConstraint>

  <AttrConstraint id="partType" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

  <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

  </AttrConstraint>

2. Edit the following  %WT_HOME%\codebase\com\ptc\core\rule\server\delegate\init\RuleConfigurableTypeAttribute.properties.xconf:

   <Property name="wt.part.WTPart" default="number,name,lifeCycle,lifeCycle.id,teamTemplate,teamTemplate.id,folder.id,organization.id,endItem,source,partType"/>

3. Run "xconfmanager -pF" in Windchill Shell and restart Windchill

View solution in original post

Re: Setting the default value for the OOTB WTPart attributes via OIR

Thanks for the proposes solution! We will try this at short notice. I will inform you about our findings.

Announcements
LiveWorx Call For Papers Happening Now!