• NX二次开发-UFUN链表UF_MODL_create_list等用法


     1     NX9+VS2012
     2     
     3     #include <uf.h>
     4     #include <uf_modl.h>
     5     #include <uf_curve.h>
     6     #include <uf_ui.h>
     7     #include <uf_obj.h>
     8 
     9 
    10     UF_initialize();
    11 
    12     //创建直线1
    13     UF_CURVE_line_t LineCoords1;
    14     LineCoords1.start_point[0] = 0.0;
    15     LineCoords1.start_point[1] = 0.0;
    16     LineCoords1.start_point[2] = 0.0;
    17     LineCoords1.end_point[0] = 100.0;
    18     LineCoords1.end_point[1] = 0.0;
    19     LineCoords1.end_point[2] = 0.0;
    20     tag_t Line1Tag[4];
    21     UF_CURVE_create_line(&LineCoords1, &Line1Tag[0]);
    22 
    23     //创建直线2
    24     UF_CURVE_line_t LineCoords2;
    25     LineCoords2.start_point[0] = 100.0;
    26     LineCoords2.start_point[1] = 0.0;
    27     LineCoords2.start_point[2] = 0.0;
    28     LineCoords2.end_point[0] = 100.0;
    29     LineCoords2.end_point[1] = 100.0;
    30     LineCoords2.end_point[2] = 0.0;
    31     UF_CURVE_create_line(&LineCoords2, &Line1Tag[1]);
    32 
    33     //创建直线3
    34     UF_CURVE_line_t LineCoords3;
    35     LineCoords3.start_point[0] = 100.0;
    36     LineCoords3.start_point[1] = 100.0;
    37     LineCoords3.start_point[2] = 0.0;
    38     LineCoords3.end_point[0] = 0.0;
    39     LineCoords3.end_point[1] = 100.0;
    40     LineCoords3.end_point[2] = 0.0;
    41     UF_CURVE_create_line(&LineCoords3, &Line1Tag[2]);
    42 
    43     //创建直线4
    44     UF_CURVE_line_t LineCoords4;
    45     LineCoords4.start_point[0] = 0.0;
    46     LineCoords4.start_point[1] = 100.0;
    47     LineCoords4.start_point[2] = 0.0;
    48     LineCoords4.end_point[0] = 0.0;
    49     LineCoords4.end_point[1] = 0.0;
    50     LineCoords4.end_point[2] = 0.0;
    51     UF_CURVE_create_line(&LineCoords4, &Line1Tag[3]);
    52 
    53     //创建链表
    54     uf_list_p_t List;
    55     UF_MODL_create_list(&List);
    56 
    57     for (int i = 0; i < 4; i++)
    58     {
    59         //将四条直线tag添加到链表
    60         UF_MODL_put_list_item(List, Line1Tag[i]);
    61     }
    62 
    63     //删除链表的对象
    64     UF_MODL_delete_list_item(&List, Line1Tag[0]);//从链表里删除一条直线tag
    65     
    66     //查询链表数量
    67     int Count;
    68     UF_MODL_ask_list_count(List, &Count);
    69 
    70     //转换
    71     char msg[256];
    72     sprintf_s(msg, "链表数量为:%d", Count);
    73     //打印
    74     uc1601(msg, 1);
    75 
    76     tag_t ObjectTag = NULL_TAG;
    77     for (int i = 0; i < Count; i++)
    78     {
    79         //获取链表里的所有直线tag
    80         UF_MODL_ask_list_item(List, i, &ObjectTag);
    81 
    82         //把链表里的所有直线设置红色
    83         UF_OBJ_set_color(ObjectTag, 186);
    84     }
    85 
    86     //删除链表,释放内存
    87     UF_MODL_delete_list(&List);
    88 
    89     UF_terminate();

  • 相关阅读:
    JIRA4.1 主要功能
    linux之间的远程复制文件
    我在做测试 1
    JOGL简介与安装
    Eclipse RCP中的IAdaptable是什么?
    如何实现关系表的级联删除(ON DELETE CASCADE的用法)
    ubuntu 安装mysql+apache+php
    ubuntu10.10安装VMWare tools
    Struts2 Unable to load configuration. bean 错误解决
    MySQL Workbench “Error Code: 1175” 的解决方法
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/10975782.html
Copyright © 2020-2023  润新知