购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_PART_reopen( tag_t part, int scope, int mode, tag_t * new_part) 函数说明:
卸载和重装是在磁盘上的不同部分(已在磁盘上修改或会话)。如果范围标记设置为做子组件,那么所有在给定的部分是不同的零件上的磁盘被重新打开。零件是最新的与什么是磁盘上的跳过。如果模式标记被设置为不重新打开被修改部件在会议上,那么已在会议上被修改部分跳过。使用内部时0模式值才有效开放API。如果使用此选项,则确认对话框出现对于已经在会话被修改的部分,以确认用户真的想失去他们的变化。
函数参数:
第1个参数为输入:
part代表参数变量,tag_t 为输入参数类型,部分标签重新开放
第2个参数为输入:
输入int 整数型的参数,参数的变量格式为scope,0=仅指定部分1=部件和所有组件
第3个参数为输入:
输入int 整数型的参数,参数的变量格式为mode,0 =询问确认,如果部分被修改1 =即使重新打开,如果修改了会议2=重新开放部分(S)仅在会议上不修改
第4个参数为输出:
new_part代表参数变量,tag_t * 为输出参数类型,如果重新打开未在装配中使用的部分,这是由部分不同。
UF_PART_reopen函数实例代码演示:
这个例子创建并保存的空白部分,然后进行一些修改。修改后,重新开放的部分。 结果应该是一个开放的,空白部分。1.创建一个名为a_blank_part.prt新零件2.保存,没有几何形状的一部分。3.创建一些几何。4.重新打开部分。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_defs.h>
#include <uf_part.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)
{
/* scope and mode are for UF_PART_reopen. Scope = 0
sets the scope for the part only and excludes
subassemblies. Mode = 1 means reopen even if
modified in the session.
*/
int scope = 0;
int mode = 1;
char *edge_len[] = {"1.0","1.0","1.0"};
double corner_pt[] = {0.0,0.0,0.0};
tag_t block_tag;
tag_t part_tag;
tag_t reopen_part_tag;
/* Open a new part then save it. */
UF_CALL(UF_PART_new("a_blank_part.prt",UF_PART_ENGLISH,&part_tag))
;
UF_CALL(UF_PART_save());
/* Create a unit block. This modifies the part. */
UF_CALL(UF_MODL_create_block1(UF_NULLSIGN,
corner_pt,edge_len,&block_tag));
/* Reopens unmodified part because of mode setting. */
UF_CALL(UF_PART_reopen(part_tag,scope,mode,&reopen_part_tag));
}
/*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]