|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
程序实现的功能是:鼠标选取一个面的边线,然后在面上偏移一个距离~
调试的时候总是内存冲突~
用到的函数
UF_CURVE_create_ocf_feature(&offset_data,feature);
哪位大哥大姐帮我看看吧~!
程序代码如下:
#include "StdAfx.h"
#include "Main.h"
#include <math.h>
#include <windows.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int init_proc3(UF_UI_selection_p_t select,void* user_data)
{
int num_triples=1;
UF_UI_mask_t mask[] = //{{UF_solid_type,UF_solid_face_subtype,UF_UI_SEL_FEATURE_ANY_FACE},
//{UF_solid_type,0,UF_UI_SEL_FEATURE_BODY}};
{UF_solid_type,0,UF_UI_SEL_FEATURE_ANY_EDGE};
//{ UF_spline_type, 0, 0 };
if((UF_UI_set_sel_mask(select,
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
num_triples, mask))== 0)
{
return (UF_UI_SEL_SUCCESS);
}
else
{
return (UF_UI_SEL_FAILURE);
}
}
UF_MB_cb_status_t Application1(
UF_MB_widget_t widget,
UF_MB_data_t client_data,
UF_MB_activated_button_p_t button)
{ if(UF_initialize()!=0)
return(UF_MB_CB_CONTINUE);
char cue[] = "偏移边线";
char title[] = "选择边线";
int response;
tag_t edge,view;
tag_t face=NULL_TAG;
double cursor[3];
if((UF_UI_select_with_single_dialog(cue,title,
UF_UI_SEL_SCOPE_NO_CHANGE, init_proc3, NULL,
&response, &edge, cursor, &view))!=0)
{
if (response == UF_UI_OBJECT_SELECTED ||
response == UF_UI_OBJECT_SELECTED_BY_NAME)
{
printf("object tag = %d\n", edge);
if (response == UF_UI_OBJECT_SELECTED)
{
printf("view = %d\n", view);
printf("cursor position = %f %f %f\n",
cursor[0], cursor[1], cursor[2]);
}
/* unhighlight selected object */
UF_DISP_set_highlight(edge,1);
}
}
uf_list_p_t face_list;
UF_MODL_create_list(&face_list);
UF_MODL_ask_edge_faces(edge,&face_list);
UF_MODL_ask_list_item(face_list, 0, &face);
UF_MODL_delete_list(&face_list);
UF_CURVE_ocf_data_t offset_data;
tag_t* feature;
UF_CURVE_ocf_string_data_t string_data;
string_data.string_tag = edge;
string_data.offset_direction = 1;
string_data.num_offsets = 1;
string_data.offset_distances=new UF_CURVE_ocf_values_t;
strcpy(string_data.offset_distances->string,"5.0000");
offset_data.face_data=new UF_CURVE_ocf_face_data_t;
offset_data.face_data->face_tag = face;
offset_data.string_data=new UF_CURVE_ocf_string_data_t;
offset_data.string_data = &string_data;
offset_data.num_string_data = 1;
offset_data.cross_boundary_mode = UF_CURVE_OCF_CROSS_BOUNDARIES;
offset_data.offset_method = UF_CURVE_OCF_CHORDAL;
offset_data.trim_method =UF_CURVE_OCF_TANGENT;
offset_data.span_method = UF_CURVE_OCF_SPAN_NONE;
offset_data.dist_tol = 0.025;
offset_data.ang_tol = 0.5;
offset_data.string_tol = 0.025;
int irc=UF_CURVE_create_ocf_feature(&offset_data,feature);
TRACE("%d",irc);
char messg[133];
UF_get_fail_message(irc,messg);
UF_terminate();
return(UF_MB_CB_CONTINUE);
} |
|