• NX二次开发-UFUN获取圆柱的参数UF_MODL_ask_cylinder_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 Origin[3] = { 0.0, 0.0, 0.0 };
    13     char *Height1 = "100";
    14     char *Diam1 = "50";
    15     double Direction[3] = { 0.0, 0.0, 1.0 };
    16     tag_t CylTag = NULL_TAG;
    17     UF_MODL_create_cyl1(Sign, Origin, Height1, Diam1, Direction, &CylTag);
    18 
    19 
    20     //获取圆柱的参数
    21     char *Diameter;//输出直径
    22     char *Height;//输出高度
    23     UF_MODL_ask_cylinder_parms(CylTag, 1, &Diameter, &Height);
    24 
    25 
    26     //打印
    27     //默认输出格式为表达式等号左右值
    28     UF_UI_open_listing_window();
    29     UF_UI_write_listing_window(Diameter);
    30     UF_UI_write_listing_window("
    ");
    31     UF_UI_write_listing_window(Height);
    32 
    33     
    34     //只输出表达式等号右值
    35     //提取左右值
    36     string D = Diameter;
    37     string DStrleft = (D.substr(0, D.find("=")));//提取左值
    38     string DStrright = (D.substr(D.find("=") + 1, D.find(" ")));//提取右值
    39 
    40 
    41     string H = Height;
    42     string HStrleft = (H.substr(0, H.find("=")));//提取左值
    43     string HStrright = (H.substr(H.find("=") + 1, H.find(" ")));//提取右值
    44 
    45     char DBufLeft[256], DBufRight[256];//左值,右值
    46     char HBufLeft[256], HBufRight[256];//左值,右值
    47     //将string类型转换为字符数组
    48     strcpy(DBufLeft, DStrleft.c_str());
    49     strcpy(DBufRight, DStrright.c_str());
    50 
    51     strcpy(HBufLeft, HStrleft.c_str());
    52     strcpy(HBufRight, HStrright.c_str());
    53 
    54     //打印右值
    55     UF_UI_write_listing_window("
    ");
    56     UF_UI_write_listing_window("
    ");
    57     UF_UI_write_listing_window(DBufRight);
    58     UF_UI_write_listing_window("
    ");
    59     UF_UI_write_listing_window(HBufRight);
    60 
    61 
    62     //释放内存
    63     UF_free(Diameter);
    64     UF_free(Height);
    65 
    66     UF_terminate();

  • 相关阅读:
    cassandra复制到一个新机器编译失败的问题
    cassandra在服务端像leveldb一样进行插入初试成功
    git push不成功 insufficient permission for adding an object to repository database
    fuse进级
    fuse入门
    cassandra的写过程
    cassandra-执行请求入口函数
    cassandra-replication_factor 和 consistency level
    根据金额大小升序排序
    PL/SQL Developer连接本地Oracle 11g 64位数据库(转)
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/10975975.html
Copyright © 2020-2023  润新知