大家好,今天要讲的是关于NX中表达式的相关UFUN函数。
UF_MODL_ask_exps_of_part (view source)
tag_t | part_tag | Input | Tag of the part to be queried |
int * | number_of_exps | Output | Number of expressions returned |
tag_t * * | exps | Output to UF_*free* | All the expressions in the part. Use UF_free to deallocate memory. |
下面使用一个例子讲解一下:
Dictionary<string, string> keys = new Dictionary<string, string>();
int expnumber = 0;
Tag[] tags;
theUfSession.Modl.AskExpsOfPart(workPart.Tag,out expnumber,out tags);
for (int i = 0; i < expnumber; i++)
{
string expname = "";
theUfSession.Modl.AskExpTagString(tags[i], out expname);
if(!keys.ContainsKey(expname))
{
keys.Add(expname, expname);
}
}
上面就是将所有的表达式获取出来以后存储在一个字典中。
下面介绍如何更改表达式的值:
UF_MODL_edit_exp (view source)
char * | expr_str | Input | Replacement expression. |
下面还是用一个例子来讲解如何使用:
if (keys[i].Contains("例子1"))
{
theUfSession.Modl.EditExp("例子1=" + string016.Value);
}
当然在这里更新完表达式的值以后,一定要使用theUfSession.Modl.Update();
UF_MODL_update (view source)
Defined in: uf_modl.h
Overview
Updates a part. You call this routine after you use UF_MODL_import_exp,
UF_MODL_edit_exp, and UF_MODL_move_feature. Imported and edited expressions
do not take effect until you update the part. After you move a feature, please
update the database.
Environment Internal and External
Required License(s) solid_modelingint UF_MODL_update(void)
今天要介绍的就是这么多,我们下篇文章再见。