第二节课交作业呵呵,
#include <uf.h>#include <uf_ui.h>
#include <uf_exit.h>
#include <uf_part.h>
#include <uf_modl.h>
#include <stdio.h>
#include <stdlib.h>
extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
{
UF_initialize();
char path = "D:\\new.prt";
tag_t newPart;
UF_PART_new(path,1,&newPart);
double cyl_origin1 = {10,0,0};
char *cyl_height1 = "30";
char *cyl_diam1 = "10";
double cyl_direction1 = {0,0,1};
tag_t cyl_tag1;
tag_t line1;
UF_MODL_create_cyl1(UF_NULLSIGN,cyl_origin1,cyl_height1,cyl_diam1,cyl_direction1,&cyl_tag1);
UF_CURVE_line_t lineP;
lineP.start_point = cyl_origin1;
lineP.start_point = cyl_origin1;
double D_cyl_height1 = 0.0;
sscanf(cyl_height1,"%lf",&D_cyl_height1);
lineP.start_point = cyl_origin1+D_cyl_height1;
lineP.end_point = cyl_origin1;
lineP.end_point = cyl_origin1;
lineP.end_point = cyl_origin1;
UF_CURVE_create_line(&lineP,&line1);
UF_CURVE_line_t o_lineP;
UF_CURVE_ask_line_data(line1,&o_lineP);
char start_msg;
sprintf(start_msg,"直线起始点(X,Y,Z):%f,%f,%f\n",o_lineP.start_point,o_lineP.start_point,o_lineP.start_point);
char end_msg;
sprintf(end_msg,"直线起终点(X,Y,Z):%f,%f,%f\n",o_lineP.end_point,o_lineP.end_point,o_lineP.end_point);
UF_UI_open_listing_window();
UF_UI_write_listing_window(start_msg);
UF_UI_write_listing_window(end_msg);
/* uc1601("点击--确定--后保存并关闭",1);
UF_UI_exit_listing_window();
*/
UF_PART_save();
UF_PART_close_all();
UF_terminate();
}
extern int ufusr_ask_unload( void )
{
return( UF_UNLOAD_IMMEDIATELY );
}
做的不错 !
还可以提高:
如果 圆柱 不是 Z轴的方向,你这个中心线是否还正确!可以自己测试下!
看看这个功能是不是可以增强下! 做的不错 !
还可以提高:
如果 圆柱 不是 Z轴的方向,你这个中心线是否还正确!可以自己测试下!
看看这个功能是不是可以增强下! 恩,我再试试
页:
[1]