点击查看详细介绍

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

misnn 9年前 870 0

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


函数结构:
UF_PS_write_to_journal
(
char * journal_commt
)

函数说明:
写入指定的字符串到的Parasolid日志文件。该字符串被写入到日志文件中的80组字符或直到遇到空字符。 人物字符串可以写出只有当日记中的Parasolid日志文件已启用。如果未启用的Parasolid日志时NX会话终止,日志文件被删除,并且所有的数据文件丢失。

函数参数:
第1个参数为输入:
输入char * 字符类型的参数,参数的变量格式为journal_commt,字符串被写入的Parasolid日志文件

UF_PS_write_to_journal函数实例代码演示:
下面的例子是一个内部UG/ Open API的程序调用相关的Parasolid多个UG/ Open API的命令日记。首先,Parasolid的日志和当前状态日志文件的名称被确定。日志文件的名称然后输出到标准输出设备。一旦日志是启用,字符串被写入到日志文件来描述下一组的Parasolid程序调用的。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_modl.h>
#include <uf_part.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 journal_state, units = UF_PART_METRIC;
char *part_name = "ps_sample2";
char journal_name[MAX_FSPEC_SIZE+1];
tag_t part;
/* Create a new part. */
UF_CALL(UF_PART_new(part_name, units, &part));

/* Obtain the journaling status and the journal file name. */
UF_CALL(UF_PS_ask_journal_data(&journal_state,
journal_name));
/* Print out the name of the journal file. */
printf("Journal file name = %s\n",journal_name);
/* If journaling is disabled, enable it. */
if (journal_state == 0)
{
journal_state = 1;
UF_CALL(UF_PS_set_journal_state(journal_state));
}
/* Add comment to file to reflect what is being done. */
UF_CALL(UF_PS_write_to_journal(
"** Modelling the Crank Shaft **"));
/* Save the part file. */
UF_CALL(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)
请登录后发表新帖