基本自定义 > Windchill 自定义基础 > 自定义教程 > 示例:从模型化主数据类创建具有衍生属性的模型化对象
示例:从模型化主数据类创建具有衍生属性的模型化对象
请考虑一个包含一个属性 masterAtt1 的模型化类型 ext.ts.part.TSPart 的示例,该属性是从主数据属性 ext.ts.part.TSPartMaster>>masterAtt1 衍生而来。
derivedProperties={
@DerivedProperty(name="masterAtt1", derivedFrom="master>masterAtt1")
}
在 <WT_HOME>\codebase\LogicalAttributes.xml 中,创建一个新条目 <Class name="ext.ts.part.TSPart">。
1. 添加衍生属性的逻辑形式。
2. 复制 wt.part.WTPart 中包含 MBA|masterReference^WCTYPE|wt.part.WTPartMaster〜MBA 的每个条目。
3. 对于这些重复条目,请将 wt.part.WTPartMaster 替换为 ext.ts.part.TSPartMaster。例如:
<Class name="ext.ts.part.TSPart">
<!-- custo derived attributes -->
<Property>
<LogicalForm>masterAtt1</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|ext.ts.part.TSPartMaster~MBA|masterAtt1</ExternalForm>
</Property>
<!-- duplicates from wt.part.WTPart which involve MBA|masterReference^WCTYPE|wt.part.WTPartMaster -->
<Property>
<LogicalForm>defaultTraceCode</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|ext.ts.part.TSPartMaster~MBA|defaultTraceCode</ExternalForm>
</Property>
...
</Class>
这对您有帮助吗?