购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_OBJ_cycle_objs_in_part( tag_t part_tag, int type, tag_t * object) 函数说明:
返回指定类型的所有层上的零件的所有对象无论其当前displayability的状态。这个程序不返回表达式,谴责的对象,临时(创建的系统)的对象,或昏昏欲睡的对象。即睡着一个对象是一个已被从模型中删除。例如,如果混合的边缘,则边缘是睡着了。该WCS不会除非它已经保存返回。注意:这个程序周期的一部分功能,当类型指定是UF_feature_type。不要试图骑自行车在循环数据库时删除对象。问题试图读取下一个对象时,当当前对象是否已可发生删除。到删除对象,保存与对象的数组中,然后当你已经完成了骑自行车,使用UF_OBJ_delete_array_of_objects删除对象的保存阵列。
函数参数:
第1个参数为输入:
part_tag代表参数变量,tag_t 为输入参数类型,部分标记您想循环
第2个参数为输入:
输入int 整数型的参数,参数的变量格式为type,对象类型在其上循环
第3个参数为输入:
object代表参数变量,tag_t * 为输入参数类型,在输入对象通过此例程的最后一次通话中。如果这个例程没有被调用呢,然后设置对象= NULL_TAG开始骑自行车。上输出的类型的下一个对象指定。如果不存在对象,而循环完成,则返回一个NULL_TAG。
UF_OBJ_cycle_objs_in_part函数实例代码演示:
此示例需要一个开放的含部分功能。这个例子代码循环功能的一部分。
[quote]
#include <stdio.h>
#include <uf_defs.h>
#include <uf.h>
#include <uf_object_types.h>
#include <uf_obj.h>
#include <uf_part.h>
static char title0[] = "\nFeature report for part %s\n";
#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 part_fspec[MAX_FSPEC_SIZE+1];
int curr_part, num_parts;
int type;
int count_1;
tag_t part;
tag_t feature;
/* Get the total number of loaded parts. */
num_parts = UF_PART_ask_num_parts();
for ( curr_part=0 ; curr_part < num_parts ; curr_part++ )
{
/* Get the part tag for the current part number of the
loaded part and get its part name.
*/
part = UF_PART_ask_nth_part( curr_part );
UF_PART_ask_part_name( part, part_fspec );
printf( title0, part_fspec );
count_1 = 0;
type = UF_feature_type;
feature = NULL_TAG;
/* Start the cycling process by passing in a NULL_TAG. */
UF_OBJ_cycle_objs_in_part( part, type, &feature );
/* Keep cycling until there are no more features to cycle. */
while ( feature != NULL_TAG )
{
count_1++;
UF_OBJ_cycle_objs_in_part( part, type, &feature );
}
printf("UF_OBJ_cycle_objs_in_part shows %d features\n",
count_1 );
}
}
/*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);
}
[/quote]