你好,欢迎来到UG二次开发专业技术交流论坛! 会员登录 | 快速注册 | 忘记密码?
UG二次开发最新技术资料
  • 请教一下SNAP的拉伸(extrude)如何做

    发布者:tingfgg 查看次数:272 评论条数:2 发布时间:2017-5-23
    研究了好几天,发现用SNAP开发的人比较少,资料难求!问题来了三维数模里存在一根多段封闭的线,用UI选择选中后,如何把选中的线作为参数在拉伸(extrude)命令里使用。求帮忙。谢谢各位师傅!
  • 调整圆角的大小

    发布者:qinyangliang 查看次数:302 评论条数:0 发布时间:2017-5-5
    各位师傅,谁知道同步建模里的(调整圆角的大小)的函数是哪个啊?先谢谢了!
  • grip提取实体的坐标信息

    发布者:naughtiness 查看次数:558 评论条数:1 发布时间:2017-4-4
    可否二次开发实现对UG模型的坐标信息提取呢
  • 点击查看GRIP全套视频教程
  • tag值的获取

    发布者:xiaotangcai 查看次数:625 评论条数:2 发布时间:2017-3-27
    新版ui界面,如何获取选择对象的tag值,比如选择一个曲线,怎么获取它的tag值
  • 怎样根据一个矩阵和角度获取旋转后的矩阵?

    发布者:jjajiao 查看次数:573 评论条数:1 发布时间:2017-3-6
    怎样根据一个矩阵和输入的旋转角度获取旋转后的矩阵?
  • UF_SF_create_load_nx和UF_SF_create_bc_nx为啥在NX8.0时不见了

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

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

    发布者:zdhzdhzdh 查看次数:652 评论条数:1 发布时间:2017-1-14
    求大神给个snap函数中文版学习一下
  • 全部显示所有

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

    发布者:q1355188058 查看次数:680 评论条数:10 发布时间: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 查看次数:1060 评论条数:8 发布时间: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);//创建点
  • 点击查看SNAP技术资料
  • 创建型腔和孔代码

    发布者:pooltool 查看次数:799 评论条数:13 发布时间: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();        }}
  • 获得对象信息(层、颜色、显示状态、线型、高亮状态)

    发布者:pooltool 查看次数:1092 评论条数:25 发布时间: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 查看次数:875 评论条数:19 发布时间: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 查看次数:721 评论条数:10 发布时间: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;}
NX二次开发热门资料
点击查看VIP会员特权
技术帖子评论排行
最新评论技术帖子