1. 程式人生 > 實用技巧 >【NX二次開發】建立掃描特徵

【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 獲得旋轉特徵的引數