点击查看详细介绍

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

misnn 9年前 766 0

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


函数结构:
UF_PS_ask_object_of_ps_tag
(
tag_t ps_tag,
tag_t * obj_id
)

函数说明:
获取对应于一个给定的在NX对象标识符Parasolid的标签。返回的对象标识符是总是向原型对象。如果没有找到一个对象标识符的Parasolid标签,返回NULL_TAG。此功能的目的是通过使用站点,直达的Parasolid实体建模。

函数参数:
第1个参数为输入:
ps_tag代表参数变量,tag_t 为输入参数类型,该标签的Parasolid查找

第2个参数为输出:
obj_id代表参数变量,tag_t * 为输出参数类型,对应于输入的Parasolid标签在NX对象标识符。 NULL TAG =找不到对象标识符对应于特定的Parasolid标签。

UF_PS_ask_object_of_ps_tag函数实例代码演示:
下面的例子是一个内部UG/ Open API的程序。块原语是在一个新创建的。该实体对象标识符是对于该块的特征的对象标识符获得。此标识符然后转化成其相应的Parasolid标签,准备调用的Parasolid实体建模程序。该标签的Parasolid然后转换回块的对象标识符。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_modl.h>
#include <uf_part.h>
#include <uf_ui.h>
#include <uf_ps.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)
{
int units = UF_PART_METRIC;
char *part_name = "ps_sample";
char buffer[133];
char *block_len[3] = {"10","10","5"};
tag_t part,block_feat_id,block_body_id,ps_tag, ug_tag;
double block_origin[3] = {0.0,0.0,0.0};

UF_FEATURE_SIGN sign = UF_NULLSIGN;
/* Create a new part. */
UF_CALL(UF_PART_new(part_name,units,&part));
/*create a block that is 10 x 10 x 5*/
UF_CALL(UF_MODL_create_block1(sign,block_origin,block_len,
&block_feat_id));
/* Convert feature object id to body object id. */
UF_MODL_ask_feat_body(block_feat_id,&block_body_id);
/* Interface with the Parasolid routines using the ps tag. */
/* Open the Information Window */
UF_UI_open_listing_window();
/* Obtain the Parasolid identifier for the given UG tag. */
if(UF_CALL(UF_PS_ask_ps_tag_of_object(block_body_id,
&ps_tag)))
{
return;
}
if(UF_CALL(UF_PS_ask_object_of_ps_tag(ps_tag, &ug_tag)))
{
return;
}
/* Print a report on tag information. */
sprintf(buffer,"\nThe Parasolid Tag is: %d", ps_tag);
UF_UI_write_listing_window(buffer);
sprintf(buffer, "\nThe UG tag is: %d", ug_tag);
UF_UI_write_listing_window(buffer);
sprintf(buffer, "\nThe block feature tag is: %d", block_feat_id);
UF_UI_write_listing_window(buffer);
sprintf(buffer, "\nThe solid body tag is: %d", block_body_id);
UF_UI_write_listing_window(buffer);
UF_PART_save();
}
/*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]

0

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