马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我想使用UIStlyer建立了一个按钮,点击按钮后出现selection class的对话框,然后使用鼠标选择work part中的几条样条曲线,OK之后调用through curves函数生成曲面,可程序编译链接都没有错误,就是生成不了曲面,各位大大帮帮忙看看了,我调了两天也不知问题出在哪里了
其实就是使用了两个函数:UF_UI_select_with_class_dialog( );UF_MODL_create_thru_curves ( );可能是我给函数的赋值不争取吧?不过第一个函数调用我想没有问题,因为selection class的对话框是可以显示出来的。下面就是我使用uistlyer建立的按钮的回调函数代码:
int CHANGE_action_0_act_cb ( int dialog_id,
void * client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
char cue[] = "Select Curves";
char title[] = "SELECTION";
int response, count;
tag_p_t objects;
//B_surface的各项参数
UF_STRING_t s_section,s_spine;
int patch=2;//B-spline
int alignment=1;//Parameter alignment
double value[ 6 ]={0,0,0,0,0,0};//Data for alignment method
int vdegree;//Degree of surface in V direction;0 < vdegree <= (s_section.num-1)
int vstatus=0;//Open Surface
int body_type=0;//Sheet
UF_FEATURE_SIGN boolean=UF_NULLSIGN;//create new target solid
double tol[ 3 ]={0.001,0.001,0.001};//Tolerances
tag_t c_face_id[ 2 ];//[0] = first section string;[1] = last section string
int c_flag[ 2 ]={0,0};
tag_t body_obj_id=NULL_TAG;
/* Make sure User Function is available. */
if(UF_UI_select_with_class_dialog(
cue, title, UF_UI_SEL_SCOPE_WORK_PART,
NULL, NULL, &response, &count, &objects) == 0)
{
UF_MODL_create_string_list(count,count,[$s_section)]
s_section.num=count;
for(int j=0;j<count;j++)
{
s_section.string[j]=1;
s_section.dir[j]=1;
s_section.id[j]=objects[j];
}
s_spine.num=0;
c_face_id[0]=objects[0];
c_face_id[1]=objects[count-1];
if(count<=1)
return -1;
else if(count==2)
vdegree=1;
else if(count==3)
vdegree=2;
else
vdegree=3;
if (response == UF_UI_OK)
{
for (i=0; i<count; i++)
{
UF_DISP_set_highlight(objects, 0);
}
UF_MODL_create_thru_curves (
&s_section,
&s_spine,
&patch,
&alignment,
value,
&vdegree,
&vstatus,
&body_type,
boolean,
tol,
c_face_id,
c_flag,
[$body_obj_id )]
UF_MODL_free_string_list([$s_section)]
UF_free(objects);
}
}
UF_terminate ();
} |