找回密码 注册 QQ登录
开思网工业级高精度在线3D打印服务

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?在线3D打印服务,一键上传,自动报价 
查看: 15794|回复: 0
打印 上一主题 下一主题

[求助] 大家帮帮忙,看看我这段代码!

[复制链接]
跳转到指定楼层
1
发表于 2012-4-17 15:38:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
代码编译生成通过了,结果在UG里加载运行后不出结果..我想按长度延伸一个曲面,选择了已有曲面的一条边,但是好像函数返回值是11(正常是0),查了UF_MODL_error.h  好像是LIST_SMALLER_THEN_INDEX  不明白,大家帮忙看看吧


  1. #include <stdio.h>

  2. #include <malloc.h>

  3. #include <uf.h>

  4. #include <uf_ui.h>

  5. #include <uf_disp.h>

  6. #include <uf_modl.h>

  7. #include <uf_modl_trex.h>

  8. #include <uf_modl_form_features.h>











  9. #define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))



  10. static int report_error( char *file, int line, char *call, int irc)

  11. {

  12. if (irc)

  13. {

  14. char err[133],

  15. msg[133];

  16. sprintf_s(msg, 64,"*** ERROR code %d at line %d in %s:\n+++ ",

  17. irc, line, file);

  18. UF_get_fail_message(irc, err);

  19. UF_print_syslog(msg, FALSE);

  20. UF_print_syslog(err, FALSE);

  21. UF_print_syslog("\n", FALSE);

  22. UF_print_syslog(call, FALSE);

  23. UF_print_syslog(";\n", FALSE);



  24. if (!UF_UI_open_listing_window())

  25. {

  26. UF_UI_write_listing_window(msg);

  27. UF_UI_write_listing_window(err);

  28. UF_UI_write_listing_window("\n");

  29. UF_UI_write_listing_window(call);

  30. UF_UI_write_listing_window(";\n");

  31. }

  32. }



  33. return(irc);

  34. }



  35. static void do_ugopen_api(void)

  36. {

  37. ////////



  38. char cue[] = "Select Objects";

  39. char title[] = "User Title";

  40. int response, count;

  41. tag_p_t objects;





  42. ///////

  43. char buffer[1000];

  44. int algorithm_version;

  45. UF_MODL_TREX_appl_data_p_t f_data;

  46. UF_MODL_TREX_data_set_p_t targets[1];

  47. UF_MODL_TREX_extend_method_t method;

  48. UF_MODL_TREX_to_option_t t_option;

  49. UF_MODL_TREX_region_option_t r_option;

  50. int make_coner=0;

  51. int keep_boundaries=0;

  52. int extract_sheets= 0;

  53. double dist_tol=0.5;

  54. tag_t f_tag=NULL_TAG;

  55. long i,k,m;



  56. targets[0]=(UF_MODL_TREX_data_set_p_t)malloc(sizeof(UF_MODL_TREX_data_set_t));

  57. f_data = (UF_MODL_TREX_appl_data_p_t)malloc(sizeof(UF_MODL_TREX_appl_data_t));







  58. ///////////////////

  59. if((UF_CALL(UF_UI_select_with_class_dialog(

  60. cue, title, UF_UI_SEL_SCOPE_WORK_PART,

  61. NULL, NULL, &response, &count,&objects))) == 0) /////////objects中我选择了已有曲面的一条边

  62. {

  63. if (response == UF_UI_OK && count > 0)

  64. {

  65. k=UF_MODL_TREX_init_trex_data(f_data);

  66. m=UF_MODL_TREX_init_trex_data_set(targets[0]);





  67. method= UF_MODL_TREX_NATURAL;

  68. r_option = UF_MODL_TREX_KEEP;

  69. t_option = UF_MODL_TREX_DISTANCE;

  70. algorithm_version= UF_MODL_TREX_ALGORITHM_NONE;

  71. dist_tol=0.5;

  72. extract_sheets= 0;

  73. keep_boundaries=0;

  74. make_coner=0;

  75. targets[0]->collector = objects[0];

  76. targets[0]->offset_val = 0;

  77. targets[0]->reversed = 0;

  78. targets[0]->extend_val= 10;

  79. UF_DISP_set_highlight(targets[0]->collector, 0);





  80. UF_free(objects);

  81. f_data->targets = targets;

  82. f_data->dist_tol = dist_tol;

  83. f_data->extend_method =method;

  84. f_data->make_corner = make_coner;

  85. f_data->num_targets = 1;

  86. f_data->num_tools = 0;

  87. f_data->region_option = r_option;

  88. f_data->keep_boundaries = keep_boundaries;

  89. f_data->to_option = t_option;

  90. f_data->algorithm_version = algorithm_version;



  91. i=UF_MODL_TREX_create_trex_feature(f_data,&f_tag);

  92. UF_UI_open_listing_window();

  93. sprintf_s(buffer,64,"%ld\n",i); //////////这块我输出了上面函数返回值 显示是11 查了下UF_MODL_error.h

  94. //////////发现是LIST_SMALLER_THEN_INDEX 也搞不懂

  95. UF_UI_write_listing_window(buffer);

  96. UF_MODL_TREX_free_trex_data(f_data);

  97. }

  98. }



  99. }







  100. extern DllExport void ufusr( char *parm, int *returnCode, int rlen )

  101. {

  102. /* Initialize the API environment */

  103. if( UF_CALL(UF_initialize()) )

  104. {

  105. /* Failed to initialize */

  106. return;

  107. }

  108. do_ugopen_api();

  109. /* TODO: Add your application code here */



  110. /* Terminate the API environment */

  111. UF_CALL(UF_terminate());

  112. }





  113. extern int ufusr_ask_unload( void )

  114. {

  115. return( UF_UNLOAD_UG_TERMINATE );

  116. }

复制代码

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-9-20 05:39 , Processed in 0.021954 second(s), 13 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表