标题: 请高手帮忙:如何在草图上画线 [打印本页] 作者: 2323220987 时间: 2005-1-14 14:48 标题: 请高手帮忙:如何在草图上画线 在圆柱体的一个平面上建立一个草图,要在草图上画直线,是否先用UF_CURVE_create_line([$sline1,&line1[0])]创建直线,然后用errcod=UF_SKET_add_objects(sketch_id,count1,line1);把直线加入草图中
部分程序如下
int MY_ok_cb ( int dialog_id,
void * client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
int errcod;
char cc5[133];
char name[30]="sketch1";
int option=2;
int reference[2];
int reference1[2];
int plane_dir=1;
int plane_dir1=UF_SKET_WITH_NORMAL;
UF_FEATURE_SIGN sign=UF_NULLSIGN ;
tag_t cyl_obj;
tag_t plane[10];
int listnum=0;
int i;
int ret;
int type;
int count=0;
double origin[3]={0,0,0};
double point[3];
double dir[3];
double direction[3]={0,0,1};
char * height={"20"};
double box[6];
char * diam={"90"};
char * diam1={"30"};
double radius;
double rad_data;
int norm_dir;
uf_list_p_t face_list;
tag_t face_obj[2];
tag_t member=NULL_TAG;
tag_t sketch_id;
tag_t displayed_part;
int body_type;
int sub_type;
int is_parallel;
int count1=1;
double origin2[3]={0,0,20};
double matrix_value[9]={1,0,0,0,1,0,0,0,20};
tag_t line1[3];
UF_CURVE_line_t sline1;
/* Make sure User Function is available. */
if ( UF_initialize() != 0)
return ( UF_UI_CB_CONTINUE_DIALOG );
/* ---- Enter your callback code here ----- */
reference[0]=1;
reference[1]=1;
reference1[0]=UF_SKET_HORIZONTAL;
reference1[1]=UF_SKET_ALONG_CURVE;
/* Callback acknowledged, terminate dialog */
/* It is STRONGLY recommended that you exit your */
/* callback with UF_UI_CB_EXIT_DIALOG in a ok callback.*/
/* return ( UF_UI_CB_EXIT_DIALOG ); */
return (UF_UI_CB_EXIT_DIALOG);