标题:【求助】哪位高手帮我看看这段代码哪出错了,与UG对接的
只看楼主
youxin123
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2016-5-9
结帖率:0
已结贴  问题点数:10 回复次数:4 
【求助】哪位高手帮我看看这段代码哪出错了,与UG对接的
/*****************************************************************************
**
** NX8_Open1.c
**
** Description:
**     Contains Unigraphics entry points for the application.
**
*****************************************************************************/

/* Include files */
#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
#include"stdio.h"
#include"math.h"
#include"string.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[133],
             msg[133];

        sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
            irc, line, file);
        UF_get_fail_message(irc, err);

        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);
}


/*****************************************************************************
**  Activation Methods
*****************************************************************************/
/*  Unigraphics Startup
**      This entry point activates the application at Unigraphics startup */
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
{
    /* Initialize the API environment */
    if( UF_CALL(UF_initialize()) )
    {
        /* Failed to initialize */
        return;
    }
   
    /* TODO: Add your application code here */

FILE*fp;
int i,gcode;
char fname[14],gvalue[65];
float xs[100],ys[100],zs[100],xe[100],ye[100],ze[100];
int scanline();
int outline();
void main()
{
    int n;
    i=0;
    scanline();
    printf("Enter data file name:");
    scanf("%s",fname);
    fp=fopen(fname,"w");
    fprintf(fp,"%d\n",i);
    for(n=1;n<=i;n++)
    {fprintf(fp,"%f,%f,%f\n",xs[n],ys[n],zs[n]);
    fprintf(fp,"%f,%f,%f\n",xe[n],ye[n],ze[n]);
    }
    fclose(fp);
}
int scanline()
{
    printf("Enter DXF file name:");
    scanf("%s",fname);
    strcat(fname,".dxf");
    fp=fopen(fname,"r");
    do{fscanf(fp,"%d",&gcode);
    fscanf(fp,"%s",gvalue);
    }while(gcode!=2||strcmp(gvalue,"ENTITIES")!=0);
    do{fscanf(fp,"%d",&gcode);
    fscanf(fp,"%s",gvalue);
    if(gcode==0&&strcmp(gvalue,"LINE")==0)outline();
    }while(gcode!=0||strcmp(gvalue,"ENDSEC")!=0);
    fclose(fp);
    return 0;
}
int outline()
{
    do{fscanf(fp,"%d",&gcode);
    if(gcode==10)
    {
        i=i+1;
        fscanf(fp,"%f",&xs[i]);
    }
    else
        fscanf(fp,"%s",gvalue);
    }while(gcode!=10);
    fscanf(fp,"%d",&gcode);
    fscanf(fp,"%f",&ys[i]);
    fscanf(fp,"%d",&gcode);
    fscanf(fp,"%f",&zs[i]);
    fscanf(fp,"%d",&gcode);
    fscanf(fp,"%f",&xe[i]);
    fscanf(fp,"%d",&gcode);
    fscanf(fp,"%f",&ye[i]);
    fscanf(fp,"%d",&gcode);
    fscanf(fp,"%f",&ze[i]);
    return 0;
}
    /* Terminate the API environment */
    UF_CALL(UF_terminate());
}

/*****************************************************************************
**  Utilities
*****************************************************************************/

/* Unload Handler
**     This function specifies when to unload your application from Unigraphics.
**     If your application registers a callback (from a MenuScript item or a
**     User Defined Object for example), this function MUST return
**     "UF_UNLOAD_UG_TERMINATE". */
extern int ufusr_ask_unload( void )
{
    return( UF_UNLOAD_UG_TERMINATE );
}
搜索更多相关主题的帖子: files points include 
2016-05-09 19:31
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:4 
缺文件,好象不完整,什么开发环境写的代码?
2016-05-09 20:02
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
得分:4 
#include <uf.h> 提示说没有这个文件

其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2016-05-10 04:26
youxin123
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2016-5-9
得分:0 
回复 楼主 youxin123
做UG二次开发的,调试了好久,总说出错
2016-05-10 10:01
grmmylbs
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:54
帖 子:1409
专家分:5845
注 册:2016-2-14
得分:4 
能不能把完整的工程打包发上来
2016-05-10 10:07



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-464575-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.199476 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved