與其他應用程式整合 > 《搭配使用 Creo Parametric 與 Windchill》 > 管理與組態 > 針對與 Creo Parametric 的交互操作性配置 Windchill > 自訂下載服務中的參數
  
自訂下載服務中的參數
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. 重新啟動應用伺服器。