• 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_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();

  • 相关阅读:
    C# GDI+图形程序设计看书笔记
    SQL2008转SQL2005
    vb6 调用 .Net Dll
    VS编译后的postevent
    Bind 和 ScaffoldColumn
    转: MarshalAs与StructLayout
    Microsoft .NET Compact Framework 开发常见问题解答
    .Net2.0 使用ConfigurationManager读写配置文件
    在.NET中使用命名管道完成进程间通信[转]
    C# 取电信公网IP并发送邮件
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/10957343.html
Copyright © 2020-2023  润新知