点击查看详细介绍

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

misnn 7年前 596 0

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


函数结构:
UF_SUBDIV_ask_parms
(
tag_t subdiv_tag,
UF_SUBDIV_type_p_t subdiv_type,
UF_SUBDIV_data_structures_p_u subdiv_structure_pointer
)

函数说明:
返回用于subdiv功能的参数。给定一个subdiv特征标签,确定subdiv类型和用于该参数键入subdiv_structure_ptr结构。

函数参数:
第1个参数为输入:
subdiv_tag代表参数变量,tag_t 为输入参数类型,在subdiv功能的对象标识符

第2个参数为输出:
subdiv_type代表参数变量,UF_SUBDIV_type_p_t 为输出参数类型,subdiv功能型

第3个参数为输出:
subdiv_structure_pointer代表参数变量,UF_SUBDIV_data_structures_p_u 为输出参数类型,指针到subdiv数据结构中的一个。这必须通过调用UF_SUBDIV_free释放。

UF_SUBDIV_ask_parms函数实例代码演示:
该UF_SUBDIV_ISOCLINE类型输入一个机构,任何脸部其中应排除,一个智能对象矢量,和的字符串值角度表达;并分割沿着平衡线曲线的面孔。随后,所应用的所有面都可以归类为陡坡或相对于指定的方向和角度持平。这个示例程序创建一个简单的球,并使用它来创建和编辑subdiv平衡线功能。
[quote]
#include <stdlib.h>
#include <string.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_modl.h>
#include <uf_part.h>
#include <uf_subdiv.h>
#include <uf_ui.h>
/* ARGSUSED */
extern void ufusr (char *param, int *retcod, int param_len)
{
double sphere_origin[3]={0,1,0};
char *sphere_length = "2";
char *angle_str = "20.0"; /* Expression string */
char message[133];
char *part_name="sample";
char *feat_type;
char *subdiv_feat_type = "SUBDIVIDE_ISOCLINE";
int units=2, err;
int scope=0, close_mode=1;
tag_t part_tag, sphere_tag, subdiv_tag;
UF_SUBDIV_type_t subdiv_type;
UF_SUBDIV_data_structures_u subdiv_structure;
UF_SUBDIV_data_structures_u ask_subdiv_struct;
UF_SUBDIV_isocline_t isocline_data;
UF_SUBDIV_isocline_p_t isocline_data_ptr;
/* Initialize UG/Open API and open a new part */
UF_initialize ();
UF_PART_new (part_name, units, &part_tag);
/* Create a sphere */
UF_MODL_create_sphere1 (UF_NULLSIGN, sphere_origin,
sphere_length, &sphere_tag);
/* Set up the structures to define a subdiv feature with a
method type of isocline. */
memset ((void *)&isocline_data, (int)0,
(size_t)1*sizeof(UF_SUBDIV_isocline_t));
isocline_data.body_tag = sphere_tag;
isocline_data.excluded_faces = NULL;
isocline_data.face_count = 0;
isocline_data.direction = NULL_TAG; /* 0,0,1 WCS */
isocline_data.angle_str = angle_str;
subdiv_structure.subdiv_type1 = &isocline_data;
/* Create an isocline subdiv feature */
err = UF_SUBDIV_create (UF_SUBDIV_ISOCLINE, &subdiv_structure,
&subdiv_tag);
if (err)
{
UF_get_fail_message (err, message);
UF_UI_write_listing_window ("Error in UF_SUBDIV_create:");
UF_UI_write_listing_window (message);
}
/* Edit the subdiv isocline like we did not already
have the defining data */
UF_MODL_ask_feat_type (subdiv_tag, &feat_type);
if (strcmp (feat_type, subdiv_feat_type) == 0)
{
/* Find the type of subdiv */
err = UF_SUBDIV_ask_type (subdiv_tag, &subdiv_type);
if (err)
{
UF_get_fail_message (err, message);
UF_UI_write_listing_window ("Error in UF_SUBDIV_ask_type:");
UF_UI_write_listing_window (message);
}
/* Or, get the subdiv type and parms together */
err = UF_SUBDIV_ask_parms (subdiv_tag, &subdiv_type,
&ask_subdiv_struct);
if (err)
{
UF_get_fail_message (err, message);
UF_UI_write_listing_window ("Error in UF_SUBDIV_ask_parms:");
UF_UI_write_listing_window (message);
}
switch (subdiv_type)
{
case UF_SUBDIV_ISOCLINE:
{
char *new_angle_str = "30.0";
isocline_data_ptr = ask_subdiv_struct.subdiv_type1;
isocline_data_ptr->angle_str = new_angle_str;
break;
}
default:
break;
}
/* Edit the feature to the new definition */
err = UF_SUBDIV_edit (subdiv_type, &ask_subdiv_struct,
subdiv_tag);
if (err)
{
UF_get_fail_message (err, message);
UF_UI_write_listing_window ("Error in UF_SUBDIV_edit:");
UF_UI_write_listing_window (message);
}
/* Cleanup */
err = UF_SUBDIV_free (subdiv_type, &ask_subdiv_struct);
if (err)
{
UF_get_fail_message (err, message);
UF_UI_write_listing_window ("Error in UF_SUBDIV_free:");
UF_UI_write_listing_window (message);
}
}
/* Save and close the part. */
UF_PART_save ();
UF_PART_close (part_tag, scope, close_mode);
UF_terminate ();
}


[/quote]

0

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