螺杆的螺纹代码始终不对,求大神帮忙
#include <stdlib.h>#include <uf.h>
#include <uf_part.h>
#include <uf_modl.h>
#include <uf_view.h>
#include <uf_layer.h>
#include <uf_obj.h>
//#include <uf_modl_types>
extern void ufusr( char * param, int * retcod, int param_len )
{
if (!UF_initialize())
{
UF_FEATURE_SIGN sign = UF_NULLSIGN;
double cyl_orig = {0.0,7.5,0.0};
char *cyl_height="26";
char *cyl_diam="18";
double direction={0,0,-1};
tag_t cyl_obj;
//圆柱1的变量声明区
double block_orig = {-7.5,0.0,-26.0};
char *block_len = {"15","15","26"};
tag_t blk_obj;
//块的变量声明区
double cyl_orig1 = {0,7.5,-26.0};
char *cyl_height1="8";
char *cyl_diam1="18";
double direction1={0,0,-1};
tag_t cyl_obj1;
//圆柱2的变量声明区
double cyl_orig2 = {0,7.5,-34.0};
char *cyl_height2="12";
char *cyl_diam2="22";
double direction2={0,0,-1};
tag_t cyl_obj2;
//圆柱3的变量声明区
double cyl_orig3 = {0,7.5,-46.0};
char *cyl_height3="32";
char *cyl_diam3="18";
double direction3={0,0,-1};
tag_t cyl_obj3;
//圆柱4的变量声明区
double cyl_orig4 = {0,7.5,-78.0};
char *cyl_height4="7";
char *cyl_diam4="14";
double direction4={0,0,-1};
tag_t cyl_obj4;
//圆柱5的变量声明区
double cyl_orig5 = {0,7.5,-85.0};
char *cyl_height5="95";
char *cyl_diam5="18";
double direction5={0,0,-1};
tag_t cyl_obj5;
//圆柱6的变量声明区
double cyl_orig6 = {0,7.5,-180.0};
char *cyl_height6="18";
char *cyl_diam6="12";
double direction6={0,0,-1};
tag_t cyl_obj6;
//圆柱7的变量声明区
double cyl_orig7 = {0,7.5,-198.0};
char *cyl_height7="20";
char *cyl_diam7="10";
double direction7={0,0,-1};
tag_t cyl_obj7;
//圆柱8的变量声明区
double cyl_orig8 = {0,2.5,-210.0};
char *cyl_height8="20";
char *cyl_diam8="3";
double direction8={0,1,0};
tag_t cyl_obj8;
//孔的变量声明区
tag_t gasket_cyl_obj,gasket_blk_obj;
//创建圆柱的
UF_MODL_create_cyl1(sign, cyl_orig, cyl_height,cyl_diam,direction, &cyl_obj);
UF_MODL_create_block1(sign,block_orig,block_len,&blk_obj);
UF_MODL_create_cyl1(sign, cyl_orig1, cyl_height1,cyl_diam1,direction1, &cyl_obj1);
UF_MODL_create_cyl1(sign, cyl_orig2, cyl_height2,cyl_diam2,direction2, &cyl_obj2);
UF_MODL_create_cyl1(sign, cyl_orig3, cyl_height3,cyl_diam3,direction3, &cyl_obj3);
UF_MODL_create_cyl1(sign, cyl_orig4, cyl_height4,cyl_diam4,direction4, &cyl_obj4);
UF_MODL_create_cyl1(sign, cyl_orig5, cyl_height5,cyl_diam5,direction5, &cyl_obj5);
UF_MODL_create_cyl1(sign, cyl_orig6, cyl_height6,cyl_diam6,direction6, &cyl_obj6);
UF_MODL_create_cyl1(sign, cyl_orig7, cyl_height7,cyl_diam7,direction7, &cyl_obj7);
UF_MODL_create_cyl1(sign, cyl_orig8, cyl_height8,cyl_diam8,direction8, &cyl_obj8);
//圆柱和块的建模函数
tag_t cylinder, block,*resulting_bodies = NULL;
int num_results;
UF_MODL_ask_feat_body(cyl_obj,&cylinder);//目标体
UF_MODL_ask_feat_body(blk_obj,&block);//工具体
UF_MODL_intersect_bodies(block,cylinder,&num_results,&resulting_bodies);
//圆柱和块求交
tag_t cylinder7, cylinder8;
/*int num_results;*/
UF_MODL_ask_feat_body(cyl_obj7,&cylinder7);
UF_MODL_ask_feat_body(cyl_obj8,&cylinder8);
UF_MODL_subtract_bodies(cylinder7,cylinder8,&num_results,&resulting_bodies);
//圆柱求差,打孔
tag_t cylinder9, cylinder1;
UF_MODL_ask_feat_body(cyl_obj,&cylinder9);
UF_MODL_ask_feat_body(cyl_obj1,&cylinder1);
UF_MODL_unite_bodies(cylinder1,cylinder9);
//圆柱求和
tag_t cylinder2, cylinder3;
UF_MODL_ask_feat_body(cyl_obj2,&cylinder3);
UF_MODL_ask_feat_body(cyl_obj1,&cylinder2);
UF_MODL_unite_bodies(cylinder2,cylinder3);
tag_t cylinder4, cylinder5;
UF_MODL_ask_feat_body(cyl_obj4,&cylinder5);
UF_MODL_ask_feat_body(cyl_obj3,&cylinder4);
UF_MODL_unite_bodies(cylinder4,cylinder5);
}
}
已经做出螺杆,螺纹不会,求教大神
UF_Modl_craete_symb_thread看这个函数,有例子的啊
页:
[1]