马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
/*----------------------------------------------------------------*\
Pro/TOOLKIT includes
\*----------------------------------------------------------------*/
#include <roToolkit.h>
#include <roMdl.h>
#include <roFeature.h>
#include <roFeatType.h>
#include <roUtil.h>
#include <roAsmcomp.h>
#include "assembly.h"
#include "roSolid.h"
#include "test1.h"
/*----------------------------------------------------------------*\
Application includes
\*----------------------------------------------------------------*/
#include <TestError.h>
/*----------------------------------------------------------------*\
Global definitions
\*----------------------------------------------------------------*/
#define FILENAME "assembly.lst"
typedef struct user_appdata
{
FILE *fp;
int level;
} UserAppdata;
/*----------------------------------------------------------------*\
Function prototypes
\*----------------------------------------------------------------*/
int UserAsmCompVisit (void *dummy, int dummy2);
ProError UserAsmCompFilter (ProFeature *feature, ProAppData app_data);
ProError user_action (ProFeature *feature, ProError status,
 roAppData appdata);
/*================================================================*\
Function to write out the members of the current assembly, and
display the result in an information window.
\*================================================================*/
int UserAsmCompVisit (void *dummy, int dummy2)
{
 roMdl asm;
char name[PRO_NAME_SIZE];
char type[PRO_TYPE_SIZE];
wchar_t wname[PRO_NAME_SIZE];
 roMdldata mdldata;
ProError err;
UserAppdata appdata;
FILE *fp;
ProMdlCurrentGet ([$asm)]
/*----------------------------------------------------------------*\
Open the text file.
\*----------------------------------------------------------------*/
strcpy (name,FILENAME);
fp = fopen (name,"w");
ProMdlDataGet (asm, [$mdldata)]
ProWstringToString (name, mdldata.name);
ProWstringToString (type, mdldata.type);
fprintf (fp, "%s %s\n",name,type);
appdata.fp = fp;
appdata.level = 1;
/*----------------------------------------------------------------*\
List the assembly members.
\*----------------------------------------------------------------*/
// ProSolidFeatVisit (asm, user_action, UserAsmCompFilter, [$appdata)]
/*----------------------------------------------------------------*\
Close the file and display it.
\*----------------------------------------------------------------*/
fclose (fp);
ProStringToWstring (wname, FILENAME);
ProInfoWindowDisplay (wname, NULL, NULL);
return (PRO_TK_NO_ERROR);
}
/*================================================================*\
FUNCTION: UserAsmCompFilter()
PURPOSE: A filter used by ProSolidFeatVisit() to visit
features that are assembly components
\*================================================================*/
ProError UserAsmCompFilter (
ProFeature *feature,
ProAppData app_data)
{
ProError status;
ProFeattype ftype;
/*----------------------------------------------------------------*\
Get the feature type
\*----------------------------------------------------------------*/
status = ProFeatureTypeGet (feature, [$ftype)]
/*----------------------------------------------------------------*\
If the feature is an assembly component,
return NO ERROR,
else
return CONTINUE
\*----------------------------------------------------------------*/
if (ftype == PRO_FEAT_COMPONENT)
return (PRO_TK_NO_ERROR);
return (PRO_TK_CONTINUE);
}
/*-----------------------------------------------------------------*\
Write the information to a file.
\*-----------------------------------------------------------------*/
ProError user_action (
ProFeature *feature,
ProError status,
ProAppData appdata)
{
FILE *fp;
int l, level;
ProError err;
ProMdl mdl;
char name[PRO_NAME_SIZE];
char type[PRO_TYPE_SIZE];
wchar_t wname[PRO_NAME_SIZE];
UserAppdata *appd, appd1;
ProMdldata mdldata;
appd = (UserAppdata *)appdata;
fp = appd->fp;
level = appd->level;
ProAsmcompMdlGet (feature , [$mdl)]
ProMdlDataGet (mdl, [$mdldata)]
ProWstringToString (name,mdldata.name);
ProWstringToString (type,mdldata.type);
for (l = 0; l < level; l++)
fprintf(fp," ");
fprintf (fp,"%s %s\n",name,type);
if (strncmp (type,"ASM",3) == 0)
{
appd1.fp = appd->fp;
appd1.level = appd->level+1;
ProSolidFeatVisit (mdl, user_action, UserAsmCompFilter, [$appd1)]
}
if (feature != NULL)
return(PRO_TK_NO_ERROR);
return (PRO_TK_CONTINUE);
}
上面为后缀为.c文件,调试时出现如下错误,请哪为大虾帮帮忙。
fatal error C1010: unexpected end of file while looking for precompiled header directive |