天然呆 发表于 2021-8-30 16:14:58

lesson2 创建圆柱和中心线

tag_t partTag = NULL_TAG;
double origin = {0,0,0};
char *height = "50";
char *diam = "10";
double direction = {0,0,1};
tag_t cylTag = NULL_TAG;
uf_list_p_t eageList = NULL_TAG;
int count = 0;
char msg;
int i;
tag_t eageTag = NULL_TAG;
double centroid;
UF_CURVE_line_t line_coords;
tag_t lineTag = NULL_TAG;

extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
{
    /* Initialize the API environment */
    if( UF_CALL(UF_initialize()) )
    {
      /* Failed to initialize */
      return;
    }

    /* TODO: Add your application code here */

        UF_PART_new("D:\\part.prt", 1, &partTag);

        UF_MODL_create_cyl1(UF_NULLSIGN, origin, height, diam, direction, &cylTag);
        UF_MODL_ask_feat_edges(cylTag, &eageList);
        UF_MODL_ask_list_count(eageList, &count);
        sprintf(msg,"count number: %d",count);
        uc1601(msg,1);

        for ( i = 0; i < count; i++)
        {
                UF_MODL_ask_list_item(eageList, i, &eageTag);//将对应边保存

                UF_CURVE_ask_centroid(eageTag, centroid);//将对应的边的中点获取
        }
       
        line_coords.start_point = centroid;//第一个曲线的中心坐标
        line_coords.start_point = centroid;
        line_coords.start_point = centroid;

        line_coords.end_point = centroid;
        line_coords.end_point = centroid;
        line_coords.end_point = centroid;

        UF_CURVE_create_line(&line_coords, &lineTag);
        UF_PART_save();

zwz 发表于 2021-9-2 13:48:36

非常好的帖子 收藏一下以便学习
页: [1]
查看完整版本: lesson2 创建圆柱和中心线