你好,欢迎来到UG二次开发专业技术交流论坛! 会员登录 | 快速注册 | 忘记密码?
UG二次开发最新技术资料
  • UF_SF_create_load_nx和UF_SF_create_bc_nx为啥在NX8.0时不见了

    发布者:dongzhe2009 查看次数:103 评论条数:0 发布时间:2017-1-18
    UF_SF_create_load_nx和UF_SF_create_bc_nx为啥在NX8.0时不见了
  • nx8.0程序怎样添加载荷和边界条件

    发布者:dongzhe2009 查看次数:88 评论条数:0 发布时间:2017-1-18
    nx8.0程序怎样添加载荷和边界条件
  • 求snap函数中文版

    发布者:zdhzdhzdh 查看次数:113 评论条数:1 发布时间:2017-1-14
    求大神给个snap函数中文版学习一下
  • 点击查看GRIP全套视频教程
  • 全部显示所有

    发布者:qinyangliang 查看次数:108 评论条数:1 发布时间:2017-1-11
    请问为什么用:unblnk/all做的二次开发不能显示所有打开的图层上的体呢,只能显示一部分,不知道什么原因
  • 自动打印

    发布者:q1355188058 查看次数:103 评论条数:3 发布时间:2017-1-11
    intPrintPart(tag_tInPart){UF_PART_set_display_part(InPart);UF_ASSEM_set_work_part(InPart);TagLtagAllSheets;intType,SubType;tag_tCurObj=NULL_TAG;//遍歷找出所有的圖紙UF_OBJ_cycle_objs_in_part(InPart,UF_drawing_type,&CurObj);while(CurObj){  UF_OBJ_ask_type_and_subtype(CurObj,&Type,&SubType);    UF_OBJ_cycle_objs_in_part(InPart,UF_drawing_type,&CurObj);}UF_PLOT_job_options_tJobOptions;UF_PLOT_banner_options_tBannerOptions;//旗幟,通欄頭號標題TCHAR*JobName;intCount=1;//tag_tdrawing_sheet;UF_CALL(UF_PLOT_ask_default_job_options(&JobOptions));//查询默认的打印任务选项,线宽设置等UF_CALL(UF_PLOT_ask_default_banner_options(&BannerOptions));UF_DRAW_info_tDrawInfo;TCHARProfile[S257];tagAllSheets.tmp=tagAllSheets.first;while(tagAllSheets.tmp){  UF_DRAW_ask_drawing_info(tagAllSheets.tmp->ent,&DrawInfo);    switch(DrawInfo.size_state)//確定使用哪一個打印配置  {  default:  caseUF_DRAW_METRIC_SIZE:  switch(DrawInfo.size.metric_size_code)  {  default:  caseUF_DRAW_A4:    strcpy_s(Profile,"A4_h");//h表示橫向幫使用者配置好  配置檔A4_h專用於A4紙張的打印    break;  caseUF_DRAW_A3:    strcpy_s(Profile,"A3_h");//幫使用者配置好  配置檔A3_h專用於A3紙張的打印    break;  caseUF_DRAW_A2:    strcpy_s(Profile,"A2_h");    break;  caseUF_DRAW_A1:    strcpy_s(Profile,"A1_h");    break;  caseUF_DRAW_A0:    strcpy_s(Profile,"A0_h");    break;  }  break;  caseUF_DRAW_ENGLISH_SIZE:  tagAllSheets.tmp=tagAllSheets.tmp->Next;//目前還不處理英制圖紙  continue;  break;  caseUF_DRAW_CUSTOM_SIZE://豎向即為UF_DRAW_CUSTOM_SIZE  if(fabs(DrawInfo.size.custom_size[0]-297.0)<=dert&&fabs(DrawInfo.size.custom_size[1]-210.0)<=dert)  {    strcpy_s(Profile,"A4_s");//s表示豎向  }  elseif(fabs(DrawInfo.size.custom_size[0]-420.0)<=dert&&fabs(DrawInfo.size.custom_size[1]-297.0)<=dert)  {    strcpy_s(Profile,"A3_s");  }  elseif(fabs(DrawInfo.size.custom_size[0]-594.0)<=dert&&fabs(DrawInfo.size.custom_size[1]-420.0)<=dert)  {    strcpy_s(Profile,"A2_s");  }  elseif(fabs(DrawInfo.size.custom_size[0]-841.0)<=dert&&fabs(DrawInfo.size.custom_size[1]-594.0)<=dert)  {    strcpy_s(Profile,"A1_s");  }  elseif(fabs(DrawInfo.size.custom_size[0]-1189.0)<=dert&&fabs(DrawInfo.size.custom_size[1]-841.0)<=dert)  {    strcpy_s(Profile,"A0_s");  }  break;  }  UF_CALL(UF_PLOT_ask_default_job_name(tagAllSheets.tmp->ent,&JobName));//通过图纸得到默认的任务名  UF_free(JobName);}return1;}  回复可见的内容...
  • 获得曲面点的法向量 和点坐标

    发布者:pooltool 查看次数:204 评论条数:4 发布时间:2016-12-20
    UF_MODL_ask_face_uv_minmax获得面u,v参数空间(u,v最小,最大值)uf_modl_ask_face_parm  获得曲面的u,v参数;再使用uf_modl_ask_face_props获得曲面点的法向量和点坐标=======================================================tag_tobjs[0]=NULL_TAG;//输入面特征doubleuvs[4];UF_MODL_ask_face_uv_minmax(objs[0],uvs);//获得面u,v参数空间(u,v最小,最大值)doubleparam[2];                          //输入U,V方向值param[0]=(uvs[0]+uvs[1])/2;param[1]=(uvs[2]+uvs[3])/2;doublepoint[3];        //输出点坐标doubleu1[3];          //输出输出一阶导数在U位置doublev1[3];          //输出输出一阶导数在V位置doubleu2[3];          //输出输出二阶导数在U位置doublev2[3];          //输出输出二阶导数在V位置doubleunit_norm[3];    //输出面上该点的矢量方向doubleradii[2];        //输出,双半径,输出主曲率半径UF_MODL_ask_face_props(objs[0],param,point,u1,v1,u2,v2,unit_norm,radii);tag_tpoint_tag=NULL_TAG;      UF_CURVE_create_point(point,&point_tag);//创建点
  • 创建型腔和孔代码

    发布者:pooltool 查看次数:154 评论条数:5 发布时间:2016-12-20
    //创建型腔和孔#include<stdio.h>#include<uf.h>#include<uf_modl.h>#include<uf_ui.h>#include<malloc.h>/*定义全局变量,用于转递相对定位的目标边*/tag_t  edge_blk[12];tag_t  edge_blend[4];/*注册型腔定位的用户函数*/intrpo_routine_pocket(tag_tobj_id){        intirc=0,i;        uf_list_p_t  edge_list;        intcount_list;        tag_t  tem_tag,*edge_pock;        edge_pock=(tag_t*)malloc(12*sizeof(tag_t));                tag_t*obj_id_target,*obj_id_tool;        obj_id_target=(tag_t*)malloc(3*sizeof(tag_t));        obj_id_tool=(tag_t*)malloc(3*sizeof(tag_t));        char*constraint_value[]={"0.0","0.0"};        char*constraint_array[]={"PARA_EDGE_PARMS","PARA_EDGE_PARMS"};        inttarget_qualifier[]={UF_MODL_ENDPOINT_1,UF_MODL_ENDPOINT_1};        inttool_qualifier[]={UF_MODL_ENDPOINT_1,UF_MODL_ENDPOINT_1};                UF_MODL_ask_feat_edges(obj_id,&edge_list);        UF_MODL_ask_list_count(edge_list,&count_list);                for(i=0;i<count_list;i++)        {                UF_MODL_ask_list_item(edge_list,i,&tem_tag);                edge_pock=tem_tag;        }        UF_MODL_delete_list(&edge_list);                obj_id_tool[0]=edge_pock[0];        obj_id_tool[1]=edge_pock[4];                obj_id_target[0]=edge_blk[1];        obj_id_target[1]=edge_blk[0];        irc=UF_MODL_create_rpo_constraints(obj_id,NULL_TAG,NULL_TAG,obj_id_target,                target_qualifier,obj_id_tool,tool_qualifier,constraint_value,constraint_array,2);                free(edge_pock);        free(obj_id_target);        free(obj_id_tool);                if(irc==0)        return(0);    else        return(1);}//孔定位的用户函数intrpo_routine_hole(tag_tobj_id){    intirc,i;    intcount_list;    tag_t  tem_tag;            tag_t  edge_tool[5];    uf_list_p_t  edge_list;    obj_id_target[0]=edge_blend[2];    obj_id_tool[0]=edge_tool[1];    irc=UF_MODL_create_rpo_constraints(obj_id,NULL_TAG,NULL_TAG,obj_id_target,        target_qualifier,obj_id_tool,tool_qualifier,constraint_value,constraint_array,1);    if(irc==0)        return(0);    else        return(1);}/*UG/OPENAPI内部环境的入口函数*/voidufusr(char*param,int*retcode,intparamLen){        if(!UF_initialize())        {                /*定义创建块的参数*/                UF_FEATURE_SIGNsign=UF_NULLSIGN;                doubleblock_orig[3]={0.0,0.0,0.0};                char*block_len[3]={"100","60","40"};                tag_tblk_fea,blk_obj,tem_tag,face_blk[6];                uf_list_p_tface_list,edge_list;                intcount_list;                inti;                                        /*定义创建型腔的参数*/                doublepock_loc[3]={25.0,30.0,40.0};                doublepock_dir[3]={0.0,0.0,-1.0};                doublepock_x_dir[3]={1.0,0.0,0.0};                char*pock_len[3]={"50.0","40.0","20.0"};                char*pock_corner={"0.0"};                char*pock_floor={"0.0"};                char*pock_angle={"0.0"};                tag_tpock_id;                                /*定义创建边倒圆的参数*/                char*blend_radius="20.0";                uf_list_p_tblend_list,blend_edge_list;                tag_tblend_id;                                /*定义创建孔的参数*/                double  hole_origin[3]={60.0,30.0,40.0};                double  hole_cyl_dir[3]={0.0,0.0,-1.0};                char    *hole_dia="25.0";                char    *hole_height="5.0";                char    *hole_angle="0.0";                tag_thole_id;                                /*创建块*/                UF_MODL_create_block1(sign,block_orig,block_len,&blk_fea);                UF_MODL_ask_feat_body(blk_fea,&blk_obj);                                /*获得块上面的标识,用于确定成型特征的孔和型腔安置面,                以及孔的穿透面*/                UF_MODL_ask_body_faces(blk_obj,&face_list);                UF_MODL_ask_list_count(face_list,&count_list);                          for(i=0;i<count_list;i++)                {                        UF_MODL_ask_list_item(face_list,i,&tem_tag);                        face_blk=tem_tag;                }                UF_MODL_delete_list(&face_list);                                /*获得块上边的标识,用于相对定位*/                UF_MODL_ask_body_edges(blk_obj,&edge_list);                UF_MODL_ask_list_count(edge_list,&count_list);                          for(i=0;i<count_list;i++)                {                        UF_MODL_ask_list_item(edge_list,i,&tem_tag);                        edge_blk=tem_tag;                }                UF_MODL_delete_list(&edge_list);                                /*创建型腔,并进行相对定位*/                UF_MODL_register_rpo_routine(rpo_routine_pocket);                UF_MODL_create_rect_pocket(pock_loc,pock_dir,pock_x_dir,pock_len,                        pock_corner,pock_floor,pock_angle,face_blk[0],&pock_id);                UF_MODL_unregister_rpo_routine();                                /*进行边倒圆*/                UF_MODL_create_list(&blend_list);                UF_MODL_put_list_item(blend_list,edge_blk[6]);                UF_MODL_create_blend(blend_radius,blend_list,0,0,0,0.5,&blend_id);                                /*获取倒圆的边,用于孔的相对定位*/                UF_MODL_ask_feat_edges(blend_id,&blend_edge_list);                UF_MODL_ask_list_count(blend_edge_list,&count_list);                          for(i=0;i<count_list;i++)                {                        UF_MODL_ask_list_item(blend_edge_list,i,&tem_tag);                        edge_blend=tem_tag;                }                UF_MODL_delete_list(&blend_edge_list);                                /*创建孔,并进行相对定位*/                UF_MODL_register_rpo_routine(rpo_routine_hole);                        UF_MODL_create_simple_hole(hole_origin,hole_cyl_dir,hole_dia,                        hole_height,hole_angle,face_blk[0],face_blk[1],&hole_id);                                UF_MODL_unregister_rpo_routine();                                UF_terminate();        }}
  • 点击查看VIP会员特权
  • 获得对象信息(层、颜色、显示状态、线型、高亮状态)

    发布者:pooltool 查看次数:223 评论条数:11 发布时间:2016-12-18
    获得对象信息(层、颜色、显示状态、线型、高亮状态)tag_tobject_tag;UF_OBJ_disp_props_tdisp_props;UF_OBJ_ask_display_properties(object_tag,&disp_props);intccc=disp_props.color;//获得对象颜色其它属性如下:Intlayer                对象所在的层Intcolor                对象的颜色Intblank_status          对象的隐藏状态:                                      UF_OBJ_NOT_BLANKED可见                                          UF_OBJ_BLANKED  隐藏Intline_width            对象的线宽:UF_OBJ_WIDTH_NORMAL;                                          UF_OBJ_WIDTH_THICK;                                          UF_OBJ_WIDTH_THIN;                                          UF_OBJ_WIDTH_ORIGINALIntfont                  对象的线型Logical                  对象的高亮显示状态highlight_status
  • 装配组件包容盒源码

    发布者:pooltool 查看次数:210 评论条数:7 发布时间:2016-12-10
    装配组件包容盒源码引用或者代码:#include<stdio.h>#include<uf.h>#include<uf_obj.h>#include<uf_modl.h>#include<uf_object_types.h>#include<uf_part.h>#defineUF_CALL(X)(report_error(__FILE__,__LINE__,#X,(X)))staticintreport_error(char*file,intline,char*call,intirc){    if(irc)    {        char    messg[133];        printf("%s,line%d:  %s\n",file,line,call);        (UF_get_fail_message(irc,messg))?            printf("    returneda%d\n",irc):            printf("    returnederror%d:  %s\n",irc,messg);    }    return(irc);}statictag_task_a_body(tag_tpart,tag_tbody){    int        subtype,        type;    do    {        UF_CALL(UF_OBJ_cycle_objs_in_part(part,UF_solid_type,&body));        if(body)UF_CALL(UF_OBJ_ask_type_and_subtype(body,&type,&subtype));    }while(body&&subtype);    return(body);}staticvoidmk_box(double*arr){    char        *len[3],        len_t[3][20];    tag_t        box;    len[0]=&len_t[0][0];    len[1]=&len_t[1][0];    len[2]=&len_t[2][0];    UF_CALL(UF_MODL_create_block1(UF_NULLSIGN,arr,len,&box));    UF_CALL(UF_MODL_ask_feat_body(box,&box));    UF_CALL(UF_OBJ_set_color(box,UF_OBJ_YELLOW));}staticvoiddo_it(void){    int        i;    double        box[6],        minmax[6]={10000,10000,10000,-10000,-10000,-10000};    tag_t        body=NULL_TAG,        part=UF_PART_ask_display_part();    while((body=ask_a_body(part,body))!=0)    {        FTN(uf6540)(&body,&i,box);        if(!i)        {            for(i=0;i<3;i++)if(box<minmax)minmax=box;          for(i=3;i<6;i++)if(box>minmax)minmax=box;        }    }    mk_box(minmax);}voidufusr(char*param,int*retcode,intparamLen){    if(!UF_CALL(UF_initialize()))    {        do_it();        UF_CALL(UF_terminate());    }}intufusr_ask_unload(void){    return(UF_UNLOAD_IMMEDIATELY);}
  • 添加装配组件源码实例

    发布者:pooltool 查看次数:171 评论条数:2 发布时间:2016-12-10
    添加装配组件源码实例:引用或者代码:#include<stdio.h>#include<string.h>#include<uf.h>#include<uf_ui.h>#include<uf_cfi.h>#include<uf_part.h>#include<uf_assem.h>#defineUF_CALL(X)(report_error(__FILE__,__LINE__,#X,(X)))staticintreport_error(char*file,intline,char*call,intirc){    if(irc)    {        charerr[133];        UF_UI_open_listing_window();        UF_get_fail_message(irc,err);        UF_UI_write_listing_window(err);        UF_UI_write_listing_window("\n");        sprintf(err,"error%datline%din%s\n",irc,line,file);        UF_UI_write_listing_window(err);        UF_UI_write_listing_window(call);        UF_UI_write_listing_window(";\n\n");    }    return(irc);}staticvoidreport_load_status(UF_PART_load_status_p_tstatus){    char        msg[133];    int        ii;    if(status->n_parts>0)    {        UF_UI_open_listing_window();        UF_UI_write_listing_window("Loadnotes:\n");        for(ii=0;ii<status->n_parts;ii++)        {            UF_UI_write_listing_window("  ");            UF_UI_write_listing_window(status->file_names[ii]);            UF_UI_write_listing_window("-");            UF_get_fail_message(status->statuses[ii],msg);            UF_UI_write_listing_window(msg);            UF_UI_write_listing_window("\n");        }        UF_UI_write_listing_window("\n");        UF_free(status->statuses);        UF_free_string_array(status->n_parts,status->file_names);    }}voidufusr(char*param,int*retcode,intparamLen){    if(UF_CALL(UF_initialize()))return;    do_it();    UF_terminate();}intufusr_ask_unload(void){    return(UF_UNLOAD_IMMEDIATELY);}staticvoidbuild_copy_partname(char*copy_fspec){    char        dspec[MAX_FSPEC_SIZE+1],        part_name[MAX_ENTITY_NAME_SIZE+1],        part_fspec[MAX_FSPEC_SIZE+1];    tag_t        part=UF_PART_ask_display_part();    UF_PART_ask_part_name(part,part_fspec);    UF_CALL(uc4576(part_fspec,2,dspec,part_name));    UF_CALL(uc4578(part_name,2,part_name));    strcat(part_name,"-new");    UF_CALL(uc4575(dspec,2,part_name,copy_fspec));}intmain(intargc,char*argv[]){    int        cnt=0;    tag_t        part;    char        new_fspec[MAX_FSPEC_SIZE+1],        part_name[MAX_FSPEC_SIZE+1];    UF_PART_load_status_t        status;    if(!UF_CALL(UF_initialize()))    {        UF_CALL(uc4624(0,argc,argv));        while(uc4621(part_name)==1)        {            printf("%d.  %s\n",++cnt,part_name);            UF_CALL(UF_PART_open(part_name,&part,&status));            report_load_status(&status);            if(!status.failed)            {                do_it();                build_copy_partname(new_fspec);                if(!UF_CALL(UF_PART_save_as(new_fspec)))                    printf("\tsavedas%s\n",new_fspec);                UF_CALL(UF_PART_close_all());            }        }        printf("\nProcessed%dparts.\n",cnt);        UF_CALL(UF_terminate());    }    return0;}
  • 获得线上的点或信息

    发布者:woiusr 查看次数:154 评论条数:7 发布时间:2016-12-10
    获得线上的点或信息曲线离散成点集UF_MODL_ask_curve_points()可以得到曲线上的一点的坐标,点的切矢,和法矢等等【0-1(开始到结束)】//获得线的启始点坐标和终止点坐标UF_MODL_ask_curve_propsdoublestart_p[3];doubleend_p[3];UF_CURVE_line_tline_coords;tag_tline_tag;UF_CURVE_ask_line_data(line_tag,&line_coords);给定一个参考点,用UF_MODL_ask_curve_parm也可以求曲线上的一点以及这一点在曲线上的参数值//得到曲线上的一点的坐标,点的切矢,和法矢等等【0-1(开始到结束)】tag_tobj;doublepoint[3];doubletangent[3];doublep_norm[3];doubleb_norm[3];doubletorsion;double  rad_of_cur;UF_MODL_ask_curve_props(obj,    //输入曲线0.5,    //输入0-1point,  //返回点坐标tangent,p_norm,b_norm,&torsion,&rad_of_cur);  
  • 点击查看SNAP技术资料
  • 创建软管特征

    发布者:woiusr 查看次数:132 评论条数:6 发布时间:2016-12-10
    创建软管特征函数:创建的软管特征的标识链表,使用函数UF_MODL_delete_list()释放内存
  • 删除所有实体参数

    发布者:woiusr 查看次数:192 评论条数:10 发布时间:2016-12-10
    //删除所有固体参数#include<uf_modl.h>#include<uf_obj.h>#include<uf_part.h>tag_t  disp_part_tag,next_tag=NULL_TAG,subtype=NULL_TAG;int        num=0,nm=0;char        *feat_type;int  type=UF_solid_type;  //对象类型UF_solid_typeint  ssubtype;uf_list_p_tbody_list;UF_MODL_create_list(&body_list);disp_part_tag=UF_PART_ask_display_part();//得到当前部件文件标识UF_OBJ_cycle_objs_in_part(disp_part_tag,type,&next_tag);while(next_tag!=NULL_TAG){  num++;  UF_OBJ_ask_type_and_subtype(next_tag,&type,&ssubtype);//获得对象类型  if(ssubtype==UF_solid_body_subtype)                    //比较对象类型是否固体  {      nm++;      UF_MODL_put_list_item(body_list,next_tag);  //next_tag对象加入到body_list对象列表尾部  }  UF_OBJ_cycle_objs_in_part(disp_part_tag,type,&next_tag);}
  • 长方体特征与表达式相关的应用

    发布者:woiusr 查看次数:130 评论条数:1 发布时间:2016-12-10
    长方体特征与表达式相关的应用//头文件#include<stdio.h>#include<uf_modl.h>//长方体特征        char*block_len[3]={"1","2","3"};                doubleblock_orig[3]={0.0,0.0,0.0};                tag_tblk_obj;                intnumber_of_exps=0,i;                tag_t*exps;            char*string;                char*lhs_str,*rhs_str;                tag_texp_tag;                char*name[3];                name[0]="l";                name[1]="w";                name[2]="h";                doubleexp_value;                charbuffer[100];                UF_UI_open_listing_window();                //创建长方体                UF_MODL_create_block1(UF_NULLSIGN,block_orig,block_len,&blk_obj);            //查询长方体特征所包含的表达式                UF_MODL_ask_exps_of_feature(blk_obj,&number_of_exps,&exps);                sprintf(buffer,"number_of_exps=%d\n",number_of_exps);                UF_UI_write_listing_window(buffer);                for(i=0;i<number_of_exps;i++)                {                        //利用表达式获得标识                        UF_MODL_ask_exp_tag_string(exps,&string);                        //分离表达式的名称和数值                                                //计算表达式的值                        UF_MODL_eval_exp(name,&exp_value);                        sprintf(buffer,"%f\n",exp_value);                        UF_UI_write_listing_window(buffer);                        buffer[0]='\0';                        UF_free(lhs_str);                        UF_free(rhs_str);                        UF_free(string);                }                UF_free(exps);                string="\0";                UF_MODL_ask_exps_of_feature(blk_obj,&number_of_exps,&exps);                for(i=0;i<number_of_exps;i++)                {                        UF_MODL_ask_exp_tag_string(exps,&string);                        UF_UI_write_listing_window(string);            UF_UI_write_listing_window("\n");            UF_free(string);                }                UF_free(exps);    
  • UG二次开发 倒角的函数应用代码

    发布者:woiusr 查看次数:166 评论条数:6 发布时间:2016-12-10
    UF_MODL_create_blend  //倒圆角UF_MODL_cre_chamfer_with_flip_option  //倒角以下函数用法:externintUF_MODL_cre_chamfer_with_flip_option(intsubtype,char*offset1,char*offset2,char*theta,uf_list_p_tedges,logical  flip_option,tag_t*feature_obj_id);以下参数说明:int  subtype输入倒角类型:    1=单偏移    2=双偏移    3=偏移和角度    4=自由单一偏移    5=自由双偏置char*  offset1      输入倒角偏移1char*  offset2      输入倒角偏移2char*  theta          输入倒角角度uf_list_p_t  edges    输入要倒角的边表logical  flip_option;      输入倒角翻转选项1=反方向tag_t*  feature_obj_id输出对象标识符创建倒角特征//实例:创建一个四方体并全部倒圆角UF_FEATURE_SIGNsign=UF_NULLSIGN;doublecorner_pt[3]={0,0,0};char*edge_len[3]={"10","10","10"};tag_tblk_obj_id,blk_obj;UF_MODL_create_blend(radius,edge_list,0,0,0,0.5,&feature_obj_id);  //对所有的边创建圆角UF_free(edge_list);  
NX二次开发热门资料
点击查看VIP会员特权
技术帖子评论排行
最新评论技术帖子