其他 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 文件自定义的管理
解决方案元素
元素
类型
说明
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 填充的属性。