马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
代码编译生成通过了,结果在UG里加载运行后不出结果..我想按长度延伸一个曲面,选择了已有曲面的一条边,但是好像函数返回值是11(正常是0),查了UF_MODL_error.h 好像是LIST_SMALLER_THEN_INDEX 不明白,大家帮忙看看吧
- #include <stdio.h>
- #include <malloc.h>
- #include <uf.h>
- #include <uf_ui.h>
- #include <uf_disp.h>
- #include <uf_modl.h>
- #include <uf_modl_trex.h>
- #include <uf_modl_form_features.h>
- #define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
- static int report_error( char *file, int line, char *call, int irc)
- {
- if (irc)
- {
- char err[133],
- msg[133];
- sprintf_s(msg, 64,"*** ERROR code %d at line %d in %s:\n+++ ",
- irc, line, file);
- UF_get_fail_message(irc, err);
- UF_print_syslog(msg, FALSE);
- UF_print_syslog(err, FALSE);
- UF_print_syslog("\n", FALSE);
- UF_print_syslog(call, FALSE);
- UF_print_syslog(";\n", FALSE);
- if (!UF_UI_open_listing_window())
- {
- UF_UI_write_listing_window(msg);
- UF_UI_write_listing_window(err);
- UF_UI_write_listing_window("\n");
- UF_UI_write_listing_window(call);
- UF_UI_write_listing_window(";\n");
- }
- }
- return(irc);
- }
- static void do_ugopen_api(void)
- {
- ////////
- char cue[] = "Select Objects";
- char title[] = "User Title";
- int response, count;
- tag_p_t objects;
- ///////
- char buffer[1000];
- int algorithm_version;
- UF_MODL_TREX_appl_data_p_t f_data;
- UF_MODL_TREX_data_set_p_t targets[1];
- UF_MODL_TREX_extend_method_t method;
- UF_MODL_TREX_to_option_t t_option;
- UF_MODL_TREX_region_option_t r_option;
- int make_coner=0;
- int keep_boundaries=0;
- int extract_sheets= 0;
- double dist_tol=0.5;
- tag_t f_tag=NULL_TAG;
- long i,k,m;
- targets[0]=(UF_MODL_TREX_data_set_p_t)malloc(sizeof(UF_MODL_TREX_data_set_t));
- f_data = (UF_MODL_TREX_appl_data_p_t)malloc(sizeof(UF_MODL_TREX_appl_data_t));
- ///////////////////
- if((UF_CALL(UF_UI_select_with_class_dialog(
- cue, title, UF_UI_SEL_SCOPE_WORK_PART,
- NULL, NULL, &response, &count,&objects))) == 0) /////////objects中我选择了已有曲面的一条边
- {
- if (response == UF_UI_OK && count > 0)
- {
- k=UF_MODL_TREX_init_trex_data(f_data);
- m=UF_MODL_TREX_init_trex_data_set(targets[0]);
- method= UF_MODL_TREX_NATURAL;
- r_option = UF_MODL_TREX_KEEP;
- t_option = UF_MODL_TREX_DISTANCE;
- algorithm_version= UF_MODL_TREX_ALGORITHM_NONE;
- dist_tol=0.5;
- extract_sheets= 0;
- keep_boundaries=0;
- make_coner=0;
- targets[0]->collector = objects[0];
- targets[0]->offset_val = 0;
- targets[0]->reversed = 0;
- targets[0]->extend_val= 10;
- UF_DISP_set_highlight(targets[0]->collector, 0);
- UF_free(objects);
- f_data->targets = targets;
- f_data->dist_tol = dist_tol;
- f_data->extend_method =method;
- f_data->make_corner = make_coner;
- f_data->num_targets = 1;
- f_data->num_tools = 0;
- f_data->region_option = r_option;
- f_data->keep_boundaries = keep_boundaries;
- f_data->to_option = t_option;
- f_data->algorithm_version = algorithm_version;
- i=UF_MODL_TREX_create_trex_feature(f_data,&f_tag);
- UF_UI_open_listing_window();
- sprintf_s(buffer,64,"%ld\n",i); //////////这块我输出了上面函数返回值 显示是11 查了下UF_MODL_error.h
- //////////发现是LIST_SMALLER_THEN_INDEX 也搞不懂
- UF_UI_write_listing_window(buffer);
- UF_MODL_TREX_free_trex_data(f_data);
- }
- }
- }
- extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
- {
- /* Initialize the API environment */
- if( UF_CALL(UF_initialize()) )
- {
- /* Failed to initialize */
- return;
- }
- do_ugopen_api();
- /* TODO: Add your application code here */
- /* Terminate the API environment */
- UF_CALL(UF_terminate());
- }
- extern int ufusr_ask_unload( void )
- {
- return( UF_UNLOAD_UG_TERMINATE );
- }
复制代码
|