• NX二次开发-UFUN获取块的参数UF_MODL_ask_block_parms


     1     NX11+VS2013
     2     
     3     #include <uf.h>
     4     #include <uf_modl.h>
     5     #include <uf_ui.h>
     6 
     7 
     8     UF_initialize();
     9 
    10     //创建块
    11     UF_FEATURE_SIGN Sign = UF_NULLSIGN;//设置布尔
    12     double Corner_pt[3] = { 0.0, 0.0, 0.0 };//设置原点
    13     char *Edge_Len[3] = { "100", "50", "20" };//设置长宽高
    14     tag_t BlkTag = NULL_TAG;
    15     UF_MODL_create_block1(Sign, Corner_pt, Edge_Len, &BlkTag);
    16 
    17 
    18     //获取球的参数
    19     char *Size[3];//输出长宽高值
    20     UF_MODL_ask_block_parms(BlkTag, 1, Size);
    21 
    22 
    23     //打印
    24     //默认输出格式为表达式等号左右值
    25     UF_UI_open_listing_window();
    26     UF_UI_write_listing_window(Size[0]);
    27     UF_UI_write_listing_window("
    ");
    28     UF_UI_write_listing_window(Size[1]);
    29     UF_UI_write_listing_window("
    ");
    30     UF_UI_write_listing_window(Size[2]);
    31     
    32 
    33     //只输出表达式等号右值
    34     //提取左右值
    35     string L = Size[0];
    36     string LStrleft = (L.substr(0, L.find("=")));//提取左值
    37     string LStrright = (L.substr(L.find("=") + 1, L.find(" ")));//提取右值
    38 
    39     string W = Size[1];
    40     string WStrleft = (W.substr(0, W.find("=")));//提取左值
    41     string WStrright = (W.substr(W.find("=") + 1, W.find(" ")));//提取右值
    42 
    43     string H = Size[2];
    44     string HStrleft = (H.substr(0, H.find("=")));//提取左值
    45     string HStrright = (H.substr(H.find("=") + 1, H.find(" ")));//提取右值
    46 
    47     char LBufLeft[256], LBufRight[256];//左值,右值
    48     char WBufLeft[256], WBufRight[256];//左值,右值
    49     char HBufLeft[256], HBufRight[256];//左值,右值
    50     //将string类型转换为字符数组
    51     strcpy(LBufLeft, LStrleft.c_str());
    52     strcpy(LBufRight, LStrright.c_str());
    53 
    54     strcpy(WBufLeft, WStrleft.c_str());
    55     strcpy(WBufRight, WStrright.c_str());
    56 
    57     strcpy(HBufLeft, HStrleft.c_str());
    58     strcpy(HBufRight, HStrright.c_str());
    59     //打印右值
    60     UF_UI_write_listing_window("
    ");
    61     UF_UI_write_listing_window("
    ");
    62     UF_UI_write_listing_window(LBufRight);
    63     UF_UI_write_listing_window("
    ");
    64     UF_UI_write_listing_window(WBufRight);
    65     UF_UI_write_listing_window("
    ");
    66     UF_UI_write_listing_window(HBufRight);
    67 
    68 
    69     //释放内存
    70     UF_free(Size[0]);
    71     UF_free(Size[1]);
    72     UF_free(Size[2]);
    73 
    74     UF_terminate();

  • 相关阅读:
    5G网络类型 ?
    命令行签名
    软件著作权之源代码
    汗,查了很久的问题,竟然是重载错函数
    终于考完PMP
    ImportError: No module named _tkinter on macos
    numpy.trace对于三维以上array的解析
    ValueError: output parameter for reduction operation logical_and has too many dimensions ?
    numexpr low version warning
    Execution failed for task ':compileDebugAidl'.
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/10975981.html
Copyright © 2020-2023  润新知