点击查看详细介绍

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

misnn 8年前 868 0

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


函数结构:
UF_MODL_ask_datum_axis_parms
(
tag_t feature_id,
double origin [ 3 ],
double normal [ 3 ]
)

函数说明:
获取基准轴的参数。

函数参数:
第1个参数为输入:
feature_id代表参数变量,tag_t 为输入参数类型,对于基准轴特性标签

第2个参数为输出:
输出double 双精度类型的参数,参数的变量格式为origin [ 3 ],基准轴基点

第3个参数为输出:
输出double 双精度类型的参数,参数的变量格式为normal [ 3 ],基准轴线方向

UF_MODL_ask_datum_axis_parms函数实例代码演示:
描述该程序演示如何使用下面的UG/ Open API的程序(S):UF_MODL_ask_datum_axis_parms项目描述下面的示例程序需要与基准面一个开放的一部分。程序获取并打印出的参数为选定 基准面。

#include <stdlib.h>
#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_disp.h>
#include <uf_modl.h>
#include <uf_ui.h>
#include <uf_object_types.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)
{
  tag_t   daxis, view, ftag; 
  int     i, error = 0, response = 2, zero = 0;
  double  cursor[3], origin[3], normal[3];
  UF_UI_selection_options_t opts;
  UF_UI_mask_t mask = {UF_datum_axis_type, 0, 0};
  
/* Only allow datum axis in the work part to be selectable */
  opts.num_mask_triples = 1;
  opts.mask_triples = &mask;
  opts.scope = UF_UI_SEL_SCOPE_WORK_PART;    
/* Ask to select a datum axis in displayed part to inquire on */
  error = UF_UI_select_single("Select a datum axis", &opts,
                              &response, &daxis, cursor, &view);
  
/* If there's no error & response is not CANCEL or BACK */
  if ( !error && response != 1 && response != 2 )
  {
     UF_CALL( UF_MODL_ask_object_feat(daxis, &ftag) );
     UF_CALL( UF_MODL_ask_datum_axis_parms(ftag, origin, normal));
       
     for (i=0;i<3;i++)
     { 
        printf("origin=%f, normal=%f\n",origin[i],normal[i]);
     }
     /* unhighlight selected plane */
     UF_CALL(UF_DISP_set_highlight(daxis,zero));
    
  }
}
/*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)
请登录后发表新帖