【求助】如何将当前UG 模型转化成.JT文件
本帖最后由 ansys平安 于 2010-8-16 10:14 编辑好想通过函数UF_MOTION_export_to_product_vision()能实现,但是请高手指点参数如何设置。 各位大虾 ,,没有做的吗??? save part as and export jt file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_part.h>
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
static int report_error( char *file, int line, char *call, int irc)
{
if (irc)
{
char err,
msg;
sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
irc, line, file);
UF_get_fail_message(irc, err);
/*NOTE:UF_print_syslog is new in V18 */
UF_print_syslog(msg, FALSE);
UF_print_syslog(err, FALSE);
UF_print_syslog("\n", FALSE);
UF_print_syslog(call, FALSE);
UF_print_syslog(";\n", FALSE);
if (!UF_UI_open_listing_window())
{
UF_UI_write_listing_window(msg);
UF_UI_write_listing_window(err);
UF_UI_write_listing_window("\n");
UF_UI_write_listing_window(call);
UF_UI_write_listing_window(";\n");
}
}
return(irc);
}
static logical prompt_for_text(char *prompt, char *text)
{
int
n,
resp;
resp = uc1600(prompt, text, &n);
if (resp == 3 || resp == 5) return TRUE;
return FALSE;
}
void export_jt_of_partname(char *fspec)
{
char
cmd,
pv_dir,
prog_name,
*base_dir;
UF_CALL(UF_translate_variable("UGII_BASE_DIR", &base_dir));
UF_CALL(uc4575(base_dir, 100, "pvtrans", pv_dir));
UF_CALL(uc4575(pv_dir, 0, "ugtopv", prog_name));
sprintf(cmd, "%s %s", prog_name, fspec);
uc1601("Running jt Conversion", TRUE);
system(cmd);
}
static void do_it(void)
{
tag_t
part = UF_PART_ask_display_part();
char
part_fspec;
UF_PART_ask_part_name(part, part_fspec);
if(prompt_for_text("Save As:", part_fspec))
{
if(!UF_CALL(UF_PART_save_as(part_fspec)))
{
export_jt_of_partname(part_fspec);
}
}
}
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int paramLen)
{
if (UF_CALL(UF_initialize())) return;
do_it();
UF_terminate();
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
} 回复 3# lirui0726
请问我想不通过UG界面将指定路径的.prt文件转换成JT格式文件,应该怎么做呢?谢谢!
页:
[1]