Skip to main content
12-Amethyst
March 1, 2017
Solved

Setting the default value for the OOTB WTPart attributes via OIR

  • March 1, 2017
  • 2 replies
  • 8298 views

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.

Best answer by SergeyEfimov

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

2 replies

12-Amethyst
March 1, 2017

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

1-Visitor
March 1, 2017

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

12-Amethyst
March 1, 2017

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

1-Visitor
March 9, 2017

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

Arjen12-AmethystAuthor
12-Amethyst
March 12, 2017

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