高级自定义 > 业务逻辑自定义 > 使用 Windchill 中的标准进行数据交换 > 使用 EXPRESS 进行 STEP 数据交换 > STEP Foundation > EXPRESS 自定义 > 添加新转换器 > 编写导入转换器
  
编写导入转换器
这是导出操作的逆向过程。
1. 了解如何将汽车设计 (AP214) 架构中的实体或属性映射到 Windchill 架构。
2. 创建一个名为 "ImportWTChangeRequest2.inn" 的新转换器文件,并将其置于 "<WINDCHILL_HOME>\codebase\registry\stepdex\ap214\importxpx\includes" 目录下
3. 为在步骤 2 中创建的内部文件中的对象和属性添加映射。
Versioned_Action_Request 实体 AP214 架构映射到 Windchill 架构中的 WTChangeRequest2 实体
调用 updateRootTag 函数并传递 Windchill 实体名称。(这有助于标识要导入的列表对象。)
Versioned_Action_Request 中的 Id 属性映射到与 WTChangeRequest2 实体相关联的相对部件 r_number 属性。
下图描述了如何映射这些属性
(*
Maps versioned_action_request to e_WTChangeRequest2.
*)
MAP xpxmChange FOR wtChange:wnc::e_WTChangeRequest2;
FROM (ver_act:aim::versioned_action_request)
WHEN TRUE;
BEGIN_MAP
LOCAL
--Local variables
END_LOCAL

-- Update roor tag in importList.
updateRootTag('e_WTChangeRequest2;);
wt_change.r_number := ver_act.id;

END MAP;
4. 将转换器文件注册/包括在导出特定的项目文件 (AP214TOWNC.xpxprj) 中,如以下代码所示。
(*
XPX Project file for AP214 to Windchill import mapping. This should contain source?_files definition one Main file followed by all includes files source.
*)

SOURCE FILES

"AP214TOWNC.xpx" --Main file

"includes/ImportWTPart.inn"
"includes/ImportWTDocument.inn"
"includes/ImportEPMDocument.inn"
"includes/ImportWTChangeRequest2.inn"
"includes/ImportHandlePropertyDefinition.inn"
"includes/ProcessAppliedDocumentReference.inn"
"includes/ImportRepresentation.inn"
"includes/ImportWTPartUsageLink.inn"
"includes/ImportWTPartDescribeLink.inn"
"includes/ImportWTPartReferenceLink.inn"
"includes/ImportEPMMemberLink.inn"
"includes/ImportEPMDescribeLink.inn"
"includes/ImportEPMReferenceLink.inn"
"includes/ImportContentItem.inn"
"includes/ImportGlobalFunctions.inn"
"includes/ImportOrganization.inn"
"includes/ImportBusinessFields.inn"
"includes/ImportUnitUtils.inn"
"./../ includes/StringUtils.inn"
"./../ includes/AggregateUtils.inn"
"./../ includes/DateTimeUtil.inn"
"./../ includes/import/ImportUtil.inn"
"./../ includes/import/ImportWTPartAttributes.inn"
"./../ includes/import/ImportVersionObject.inn"
"./../ includes/import/ImportLifeCycleObject.inn"
"./../ includes/import/ImportBusinessFields.inn"
"./../ includes/import/ImportContentItemAttributes.inn"
"./../ includes/import/ImportWTDocumentAttributes.inn"
"./../ includes/import/ImportWTPartDescribeLink.inn"
"./../ includes/import/ImportRepresentation.inn"
END_SOURCE_FILES