NX二次开发-获取加工导航器上选中刀具或工序的所有paramIndex值

NX二次开发-获取加工导航器上选中刀具或工序的所有paramIndex值

  • 由于paramIndex的值可能会很大,所以在代码里获取五万以内的paramIndex所对应的参数值。
 1 void  GetCamObjParamInfo()
 2 {
 3     int objectCount = 0;
 4     tag_t *objects;
 5     UF_UI_ONT_ask_selected_nodes(&objectCount, &objects);
 6 
 7     for (int i = 0; i < 50000; ++i)
 8     {
 9         int value = 0;
10         UF_PARAM_ask_int_value(objects[0], i, &value);
11         PrintMsg(NXCommon::IntToStr(i) + " = " + NXCommon::IntToStr(value));
12 
13         char valueA[MAX_LINE_BUFSIZE] = { 0.0 };
14         UF_PARAM_ask_str_value(objects[0], i, valueA);
15         PrintMsg(NXCommon::IntToStr(i) + "=" + valueA);
16 
17 
18         double valueB = 0.0;
19         UF_PARAM_ask_double_value(objects[0], i, &valueB);
20         PrintMsg(NXCommon::IntToStr(i) + " = " + NXCommon::DoubleToStr(valueB));
21 
22         logical valueC = false;
23         UF_PARAM_ask_logical_value(objects[0], i, &valueC);
24         if (valueC)
25         {
26             PrintMsg(NXCommon::IntToStr(i) + " = true");
27         }
28         else
29         {
30             PrintMsg(NXCommon::IntToStr(i) + " = false");
31         }
32 
33         tag_t valueD;
34         UF_PARAM_ask_tag_value(objects[0], i, &valueD);
35         PrintMsg(NXCommon::IntToStr(i) + " = " + NXCommon::IntToStr(valueD));
36     }
37 }
38
 1 void PrintMsg(string input)
 2 {
 3     Session *theSession = NXOpen::Session::GetSession();
 4     ListingWindow *lw = theSession->ListingWindow();
 5     if (!lw->IsOpen())
 6     {
 7         lw->Open();
 8     }
 9 
10     lw->WriteLine(input.c_str());
11 }
  • 最后通过NX里某一个参数具体的值去信息窗口中搜索即可得出paramIndex的值
上一篇:django学习笔记---orm增删改查


下一篇:Django中常用数据操作相关方法与常用查询条件