找回密码 注册 QQ登录
一站式解决方案

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?快速3D打印 手板模型CNC加工服务在线3D打印服务,上传模型,自动报价
查看: 20065|回复: 20
打印 上一主题 下一主题

【讨论】pro/e二次开发如何实现这个函数功能

[复制链接]
跳转到指定楼层
1
发表于 2003-7-6 12:56:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
TOOl的例子里,想void Check() 功能,获取当前零件的孔的列表
  
  typedef struct surface_visit_data
{
   FILE      *fp;
   ProSolid   part;
} AxisVisitData_t;
  
/*===============================================================*\
FUNCTION:  UserDemoAxisAct()
PURPOSE :  Axis-visit action function that writes the
            axis name to a file
\*===============================================================*/
ProError UserDemoAxisAct(
     ProAxis     axis,
     ProError    filt_status,
     ProAppData  app_data)
{
     ProError          status;
     AxisVisitData_t  *p_data = (AxisVisitData_t*)app_data;
     ProSolid          part = p_data->part;
     FILE             *fp = p_data->fp;
     int               id;
     ProModelitem      modelitem;
     ProFeature        feature;
     ProFeattype       ftype;
     ProName           wname;
     char              name[PRO_NAME_SIZE];
     ProSelection      selection;
/*---------------------------------------------------------------*\
     Get the axis identifier.
\*---------------------------------------------------------------*/
     status = ProAxisIdGet (axis, [$id)]
     if (status != PRO_TK_NO_ERROR)
         return (status);
/*---------------------------------------------------------------*\
     Make a ProModelitem handle for the axis.
\*---------------------------------------------------------------*/
     status = ProModelitemInit (part, id, PRO_AXIS, [$modelitem)]
     if (status != PRO_TK_NO_ERROR)
         return (status);
/*---------------------------------------------------------------*\
     Get the feature to which the axis belongs.
\*---------------------------------------------------------------*/
     status = ProGeomitemFeatureGet ([$modelitem, &feature)]
     if (status != PRO_TK_NO_ERROR)
         return (status);
/*---------------------------------------------------------------*\
     Get the feature type.
\*---------------------------------------------------------------*/
     status = ProFeatureTypeGet ([$feature, &ftype)]
     if (status != PRO_TK_NO_ERROR)
         return (status);
/*---------------------------------------------------------------*\
     If the type was not HOLE, skip it.
\*---------------------------------------------------------------*/
  if (ftype != PRO_FEAT_HOLE )
        return (PRO_TK_NO_ERROR);
/*---------------------------------------------------------------*\
     Get the name of the axis.
\*---------------------------------------------------------------*/
     status = ProModelitemNameGet ([$modelitem, wname)]
     if (status != PRO_TK_NO_ERROR)
         return (status);
     ProWstringToString (name, wname);
/*---------------------------------------------------------------*\
     Print out the axis name and hole identifier.
\*---------------------------------------------------------------*/
     fprintf (fp, "Axis %s belongs to hole feature %d\n", name,
              feature.id);
/*---------------------------------------------------------------*\
     Highlight the owning hole.
\*---------------------------------------------------------------*/
     ProSelectionAlloc (NULL, [$feature, &selection)]
     ProSelectionHighlight (selection, PRO_COLOR_HIGHLITE);
     ProSelectionFree ([$selection)]
  
     return (PRO_TK_NO_ERROR);
}
/*===============================================================*\
FUNCTION:  UserDemoHoleList()
PURPOSE:   List the axes that belong to the hole features in
            a part, and report their names.
\*===============================================================*/
ProError UserDemoHoleList(
     ProSolid         part)
{
     ProError         status;
     AxisVisitData_t  data;
  
     data.part = part;
/*---------------------------------------------------------------*\
     Open the text file.
\*---------------------------------------------------------------*/
     data.fp = fopen ("visit_test.dat","w");
/*---------------------------------------------------------------*\
     Visit all the axes using the visit and filter functions
     above. Pass the owning solid and the text file pointer
     using the app_data argument.
\*---------------------------------------------------------------*/
     status = ProSolidAxisVisit (part, UserDemoAxisAct,
                                 NULL, (ProAppData)[$data)]
/*---------------------------------------------------------------*\
     Close the file
\*---------------------------------------------------------------*/
     fclose (data.fp);
  
     return (PRO_TK_NO_ERROR);
}
  
这个函数为帮助中的Example 5: Listing Holes in a Model  
  
如何将这段代码加入void Check()
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
2
发表于 2003-7-7 12:44:36 | 只看该作者
void Check()  
{  
  
ProError status;
ProMdl model;
     status = ProMdlCurrentGet([$model)]
UserDemoHoleList((ProSolid)model);
}
  
check()函数这样写的,获取pro/e当前模型,之后调用UserDemoHoleList()
添加必要的头文件,编译结果

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
3
发表于 2003-7-7 12:47:29 | 只看该作者
有一处错误,
PRO_FEAT_HOLE,不知在哪里定义的,
TOOL可否给看看
4
发表于 2003-7-7 12:49:26 | 只看该作者
这是所有的头文件
  
#include &ltroToolkit.h>  
#include &ltroMenu.h>  
#include &ltroMenuBar.h>  
#include &ltroUtil.h>  
#include &ltroUIDialog.h>
#include <ProUILabel.h>
#include <ProUIPushbutton.h>
#include <ProAxis.h>
#include <ProModelitem.h>
#include <ProSolid.h>
#include <ProHole.h>
#include <ProFeature.h>
5
发表于 2003-7-8 08:28:39 | 只看该作者
怎么没人回复?
6
发表于 2003-7-8 13:00:04 | 只看该作者
#include&ltroFeatType.h>
7
发表于 2003-7-8 14:21:29 | 只看该作者
看样子 ,得把下面这段调出来才行!
extern "C" void Check()
{
  FILE *fp;
  fp=fopen("test1.txt","w");
  fprintf(fp,"this file create with proetk appliction");
  fclose (fp);
}
8
发表于 2003-7-8 18:17:31 | 只看该作者
加头文件,
#include "stdio.h"
  
有两处警告,两处错误,
  
上面的老大你编译通过了吗
9
发表于 2003-7-8 22:02:32 | 只看该作者
没有,你呢?
stdio.h我加了,
10
发表于 2003-7-8 23:15:22 | 只看该作者
调不通Deleting intermediate files and output files for project 'tookit - Win32 Debug'.
--------------------Configuration: tookit - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
tookit.cpp
Linking...
   Creating library Debug/tookit.lib and object Debug/tookit.exp
LINK : warning LNK4049: locally defined symbol "_fclose" imported
LINK : warning LNK4049: locally defined symbol "_fopen" imported
tookit.obj : error LNK2001: unresolved external symbol __imp__fprintf
Debug/tookit.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...
  
tookit.dll - 2 error(s), 2 warning(s)
  
不知道怎么回事,期待高手了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2025-2-22 01:28 , Processed in 0.056055 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2025 www.iCAx.org

快速回复 返回顶部 返回列表