【NX二次开发】创建扫描特征

扫描特征相关函数:

创建扫描特征的相关函数:

1.UF_MODL_create_extrude_trim_opts 拉伸

2.UF_MODL_create_extrude_trim_opts1 拉伸

        tag_t * extrude_array, //被拉伸的对象列表
        int extrude_count, //拉伸对象数量
        UF_MODL_SWEEP_TRIM_object_p_t trim_ptr, //参数定义裁剪选项
        UF_MODL_SWEEP_TRIM_OPTS trim_options, //结构参数定义裁剪选项 
        char * taper_angle, //锥角
        char * limits[2], //起始值,终止值
        char * offsets[2], //拉伸偏置    
        double region_point[3], //用于确定区域的点
        logical cut_specified, //是否指定区域
        logical solid_body_creation, //如果截面轮廓封闭且为 TRUE 将创建实体,否则创建片体
        double dir[3], //拉伸方向
        UF_FEATURE_SIGN sign, //布尔操作类型 不能为创建只能是 加、减和并
        tag_t ** objects, //创建的拉伸特征的标识数组
        int * object_count); //创建的拉伸特征的个数

3.UF_MODL_create_extruded   创建拉伸特征

4.UF_MODL_create_extruded1 创建拉伸特征

5.UF_MODL_create_extruded2 创建拉伸特征,不能创建片体

extern DllExport void ufusr(char *param, int *returnCode, int rlen)
{
    UF_initialize();
    //定义4个点的坐标
    double douP1[3] = { 0,0,0 };
    double douP2[3] = { 0,10,0 };
    double douP3[3] = { 10,10,0 };
    double douP4[3] = { 10,0,0 };
    //创建4条直线
    UF_CURVE_line_t LineCoords1;
    UF_CURVE_line_t LineCoords2;
    UF_CURVE_line_t LineCoords3;
    UF_CURVE_line_t LineCoords4;
    UF_VEC3_copy(douP1, LineCoords1.start_point);
    UF_VEC3_copy(douP2, LineCoords1.end_point);
    UF_VEC3_copy(douP2, LineCoords2.start_point);
    UF_VEC3_copy(douP3, LineCoords2.end_point);
    UF_VEC3_copy(douP3, LineCoords3.start_point);
    UF_VEC3_copy(douP4, LineCoords3.end_point);
    UF_VEC3_copy(douP4, LineCoords4.start_point);
    UF_VEC3_copy(douP1, LineCoords4.end_point);
    tag_t LineTag[4];
    UF_CURVE_create_line(&LineCoords1, &LineTag[0]);
    UF_CURVE_create_line(&LineCoords2, &LineTag[1]);
    UF_CURVE_create_line(&LineCoords3, &LineTag[2]);
    UF_CURVE_create_line(&LineCoords4, &LineTag[3]);
    
    //创建链表
    uf_list_p_t LineList1;
    UF_MODL_create_list(&LineList1);
    for (int i = 0; i < 4; i++)
    {
        UF_MODL_put_list_item(LineList1, LineTag[i]);
    }
    
    //创建拉伸实体
    char *cTaperAngle1 = "0.0";
    char *cLimit1[2] = { "0.0", "8.0" };
    double douPoint1[3] = { 0.0, 0.0, 0.0 };
    double douDirection1[3] = { 0.0, 0.0, 1.0 };
    UF_FEATURE_SIGN Sign1 = UF_NULLSIGN;
    uf_list_p_t Features1;
    UF_MODL_create_extruded(LineList1, cTaperAngle1, cLimit1, douPoint1, douDirection1, Sign1, &Features1);
    
    
    //创建拉伸片体(扫描的截面线不是封闭轮廓)
    uf_list_p_t LineList2;
    UF_MODL_create_list(&LineList2);
    UF_MODL_put_list_item(LineList2, LineTag[0]);
    uf_list_p_t Features2;
    UF_MODL_create_extruded(LineList2, cTaperAngle1, cLimit1, douPoint1, douDirection1, Sign1, &Features2);
    
    UF_MODL_delete_list(&LineList1);
    UF_MODL_delete_list(&LineList2);
    UF_MODL_delete_list(&Features1);
    UF_MODL_delete_list(&Features2);
    UF_terminate();
}

extern int ufusr_ask_unload(void)
{
    return (UF_UNLOAD_IMMEDIATELY);
}

6.UF_MODL_create_revolution 创建旋转体特征

7.UF_MODL_create_revolved   创建旋转体特征

8.UF_MODL_create_tube          创建管道特征

查询扫描特征的相关函数:

1.UF_MODL_ask_sweep_curves 获得拉伸和旋转特征的截面线串和引导线串的参数

2.UF_MODL_ask_sweep_direction 获得拉伸特征的方向和旋转特征的旋转轴参数

3.UF_MODL_ask_sweep_params 获得拉伸特征和旋转特征的拔模角度、起始位置和终点位置参数

4.UF_MODL_ask_extrude_offset_dir 获得拉伸特征的偏置方向

5.UF_MODL_ask_extrusion 获得拉伸特征的参数

6.UF_MODL_ask_revolution 获得旋转特征的参数

 编辑扫描特征函数:

1.UF_MODL_edit_sweep_curves 编辑扫描特征的轮廓线串和引导线串

2.UF_MODL_replace_sweep_strings 类似于UF_MODL_edit_sweep_curves,但功能更强

3.UF_MODL_reattach_thru_faces 重新定义扫描特征的修剪面和成型特征的穿透面

4.UF_MODL_set_sweep_axis 重新设置扫描特征的方向

5.UF_MODL_sweep_tolerances 重新设置扫描特征的链接和距离公差

原文地址:https://www.cnblogs.com/KMould/p/13576226.html