其他 Windchill 功能 > 製造流程管理 > 自訂產品結構總管 (PSE) > 針對子類型自訂 PSE
  
針對子類型自訂 PSE
目標
您已使用「類型及屬性管理」公用程式定義 WTPart 的子類型,並可能已將屬性新增至 WTPartUsageLink。雖然這些類型和屬性通常不需自訂就會顯示在 PSE 中,但您想要控制這些屬性在 PSE 總管中的顯示狀態。
背景
通常,在 PSE 中選取「零件」類型后,系統會自動偵測是否已使用「類型及屬性管理」公用程式定義了子類型。系統會自動提示並顯示屬性。參照 ID 如下的屬性定義的項目會在 PSE XML 檔案中實現上述目的:
ALL_SOFT_SCHEMA_ATTRIBUTES
ALL_SOFT_CLASSIFICATION_ATTRIBUTES
ALL_SOFT_USAGE_LINK_SCHEMA_ATTRIBUTES
雖然這些項目很實用,但無法控制顯示順序。此外,某些值可透過程式在伺服器上設定,因此,使用者不能指定值。
請考慮以下簡單範例:WTPart 已將可重新使用屬性 myDescription 新增至基礎定義。已在「類型及屬性管理」公用程式中定義 myMechanical 零件,其屬性為 myCost 和 myWeight;已將 WTPartUsageLink 延伸為擁有可重新使用屬性 myColor。
執行將新 myMechanical 零件插入組件的步驟後,這些畫面就會顯示。
「插入新的」精靈會顯示可實例化類型的下拉選單。使用者選取 "myMechanical" 零件。
指定「名稱」及其他內容後,精靈中的最後一個步驟會提示可重新使用屬性,雖然「屬性」欄可排序,但不能控制預設順序。
myMechanical 零件的「資訊」標籤可顯示所有屬性,但無任何特定顯示順序。位於顯示畫面上半部的屬性顯示可識別該物件的固定設定;其中某些屬性可能互不相關。位於可編輯表格下半部的屬性包括繼承自 WTPart 的屬性,且順序不定。
myColor 屬性不會顯示在「使用標籤」中,但對使用者檢視具備其他 UsageLink 屬性的值來說,可能相當實用。
透過自訂 PSE XML 檔案,您可明確定義這些屬性,使其顯示以供使用者檢視。這通常會影響「資訊標籤」、「零件建立」及「插入」精靈。
範圍/適用性/假設
由於這些變更是針對 PSE XML 檔案所做的,因此它們適用於所有 PSE 使用者。
預期結果
考慮上述範例。
指定「新建零件」的屬性時,精靈最後一個步驟中的屬性會以 PSE XML 檔案中定義的順序顯示。
「資訊」標籤下半部表格中的屬性也可排序。
可將「使用 BOM 表格」配置為顯示「使用關係連結」屬性。
解決方案
若是 dataType,用前後關聯應用程式 "ptc.wnc.StructureExplorer" 定義新的 ExplorerElementGroup。在此元素內,定義「屬性表格」的內容。
若您執行此自訂作業,您可能已定義了許多種類型的 WTPart。雖然可將這些元素定義新增至檔案
<Windchill>/codebase/config/logicrepository/xml/explorer/structureexplorer/Explorer ForTablesAndPanels.xml
此檔案會變得愈來愈大,因此難以識別客戶副檔名。因此,建議使用者依可變零件類型建立檔案,來保存自訂檔案。
針對每個 dataType 定義 ID 為 ptc.wnc.exp.CreatPartTab3、ptc.wnc.exp.CreatePartNoUsageLinkTab3 和 ptc.wnc.exp.EditPropertiesTable 的 AttributeTable。
在 ExplorerForTablesAndPanels.xml 中納入 ID 為 ptc.wnc.exp.PartUsesLinkTable 的表格的相應 CellDefinition,即可在「使用標籤」中新增屬性。
必備知識
欲達成此目標,您需瞭解下列事項:
XML 檔案自訂的管理
解決方案元素
元素
類型
描述 (Description)
ExplorerForTableAn dPanels.xml
XML 檔案
保留 PSE 表格與面板的定義
位於:
<Windchill>/codebase/config/logicreposi
tory/xml/structureexplore
LogicContext
XML 元素
指定待套用定義的應用程式和資料類型
AttributeTable
XML 元素
已定義屬性表與內容
CellDefinition
XML 元素
將顯示在 AttributeTable 中的具備相應行為的屬性。
Placement remove="true"
XML 元素
Remove=true 用於阻止內容因繼承而顯示。
程序
在下列目錄中建立表示可變零件 (myMechanical.xml) 的新檔案:
Windchill>/codebase/config/logicrepository/xml/explorer/structureexplorer
並插入下列行,或將 ExplorerElementGroup 新增至
Windchill>/codebase/config/logicrepository/xml/explorer/structure
explorer/ExplorerForTablesAndPanels.xml
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE LogicRepository SYSTEM
"/config/logicrepository/dtd/LogicRepository.dtd">
<LogicRepository>
<ExplorerElementGroup>
<LogicContext application="ptc.wnc.StructureExplorer"
dataType="com.aprilia.www.myMechanical"/>
<AttributeTable id="ptc.wnc.exp.CreatePartTab3">
<Table id="Table" displayMode="edit">
<!-- These 3 entries remove the inherited entries from WTPart -->
<CellDefinition id="ALL_SOFT_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="ALL_SOFT_CLASSIFICATION_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition
id="ALL_SOFT_USAGE_LINK_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<!-- Add the entries for attributes on Parts and UsageLink in
the specific order -->
<CellDefinition id="myDescription">
<AttributeDefinition
attributeId="com.aprilia.www.myDescription"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myColor">
<AttributeDefinition
attributeId="com.aprilia.www.myColor"
imageName="com/ptc/windchill/explorer/config/images/uses
Tab.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myCost">
<AttributeDefinition
attributeId="com.aprilia.www.myCost"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myWeight">
<AttributeDefinition
attributeId="com.aprilia.www.myWeight"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
</Table>
<Import id="ptc.wnc.exp.NewObjectAttrTableAA"/>
</AttributeTable>
<AttributeTable
id="ptc.wnc.exp.CreatePartNoUsageLinkTab3">
<Table id="Table" displayMode="edit">
<!-- These 2 entries remove the inherited entries from WTPart -->
<CellDefinition id="ALL_SOFT_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="ALL_SOFT_CLASSIFICATION_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<!-- Add the entries for attributes on Parts in the specific order -->
<CellDefinition id="myDescription">
<AttributeDefinition attributeId="com.aprilia.www.myDescription"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myCost">
<AttributeDefinition
attributeId="com.aprilia.www.myCost"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myWeight">
<AttributeDefinition
attributeId="com.aprilia.www.myWeight"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
</Table>
<Import id="ptc.wnc.exp.NewObjectAttrTableAA"/>
</AttributeTable>
<AttributeTable id="ptc.wnc.exp.EditPropertiesTable">
<Table id="Table" displayMode="edit">
<!-- These 3 entries remove the inherited entries from WTPart -->
<CellDefinition id="source">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="partType">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="ALL_SOFT_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="ALL_SOFT_CLASSIFICATION_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition>
id="ALL_SOFT_USAGE_LINK_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<!-- Add the entries for attributes on Parts and UsageLink in the
specific order -->
<CellDefinition id="myDescription">
<AttributeDefinition
attributeId="com.aprilia.www.myDescription"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myColor">
<AttributeDefinition
attributeId="com.aprilia.www.myColor"
imageName="com/ptc/windchill/explorer/config/images/usesTab.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myCost">
<AttributeDefinition
attributeId="com.aprilia.www.myCost"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myWeight">
<AttributeDefinition
attributeId="com.aprilia.www.myWeight"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
</Table>
<Import id="ptc.wnc.exp.EditPropertiesTableAA"/>
</AttributeTable>
</ExplorerElementGroup>
</LogicRepository>
此舉會導致在「精靈」和「資訊標籤」中請求的屬性如「預期結果」部份所示。
欲將可重新使用屬性新增至「使用標籤」,請編輯:
Windchill>/codebase/config/logicrepository/xml/explorer/structure
explorer/ExplorerForTablesAndPanels.xml
找出 ID 為 ptc.wnc.exp.PartUsesLinkTabTable 的表格項目並新增:
<CellDefinition id="myColor" displayModeOverride="edit">
<AttributeDefinition attributeId="com.aprilia.www.myColor">
<Import id="ptc.wnc.exp.AssocAttrAction"/>
</AttributeDefinition>
</CellDefinition>
* 
必須完整參照,或使用您已定義的邏輯屬數參照已針對除 WTPart 之外的某物件定義的任何 <AttributionDefinition>。
必須重新啟動應用伺服器,才能套用這些變更。
進一步自訂
欲延伸上述範例,可考慮將 "myDescription" 屬性新增至「使用標籤」。編輯此「字串」屬性時,使用者可能需要指定許多字元,但要在表格內的儲存格空間中執行此作業並不容易。因此,可將不同的顯示程式關聯至此屬性,在編輯此屬性的值時會快顯一個對話方塊,可供使用者輸入許多文字行。
編輯:
Windchill>/codebase/config/logicrepository/xml/explorer/structure
explorer/ExplorerForTablesAndPanels.xml
找出 ID 為 ptc.wnc.exp.PartUsedLinkTabTable 的表格項目並新增:
<CellDefinition id="myDescription" displayModeOverride="edit">
<AttributeDefinition attributeId="com.aprilia.www.myDescription"
rendererClass="com.ptc.windchill.explorer.structureexplorer.renderer.component.
MultilineStringComponent">
<Import id="ptc.wnc.exp.AssocAttrAction"/>
</AttributeDefinition>
</CellDefinition>
只要使用 Golf Cart 作為範例,如此一來,在儲存格中選取 "…" 按鈕時,下列對話方塊即會顯示。
也可將此顯示程式套用至「資訊標籤」中的屬性。
自訂點
在「背景」部份,LogicalAttributes.xml 中定義的許多特殊屬性可供 PSE 針對單一定義顯示許多屬性。包括:
邏輯形式
描述
ALL_SOFT_ATTRIBUTES
持續保留在物件上的所有可重新使用屬性
ALL_SOFT_CLASSIFICATION_ATT RIBUTES
與物件的分類相關聯的所有可重新使用屬性。
ALL_SOFT_NON_SCHEMA_ATTRI BUTES
持續保留在物件上但與物件類型不相關的所有可重新使用屬性。
ALL_SOFT_SCHEMA_ATTRIBUTES
與物件類型相關聯的所有可重新使用屬性。
ALL_SOFT_NON_CLASSIFICATION _SCHEMA_ATTRIBUTES
與物件類型相關聯但與物件的分類不相關的所有可重新使用屬性。
ALL_SOFT_NON_CLASSIFICATION _ATTRIBUTES
持續保留在物件上但與物件的分類不相關的所有可重新使用屬性
ALL_SOFT_USAGE_LINK_SCHEMA _ATTRIBUTES
在零件前後關聯中,與零件使用連結類型相關聯的零件使用連結上的所有可重新使用屬性
ALL_SOFT_SCHEMA_ATTRIBUTES _FOR_INPUT_TYPE
與篩選器中指定的類型相關聯的所有可重新使用屬性,它們可能是實際物件的超級類型
在修訂版本 9 中,PSE 在「資訊」標籤屬性表格的定義 (及「資訊」標籤的「新建」對話方塊) 中使用下列內容:
ALL_SOFT_SCHEMA_ATTRIBUTES
ALL_SOFT_CLASSIFICATION_ATTRIBUTES
ALL_SOFT_USAGE_LINK_SCHEMA_ATTRIBUTES
使用 "ALL_SOFT_ATTRIBUTES" 而非 ALL_SOFT_SCHEMA_ATTRIBUTES,或新增 ALL_SOFT_NON_SCHEMA_ATTRIBUTES 項目,即可顯示以程式方式從 CAD 填入的屬性。