使用案例 14:根據零件類型產生下游結構
請考慮這樣一種情境:即 BOM 轉換器中存在以下結構:
下游結構不存在。
上游結構中的零件屬於 WTPart 的不同子類型。
PartSubType1PartSubType2PartSubType3PartSubType4WTPart 的子類型。
欲根據零件類型產生下游結構,您可以使用規則檔案或內容檔案來指定轉換與重新建構規則。
使用規則檔案
在文字檔案中,新增 JSON 格式的下列規則:
{
"transformRules": [
{
"sourceType": "wt.part.WTPart",
"transformOption": "newBranch"
},
{
"sourceType": "org.rnd.PartSubType2",
"transformOption": "addSame"
},
{
"sourceType": "org.rnd.PartSubType4",
"doNotTraverse":"true",
"doNotTransform":"true"
}
]
}
使用內容檔案
1. 存取位於 Windchill/codebase/com/ptc/core/foundation/associativity 中的 associativity.properties.xconf 檔案。
2. 新增下列重新建構規則:
<Property name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart.rule1" multivalued="," default=""/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart.rule1" value="transformOption=newBranch"/>
<Property name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.PartSubType2.rule1" multivalued="," default=""/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.PartSubType2.rule1" value="transformOption=addSame"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.PartSubType4.rule1" value="doNotTransform=true"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.org.rnd.PartSubType4.rule1" value="doNotTraverse=true"/>
執行「產生下游結構」動作之後,下列結構會顯示在「BOM 轉換器」中:
根據在規則檔案或內容檔案中指定的條件,會以下列方式產生下游結構:
類型為 WTPartSubType1_Assembly (Manufacturing)PartSubType3_Assm1 (Manufacturing)PartSubType3_Assm2 (Manufacturing)SubAssembly1 (Manufacturing) 已新增為新分支。
類型為 PartSubType2SubType2_Part1(Design)SubType2_Part2 (Design)SubType2_Part3 (Design)SubType2_Part4 (Design) 已依原樣新增到各自零件之下。
PartType4SubType4_Assm1 (Design)SubType4_Assm1 (Design) 不會轉換及橫移。因此,也不會轉換子零件 SubType2_Part5 (Design)
這是否有幫助?