与其他应用程序集成 > Creo Parametric – Windchill 集成 > 管理和配置 > 配置 Windchill 与 Creo Parametric 的互操作性 > 自定义下载服务中的参数
  
自定义下载服务中的参数
Windchill 提供了一个服务器端委派,可用于在下载时向 Creo Parametric 模型插入参数。这种机制可用于将信息从服务器传送到 Creo Parametric,在其中可像其他所有 Creo Parametric 参数一样使用这些信息 (例如,在绘图表单上填充信息)。以 "PTC" 或 "PROI" 开始的参数被视为保留的系统参数,不能通过自定义进行传播。如果在自定义中添加这些参数,下载服务会将其忽略。
* 
此功能适用于所有与第三方 CAD 工具集成的 Windchill Workgroup Manager
* 
自定义的参数在下载时提供给客户端,与系统参数 (如 PTC_WM_ITERATION) 不同,它们不会在执行某个 Creo Parametric 操作 (例如,检入) 后,在 Windchill 会话或本地缓存中得到更新。
例如,如果某个自定义参数分配了 CAD 文档编号的值,其值会在模型下载时提供给客户端。如果后来对 CAD 文档进行了重编号,则 Creo Parametric 会话或客户端缓存中的值不会自动更新。
Windchill 服务委派机制用于实现自定义。以下步骤说明自定义过程:
1. 创建一个实现接口 ModeledAttributesDelegate 的 Java 类。接口定义如下:
package com.ptc.windchill.uwgm.proesrv.c11n;
import java.util.Collection;
import java.util.HashMap;
import wt.util.WTException;
public interface ModeledAttributesDelegate
{
/*
Implement this API to return list of parameters added by
customization along with it's type (customization profile of the
server). For example "WT_CADDOC_NUMBER" custom parameter will
be of type "String.class" (the java class)
*/
// getAvailableAttributes() returns
// HashMap<String, Object> which contains
// HashMap<Attribute name, Attribute type>
HashMap getAvailableAttributes();
/*
This is the API, invoked by the download service on download, to
be implemented for the customization. Create and return a
HashMap where key is input object and value is HashMap of
parameter name - value pairs that must be propagated to Pro/E
part represented by the EPMDocument (input object). Use the
getCADName() API on the EPMDocument to identify the Pro/E part
*/
// getModeledAttributes(Collection docs) returns
// HashMap<input object, HashMap<Attribute name, Attribute
value> HashMap getModeledAttributes(Collection docs) throws
WTException;
}
2. 编辑 site.xconf 文件 (位于 <Windchill> 中) 来添加以下属性,以指出自定义服务在服务器中的可用性:
<Service context="default"
name="com.ptc.windchill.uwgm.proesrv.c11n.ModeledAttributesDele
gate" targetFile=codebase/service.properties">
<Option cardinality="singleton"
requestor="java.lang.Object"
serviceClass="com.ptc.windchill.uwgm.proesrv.c11n.DefaultModele
dAttributesDelegate"/>
</Service>
然后,通过 xconfmanager 工具将更改应用于 service.properties 文件 (运行 xconfmanager -p)
使用类路径代替 serviceClass 的值 (即,使用该类的路径替换 com.ptc.windchill.uwgm.proesrv.c11n.DefaultModeledAttributesDelegate)。
3. 重新启动方法服务器。