购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:
UF_MODL_ask_datum_plane_parms
(
tag_t feature_obj_id,
double origin [ 3 ],
double normal [ 3 ],
char * * offset,
char * * angle
)
函数说明:
获取基准面参数。平面中心和正常中给出3浮点数的第一阵列X的值元件中,Y在第二和第三态。偏移参数从飞机从平面的距离和偏移角返回这就需要表达格式使用UF_free被释放。 如果这两个参数是不适用的,所述指针为NULL。获取并打印出所选基准平面的参数。
函数参数:
第1个参数为输入:
feature_obj_id代表参数变量,tag_t 为输入参数类型,基准面特征对象标识符。
第2个参数为输出:
输出double 双精度类型的参数,参数的变量格式为origin [ 3 ],基准面中心。
第3个参数为输出:
输出double 双精度类型的参数,参数的变量格式为normal [ 3 ],基准面正常。
第4个参数为输出:
输出char * * 字符类型的参数,参数的变量格式为offset,从平面偏移距离。这必须通过调用UF_free释放。
第5个参数为输出:
输出char * * 字符类型的参数,参数的变量格式为angle,抵消平面角。这必须通过调用UF_free释放。
UF_MODL_ask_datum_plane_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)
{
char *offset = NULL, *angle = NULL;
tag_t dplane, 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_plane_type, 0, 0};/* Only allow datum plane 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 plane in displayed part to inquire on */
error = UF_UI_select_single("Select a datum plane", &opts,
&response, &dplane, 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(dplane, &ftag) );
UF_CALL( UF_MODL_ask_datum_plane_parms(ftag, origin, normal,
&offset, &angle));
for (i=0;i<3;i++)
{
printf("origin=%f, normal=%f\n",origin[i],normal[i]);
}
if(angle != NULL)
{
printf("angle = %s\n", angle);
}
if(offset != NULL)
{
printf("offset=%s\n",offset);
}
/* unhighlight selected plane */
UF_CALL(UF_DISP_set_highlight(dplane,zero));
UF_free(offset);
UF_free(angle);
}
}
/*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);
}