//用户代码
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
void MyClass::do_it()
{
// TODO: add your code here
//用户代码
//遍历工作部件表达式
ExpressionCollection* Expressions = workPart->Expressions();
ExpressionCollection::iterator Exp_All;
char Char_Exp_Val_double[256];
for (Exp_All = Expressions->begin(); Exp_All != Expressions->end(); ++Exp_All)
{
Expression* Exp1 = dynamic_cast
NXString Exp_Name1 = Exp1->Name();//获取表达式名字
NXString Exp_Type = Exp1->Type();//获取表达式类型
theSession->ListingWindow()->Open();
//theSession->ListingWindow()->WriteLine(Exp_Name1 + "表达式类型:" + Exp_Type );
//std::vector
if (strcmp(Exp_Type.GetLocaleText(), "String") == 0)
{
theSession->ListingWindow()->WriteLine("字符串表达式:" + Exp_Name1 + " = " );
}
else if (strcmp(Exp_Type.GetLocaleText(), "Number") == 0)
{
double Exp_Val_double = Exp1->Value();
sprintf(Char_Exp_Val_double, "%.2f", Exp_Val_double);
theSession->ListingWindow()->WriteLine("数量表达式:" + Exp_Name1 + " = " + Char_Exp_Val_double);
}
}
}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章