NX二次开发-NX11创建表达式组NXOpen::ExpressionGroup
NX11+VS2013 #include <uf.h>
#include <uf_modl.h>
#include <uf_part.h>
#include <uf_ui.h>
#include <NXOpen/ExpressionGroup.hxx>
#include <NXOpen/ExpressionGroupCollection.hxx>
#include <NXOpen/NXObjectManager.hxx>
#include <NXOpen/Unit.hxx>
#include <NXOpen/UnitCollection.hxx>
#include <NXOpen/Update.hxx>
#include <uf_group.h> UF_initialize(); int number_of_exps = ;
tag_t * expsTag = NULL_TAG;
UF_MODL_ask_exps_of_part(UF_PART_ask_display_part(), &number_of_exps, &expsTag); if (number_of_exps == )
{
//创建表达式
tag_t DCTag = NULL_TAG;
UF_MODL_create_exp_tag("DC=20", &DCTag);
NXOpen::Expression *expressionDC(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(DCTag)));
expressionDC->EditComment("工作直径"); tag_t DMMTag = NULL_TAG;
UF_MODL_create_exp_tag("DMM=20", &DMMTag);
NXOpen::Expression *expressionDMM(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(DMMTag)));
expressionDMM->EditComment("柄部直径"); tag_t DNTag = NULL_TAG;
UF_MODL_create_exp_tag("DN=19", &DNTag);
NXOpen::Expression *expressionDN(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(DNTag)));
expressionDN->EditComment("颈部直径"); tag_t OALTag = NULL_TAG;
UF_MODL_create_exp_tag("OAL=100", &OALTag);
NXOpen::Expression *expressionOAL(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(OALTag)));
expressionOAL->EditComment("刀具总长"); tag_t LFTag = NULL_TAG;
UF_MODL_create_exp_tag("LF=100", &LFTag);
NXOpen::Expression *expressionLF(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(LFTag)));
expressionLF->EditComment("刀具高度"); tag_t LUTag = NULL_TAG;
UF_MODL_create_exp_tag("LU=30", &LUTag);
NXOpen::Expression *expressionLU(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(LUTag)));
expressionLU->EditComment("工作长度"); tag_t LCFTag = NULL_TAG;
UF_MODL_create_exp_tag("LCF=40", &LCFTag);
NXOpen::Expression *expressionLCF(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(LCFTag)));
expressionLCF->EditComment("槽长"); tag_t SGATag = NULL_TAG;
UF_MODL_create_exp_tag("SGA=120", &SGATag);
NXOpen::Expression *expressionSGA(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(SGATag)));
expressionSGA->EditComment("角度"); tag_t WFTag = NULL_TAG;
UF_MODL_create_exp_tag("WF=20", &WFTag);
NXOpen::Expression *expressionWF(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(WFTag)));
expressionWF->EditComment("工作宽度"); tag_t CDXITag = NULL_TAG;
UF_MODL_create_exp_tag("CDXI=10", &CDXITag);
NXOpen::Expression *expressionCDXI(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(CDXITag)));
expressionCDXI->EditComment("切削长度"); tag_t CWTag = NULL_TAG;
UF_MODL_create_exp_tag("CW=3", &CWTag);
NXOpen::Expression *expressionCW(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(CWTag)));
expressionCW->EditComment("切削宽度"); //添加到vector
std::vector<NXOpen::Expression*> Exp1;
Exp1.push_back(expressionDC);
Exp1.push_back(expressionDMM);
Exp1.push_back(expressionDN);
Exp1.push_back(expressionOAL);
Exp1.push_back(expressionLF);
Exp1.push_back(expressionLU);
Exp1.push_back(expressionLCF);
Exp1.push_back(expressionSGA);
Exp1.push_back(expressionWF);
Exp1.push_back(expressionCDXI);
Exp1.push_back(expressionCW); //创建表达式组
NXOpen::ExpressionGroup *expressionGroup1;
expressionGroup1 = workPart->ExpressionGroups()->Create("刀杆参数");
expressionGroup1->SetExpressions(Exp1); //创建表达式
NXOpen::Expression *expressiondp_scpe;
expressiondp_scpe = workPart->Expressions()->CreateExpression("String", "dp_scpe=\"A\"");
expressiondp_scpe->EditComment("刀片规格"); tag_t W1Tag = NULL_TAG;
UF_MODL_create_exp_tag("W1=0", &W1Tag);
NXOpen::Expression *expressionW1(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(W1Tag)));
expressionW1->EditComment("刀片内切圆"); tag_t S1Tag = NULL_TAG;
UF_MODL_create_exp_tag("S1=0", &S1Tag);
NXOpen::Expression *expressionS1(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(S1Tag)));
expressionS1->EditComment("刀片厚度"); //添加到vector
std::vector<NXOpen::Expression*> Exp2;
Exp2.push_back(expressionW1);
Exp2.push_back(expressionS1);
Exp2.push_back(expressiondp_scpe); //创建表达式组
NXOpen::ExpressionGroup *expressionGroup2;
expressionGroup2 = workPart->ExpressionGroups()->Create("刀片参数");
expressionGroup2->SetExpressions(Exp2); //创建表达式
tag_t A1Tag = NULL_TAG;
UF_MODL_create_exp_tag("A1=SIN(30)", &A1Tag);
NXOpen::Expression *expressionA1(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(A1Tag))); tag_t A2Tag = NULL_TAG;
UF_MODL_create_exp_tag("A2=COS(30)", &A2Tag);
NXOpen::Expression *expressionA2(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(A2Tag))); tag_t A3Tag = NULL_TAG;
UF_MODL_create_exp_tag("A3=TAN(30)", &A3Tag);
NXOpen::Expression *expressionA3(dynamic_cast<NXOpen::Expression *>(NXOpen::NXObjectManager::Get(A3Tag))); //添加到vector
std::vector<NXOpen::Expression*> Exp3;
Exp3.push_back(expressionA1);
Exp3.push_back(expressionA2);
Exp3.push_back(expressionA3); //创建表达式组
NXOpen::ExpressionGroup *expressionGroup3;
expressionGroup3 = workPart->ExpressionGroups()->Create("计算参数");
expressionGroup3->SetExpressions(Exp3); //创建表达式
NXOpen::Expression *expressionh_type;
expressionh_type = workPart->Expressions()->CreateExpression("String", "h_type=\"weldon\"");
expressionh_type->EditComment("柄部规格"); NXOpen::Unit *nullNXOpen_Unit(NULL);
NXOpen::Expression *expressionA4;
expressionA4 = workPart->Expressions()->CreateWithUnits("A4=if(h_type==\"weldon\") 1 else 0", nullNXOpen_Unit); //添加到vector
std::vector<NXOpen::Expression*> Exp4;
Exp4.push_back(expressionh_type);
Exp4.push_back(expressionA4); NXOpen::ExpressionGroup *expressionGroup4;
expressionGroup4 = workPart->ExpressionGroups()->Create("表达式抑制");
expressionGroup4->SetExpressions(Exp4); } else
{
uc1601("当前part已存在表达式,此命令不能使用", );
} UF_free(expsTag); UF_terminate();
NX二次开发-NX11创建表达式组NXOpen::ExpressionGroup的更多相关文章
- NX二次开发-UFUN创建表达式UF_MODL_create_exp无TAG
NX9+VS2012 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建一个新的表达式,无TAG UF_MOD ...
- NX二次开发-UFUN创建表达式UF_MODL_create_exp_tag有TAG
NX9+VS2012 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建一个新的表达式,无TAG UF_MOD ...
- NX二次开发-UFUN导入表达式UF_MODL_import_exp
最近在做表达式创建,发现UFUN的创建表达式函数UF_MODL_create_exp,UF_MODL_create_exp_tag没有办法创建字符串类型的表达式,例如AA="BB" ...
- NX二次开发-UFUN输入表达式TAG,得到表达式字符串UF_MODL_ask_exp_tag_string
NX9+VS2012 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建表达式 tag_t NewExpTag ...
- NX二次开发-UFUN输入表达式TAG,得到表达式值UF_MODL_ask_exp_tag_value
NX9+VS2012 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建表达式 tag_t NewExpTag ...
- NX二次开发-UFUN创建圆柱UF_MODL_create_cyl1
NX9+VS2012 #include <uf.h> #include <uf_modl.h> #include <uf_obj.h> #include <u ...
- NX二次开发-UFUN创建球UF_MODL_create_sphere1
NX11+VS2013 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建球 UF_FEATURE_SIGN ...
- NX二次开发-UFUN创建圆锥UF_MODL_create_cone1
NX11+VS2013 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建圆锥 UF_FEATURE_SIGN ...
- NX二次开发-UFUN创建镜像体UF_MODL_create_mirror_body
NX11+VS2013 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建块 UF_FEATURE_SIGN ...
随机推荐
- 关于SQL中 =:的含义
一个很恶臭的例子来说明 =: 在sql语句中是做什么用的 int number= 114514: //众所周知野兽先辈的咆哮(世界级美声)是一串数字 var strSql = "select ...
- foreach循环的跳出
由于foreach循环中不像for循环可以直接通过return或break来终止当前循环,不过这里可以借助try...catch...来完成var arr = [1,2,3,4,5,6,7,8,9,1 ...
- NOIP2019模拟2019.9.20】膜拜大会(外向树容斥,分类讨论)
传送门. 题解: 我果然是不擅长分类讨论,心态被搞崩了. 注意到\(m<=n-2\),意味着除了1以外的位置不可能被加到a[1]两遍. 先考虑个大概: 考虑若存在\(x,x-1,-,2\)(有序 ...
- Delphi内建异常类 异常处理参考
标签: delphiexceptionwindowscasting编程integer 2012-05-19 12:53 2579人阅读 评论(0) 收藏 举报 分类: Delphi(96) [详细过程 ...
- 【BZOJ1084】dp
题目很简单 分析蛮无聊的一道题.状态转移十分显然然后就做完了. #include <bits/stdc++.h>#define sc(n) scanf("%d",&am ...
- (转)openfire插件开发(一)
转:http://blog.csdn.net/lovexieyuan520/article/details/37774909 1. 在上一篇博文中,我介绍了Openfire3.9.3源代码导入ecli ...
- /etc/X11/xorg.conf
# This configuration file was broken by system-config-keyboard Section "ServerLayout" Iden ...
- Shell基本正则表达式和扩展正则表达式
BRE和ERE的区别 基本正则表达式(BRE)和扩展正则表达式(ERE)的区别仅仅是元字符(meta charactor)的区别而已. BRE: 只有^$.*[]是元字符 ERE: ^$.[]*+() ...
- phpMailer 手册
phpMailer5.0.0属性: 英文地址:http://phpmailer.worxware.com/index.php?pg=properties 属性 (v5.0.0) 类型 默认 描述 $P ...
- Java-Class-@I:java.annotation.Resource
ylbtech-Java-Class-@I:java.annotation.Resource 1.返回顶部 2.返回顶部 1.1. import javax.annotation.Resource ...