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

We are happy to announce the new Windchill Customization board! Learn more.

Setting the default value for the OOTB WTPart attributes via OIR

ArjenBlok
7-Bedrock

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

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

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

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

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

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.

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.

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

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.

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

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

Sergey, thanks for this perfect solution! Problem solved!

Top Tags