获取阵列(特征)-获取元素树-通过名称获取特定元素-检查元素值
1.1 获取特征
ProSelect("feature", 1, NULL, NULL, NULL, NULL, &sel, NULL);
status = ProSelectionModelitemGet(*sel, &item);
1.2 获取阵列元素树
status = ProPatternElemtreeCreate(&item, PRO_FEAT_PATTERN, &elem_tree)
1.3遍历元素树
status = ProElemtreeElementVisit(elem_tree, path, (ProElemtreeVisitFilter)NULL, (ProElemtreeVisitAction)ProUtilElemtreeElemPrint, NULL);
Action 函数
static ProError ProUtilElemtreeElemPrint(
ProElement elem_tree,
ProElement elem,
ProElempath elem_path,
ProAppData appdata)
{
ProElemId id;
ProError status = PRO_TK_NO_ERROR;
int value;
ProElementIdGet(elem, &id);
if (PRO_E_GENPAT_REGEN_METHOD == id)//id为元素树结点名称
{
ProElementIntegerGet(elem,NULL,&value);
//不同类型应使用不同Get函数 可以搜索ProElementValueGet
}
return PRO_TK_NO_ERROR;
}
其他辅助函数 ProElementArrayCount //统计数量
ProElementArrayGet //注 使用直接获得root结点的话, 顺序目前不清楚 或ProElementChildrenGet