引流推广网站,自媒体seo优化,陕西秦地建设有限公司网站,免费手机网站源码一、概述 在NX二次开发的学习中#xff0c;浏览博客时发现看到[社恐猫]和[王牌飞行员_里海]这两篇博客中写道有关信息窗口内容的打印和将窗口内容保存为txt,个人人为在二次开发项目很有必要#xff0c;因此做以下记录。 ListingWindow信息窗口发送信息四种位置类型 设置Listi…一、概述 在NX二次开发的学习中浏览博客时发现看到[社恐猫]和[王牌飞行员_里海]这两篇博客中写道有关信息窗口内容的打印和将窗口内容保存为txt,个人人为在二次开发项目很有必要因此做以下记录。 ListingWindow信息窗口发送信息四种位置类型 设置ListingWindow信息窗口发送信息的位置
二、显示类型
2.1信息只显示在ListingWindow信息窗口 关键代码 UF_initialize();//启动计时器UF_timer_t timer { 0 };UF_begin_timer(timer);//创建块UF_FEATURE_SIGN sign UF_NULLSIGN;double corner_pt[3] { 0.0, 0.0, 0.0 };char * edge_len[3] { 100, 100, 100 }; tag_t blk_obj_id NULL_TAG;UF_MODL_create_block1(sign, corner_pt, edge_len, blk_obj_id);//结束计时器UF_timer_values_t ValueTime { 0 };UF_end_timer(timer, ValueTime);//打印统计信息std::ostringstream temp;temp 耗时cpu time: ValueTime.cpu_time \n 耗时real time: ValueTime.real_time \n提示:保存信息窗口内容至: D:\\GetRunningTime.txt;std::string tempStr temp.str();NXOpen::Session* theSession NXOpen::Session::GetSession();NXOpen::ListingWindow* list theSession-ListingWindow();list-SelectDevice(NXOpen::ListingWindow::DeviceType::DeviceTypeWindow,);//默认类型可省略if (!list-IsOpen()) list-Open();list-WriteLine(tempStr.c_str());list-Close();UF_terminate();
2.2信息只保存在ListingWindow窗口D:\\GetRunningTime.txt 关键代码 UF_initialize();//启动计时器UF_timer_t timer { 0 };UF_begin_timer(timer);//创建块UF_FEATURE_SIGN sign UF_NULLSIGN;double corner_pt[3] { 0.0, 0.0, 0.0 };char * edge_len[3] { 100, 100, 100 }; tag_t blk_obj_id NULL_TAG;UF_MODL_create_block1(sign, corner_pt, edge_len, blk_obj_id);//结束计时器UF_timer_values_t ValueTime { 0 };UF_end_timer(timer, ValueTime);//打印统计信息std::ostringstream temp;temp 耗时cpu time: ValueTime.cpu_time \n 耗时real time: ValueTime.real_time \n提示:保存信息窗口内容至: D:\\GetRunningTime.txt;std::string tempStr temp.str();NXOpen::Session* theSession NXOpen::Session::GetSession();NXOpen::ListingWindow* list theSession-ListingWindow();//信息只保存在ListingWindow窗口D:\\GetRunningTime.txtlist-SelectDevice(NXOpen::ListingWindow::DeviceType::DeviceTypeFile, D:\\GetRunningTime.txt);if (!list-IsOpen()) list-Open();list-WriteLine(tempStr.c_str());list-Close();list-SelectDevice(NXOpen::ListingWindow::DeviceType::DeviceTypeWindow, );UF_terminate();
2.3信息显示在ListingWindow窗口并保存信息内容至D:\\GetRunningTime.txt 关键代码 UF_initialize();//启动计时器UF_timer_t timer { 0 };UF_begin_timer(timer);//创建块UF_FEATURE_SIGN sign UF_NULLSIGN;double corner_pt[3] { 0.0, 0.0, 0.0 };char * edge_len[3] { 100, 100, 100 }; tag_t blk_obj_id NULL_TAG;UF_MODL_create_block1(sign, corner_pt, edge_len, blk_obj_id);//结束计时器UF_timer_values_t ValueTime { 0 };UF_end_timer(timer, ValueTime);//打印统计信息std::ostringstream temp;temp 耗时cpu time: ValueTime.cpu_time \n 耗时real time: ValueTime.real_time \n提示:保存信息窗口内容至: D:\\GetRunningTime.txt;std::string tempStr temp.str();NXOpen::Session* theSession NXOpen::Session::GetSession();NXOpen::ListingWindow* list theSession-ListingWindow();//信息显示在ListingWindow窗口并保存信息内容至D:\\GetRunningTime.txtlist-SelectDevice(NXOpen::ListingWindow::DeviceType::DeviceTypeFileAndWindow, D:\\GetRunningTime.txt);if (!list-IsOpen()) list-Open();list-WriteLine(tempStr.c_str());list-Close();list-SelectDevice(NXOpen::ListingWindow::DeviceType::DeviceTypeWindow,);UF_terminate();
2.4DeviceType::DeviceTypeNone既不显示在ListingWindow窗口也不保存信息至D:\\GetRunningTime.txt这里不进行说明。