点击查看详细介绍

UF_MODL_ask_face_torus_type() 函数的参数解释说明、函数详细用法,以及实例代码演示

misnn 10年前 887 0

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


函数结构:
UF_MODL_ask_face_torus_type
(
tag_t face,
int * torus_type
)

函数说明:
返回环形表面的类型。在以下的说明字符串定义的常数,a是长轴,b是短轴。

函数参数:
第1个参数为输入:
face代表参数变量,tag_t 为输入参数类型,面对标签

第2个参数为输出:
输出int * 整数型的参数,参数的变量格式为torus_type,环面的类型。返回圆环的类型定义常量。例如UF_MODL圆环TORUS。

UF_MODL_ask_face_torus_type函数实例代码演示:

#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_ui.h>
#include <uf_obj.h>
#include <uf_object_types.h>
#include <uf_disp.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
  if (irc)
  {
     char    messg[133];
     printf("%s, line %d:  %s\n", file, line, call);
     (UF_get_fail_message(irc, messg)) ?
       printf("    returned a %d\n", irc) :
       printf("    returned error %d:  %s\n", irc, messg);
  }
  return(irc);
}
static void do_ugopen_api(void)
{
  char *message = "Select Object";
  char errmsg[MAX_LINE_SIZE+1];
  char buffer[UF_UI_MAX_STRING_LEN+1];
  UF_UI_selection_options_t opts;
  UF_UI_mask_t mask;
  int response, irc =0, off = 0, torus_type, ifail = 0;
  tag_t object, view;
  double cursor[3];  opts.other_options = 0;
  opts.reserved = NULL;
  opts.num_mask_triples = 1;
  opts.mask_triples = &mask;
/* set up selectable type, subtype, solid type */
  opts.mask_triples->object_type = UF_solid_type;
  opts.mask_triples->object_subtype = 0;
  opts.mask_triples->solid_type = UF_UI_SEL_FEATURE_TOROIDAL_FACE;
/* set selection scope to be work part */
  opts.scope = UF_UI_SEL_SCOPE_WORK_PART;
  irc = UF_UI_select_single(message,&opts,&response,
                          &object,cursor,&view);
/* if no error, get torus type and display type*/
  if (!irc)
  {
    ifail = UF_MODL_ask_face_torus_type ( object, &torus_type);
    UF_UI_open_listing_window();
    if (ifail)
    {
      UF_get_fail_message( ifail, errmsg);
      sprintf(buffer, "ERROR in ask torus type: %s\n", errmsg);
      UF_UI_write_listing_window(buffer);
    }
    else
    {
      switch(torus_type)
      {
        case UF_MODL_DOUGHNUT_TORUS:
          UF_UI_write_listing_window("The face is a doughnut torus.\n");
          break;
        case UF_MODL_APPLE_TORUS:
          UF_UI_write_listing_window("The face is an apple torus.\n");
          break;
        case UF_MODL_LEMON_TORUS:
          UF_UI_write_listing_window("The face is a lemon torus.\n");
          break;
        case UF_MODL_OSCULATING_APPLE_TORUS:
          UF_UI_write_listing_window("The face is an osculating torus.\n");
          break;
        default:
          UF_UI_write_listing_window("The face is not a torus.\n");
          break;
      }
    }
  /* unhighlight selected object */
    UF_DISP_set_highlight(object,off);
  }
  else  /* else get error message */
  {
    UF_get_fail_message(irc,errmsg);
    sprintf(buffer,"ERROR in single select: %s\n", errmsg);
    UF_UI_write_listing_window(buffer);
  }
}
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int param_len)
{
  if (!UF_CALL(UF_initialize()))
  {
    do_ugopen_api();
    UF_CALL(UF_terminate());
  }
}
int ufusr_ask_unload(void)
{
  return (UF_UNLOAD_IMMEDIATELY);
}


0

最新回复 (0)
请登录后发表新帖