点击查看详细介绍

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

misnn 9年前 600 0

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


函数结构:
UF_STD_set_default_vrml_params
(
UF_STD_vrml_params_p_t params
)

函数说明:
初始化使用默认VRML进口PARAMS数据结构参数值。

函数参数:
第1个参数为输出:
params代表参数变量,UF_STD_vrml_params_p_t 为输出参数类型,默认VRML导入参数

UF_STD_set_default_vrml_params函数实例代码演示:
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_std.h>
#include <uf_part.h>
#include <uf_modl.h>
#define VRML_FILENAME "vrml_test.wrl"
/*-------------------------------------------------------------*/
static int vrml_example ( void );
static int create_part ( logical populate_ug_file );
/*-------------------------------------------------------------*/
extern void ufusr( char *param, int *retcod, int param_len )
{
UF_initialize();
*retcod = vrml_example();
UF_terminate();
}
/*-------------------------------------------------------------*/
static int vrml_example( void )
{
UF_STD_vrml_params_t params;
char error_msg[133];
tag_p_t topologies;
int errors;
int warnings;
int n_topologies;
int ifail;
int indx;
ifail = create_part ( TRUE );
if (ifail == 0)
{
ifail = create_part ( FALSE );
if (ifail == 0)
{
ifail = UF_STD_set_default_vrml_params ( ¶ms );
if (ifail == 0)
{
params.hide_smooth_edges = FALSE;
params.unit_size = UF_STD_UNITS_MM;
ifail = UF_STD_import_vrml_file( VRML_FILENAME,
¶ms,
&errors,
&warnings,
&n_topologies,
&topologies );
if ( n_topologies > 0 )
{
printf("Topology tags:\n");
for (indx = 0; indx < n_topologies; indx++)
printf("%u ",topologies[indx]);
printf("\n");
}
UF_free ( topologies );
}
}
}
if ( ifail != 0 )
{
UF_get_fail_message( ifail, error_msg );
printf( "ERROR: %s\n", error_msg );
}
return 0;
}
/*-------------------------------------------------------------*/
/* Create a UG part file. If populate_ug_file is set TRUE, the
file is populated with a cylinder and two spheres. As well,
a VRML file (VRML_FILENAME) is generated from the part file.
*/
static int create_part (
logical populate_ug_file)
{
double origin[3] = { 0.0, -1.0, 0.0 };
double direction[3] = { 0.0, 1.0, 0.0 };
tag_t part;
tag_t primitive_obj_id;
int units = 2;
int ifail;
if (populate_ug_file == TRUE)
ifail = UF_PART_new("ug_generated_file", units, &part);
else
ifail = UF_PART_new("vrml_imported_file", units, &part);
if (ifail == 0 && populate_ug_file == TRUE)
{
ifail = UF_MODL_create_cyl1( UF_NULLSIGN,
origin,
"2.0",
"1.0",
direction,
&primitive_obj_id );
if (ifail == 0)
{
origin[1] = origin[1] - 0.25;
ifail = UF_MODL_create_sphere1( UF_NULLSIGN,
origin,
"1.5",
&primitive_obj_id );
if (ifail == 0)
{
origin[1] = origin[1] + 2.5;
ifail = UF_MODL_create_sphere1 ( UF_NULLSIGN,
origin,
"1.5",
&primitive_obj_id
);
if (ifail == 0)
ifail = UF_STD_create_vrml_file (
VRML_FILENAME, 1.0, UF_STD_OUTPUT_MATERIALS );
}
}
}
return ifail;
}


[/quote]

0

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