NX二次开发-UFUN遍历函数UF_OBJ_cycle_all

 1     NX11+VS2013
 2
 3     #include <uf.h>
 4     #include <uf_obj.h>
 5     #include <uf_modl.h>
 6     #include <uf_part.h>
 7
 8
 9     UF_initialize();
10
11     //方法1:UF_OBJ_cycle_objs_in_part
12     std::vector<tag_t> SolidVector;
13     tag_t ObjectTag = NULL_TAG;
14     int Type, SubType, Body_Type;
15     char msg[256];
16     UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
17     while (ObjectTag != NULL_TAG)
18     {
19         UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType);
20         if (SubType == UF_solid_body_subtype)
21         {
22             UF_MODL_ask_body_type(ObjectTag, &Body_Type);
23             if (Body_Type == UF_MODL_SOLID_BODY)
24             {
25                 UF_OBJ_set_color(ObjectTag, 186);
26                 SolidVector.push_back(ObjectTag);
27             }
28         }
29         UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
30     }
31
32     sprintf_s(msg, "当前有%d个实体", SolidVector.size());
33     lw->Open();
34     lw->WriteLine(msg);
35
36     /*
37         //方法2:UF_OBJ_cycle_all
38         std::vector<tag_t> SolidVector1;
39         tag_t WorkPartTag = UF_PART_ask_display_part();
40         tag_t Next_Tag = NULL_TAG;
41         int Type1, SubType1, Body_Type1;
42         char msg1[256];
43         do
44         {
45             Next_Tag = UF_OBJ_cycle_all(WorkPartTag, Next_Tag);
46             if (Next_Tag != NULL_TAG)
47             {
48                 UF_OBJ_ask_type_and_subtype(Next_Tag, &Type1,&SubType1);
49                 if (Type1 == UF_solid_type && SubType1 == UF_solid_body_subtype)
50                 {
51                     UF_MODL_ask_body_type(Next_Tag, &Body_Type1);
52                     if (Body_Type1 == UF_MODL_SOLID_BODY)
53                     {
54                         UF_OBJ_set_color(Next_Tag, 200);
55                         SolidVector1.push_back(Next_Tag);
56                     }
57                 }
58             }
59         } while (Next_Tag != NULL_TAG);
60
61     sprintf_s(msg1, "当前有%d个实体", SolidVector1.size());
62     lw->Open();
63     lw->WriteLine(msg1);
64     */
65     UF_terminate();

原文地址:https://www.cnblogs.com/nxopen2018/p/10957347.html

时间: 2024-11-10 00:11:08

NX二次开发-UFUN遍历函数UF_OBJ_cycle_all的相关文章

NX二次开发-UFUN遍历函数UF_OBJ_cycle_objs_in_part

1 NX11+VS2013 2 3 #include <uf.h> 4 #include <uf_obj.h> 5 #include <uf_modl.h> 6 #include <uf_part.h> 7 8 9 UF_initialize(); 10 11 //方法1:UF_OBJ_cycle_objs_in_part 12 std::vector<tag_t> SolidVector; 13 tag_t ObjectTag = NULL_T

NX二次开发-UFUN计时函数UF_end_timer

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_modl.h> 5 6 7 UF_initialize(); 8 9 //计时开始 10 UF_timer_t Timer; 11 UF_begin_timer(&Timer); 12 13 14 //创建块 15 UF_FEATURE_SIGN sign = UF_NULLSIGN; 16 double corner_pt[3] = { 0.0, 0.0, 0.0 }; 17

NX二次开发-UFUN和NXOpen结合开发中Tag_t对象与TaggedObject对象转换方法

1 本文通过举四个例子来告诉大家在NX二次开发过程中会经常用到UFUN和NXOpen结合去开发,在UFUN中我们得到的是Tag_t对象,在NXOpen中得到的是TaggedObject对象,这两个是需要进行转换的.本文主要知识点为:TaggedObject->tag_t() , NXOpen::NXObjectManager::Get(BodyTag1) , feature1->JournalIdentifier()的用法. 2 3 NX11+VS2013 4 5 #include <u

NX二次开发-UFUN按类型遍历名字获取Tag函数UF_OBJ_cycle_by_name_and_type

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <uf_obj.h> 6 #include <uf_part.h> 7 8 9 UF_initialize(); 10 11 //新建工程图(A4图纸) 12 char* DrawingName = "Sheet1";//设置图纸名字 13 UF_DRAW_info_t DrawingInfo;//设置图纸

NX二次开发-UFUN工程图表格注释获取某一行的tag函数UF_TABNOT_ask_nth_row

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>

NX二次开发-UFUN工程图表格注释获取某一行某一列的tag函数UF_TABNOT_ask_cell_at_row_col

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>

NX二次开发-UFUN输出UF函数使用错误UF_get_fail_message

1 #include <uf.h> 2 #include <uf_ui.h> 3 #include <uf_modl.h> 4 5 6 UF_initialize(); 7 8 UF_FEATURE_SIGN sign = UF_NULLSIGN; 9 double corner_pt[3] = { 0.0, 0.0, 0.0 }; 10 char* edge_len[3] = { "", "20", "30"

NX二次开发-UFUN获取显示在NX交互界面的对象UF_OBJ_is_displayable

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_disp.h> 5 #include <uf_obj.h> 6 #include <uf_part.h> 7 8 UF_initialize(); 9 10 //遍历当前显示部件 11 tag_t NextTag = NULL_TAG; 12 int Type1, SubType1; 13 do 14 { 15 NextTag = UF_OBJ_cycle_all

NX二次开发-UFUN读取工程图注释UF_DRF_ask_text_data

1 //NX9_NXOpenCPP_Wizard1 2 3 // Mandatory UF Includes 4 #include <uf.h> 5 #include <uf_object_types.h> 6 7 // Internal Includes 8 #include <NXOpen/ListingWindow.hxx> 9 #include <NXOpen/NXMessageBox.hxx> 10 #include <NXOpen/UI.h