购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_PS_ask_ps_tag_of_object( tag_t obj_id, tag_t * ps_tag) 函数说明:
获取对应于给定的对象标识符的Parasolid标记。这个命令接受实心体,固边或实体面对象标识符。当对象标识符指的是一个物体出现,对应于原型对象的Parasolid标签被返回。如果没有找到一个的Parasolid标签的对象标识符,一个NULL_TAG返回。注:此命令是为了通过网站直接使用访问的Parasolid实体建模。
函数参数:
第1个参数为输入:
obj_id代表参数变量,tag_t 为输入参数类型,对象标识符来查找
第2个参数为输出:
ps_tag代表参数变量,tag_t * 为输出参数类型,对应于输入对象标识符的Parasolid标记。 NULL_TAG=找不到的Parasolid标签对应于给定对象标识符。
UF_PS_ask_ps_tag_of_object函数实例代码演示:
下面的例子是一个内部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]