找回密码 注册 QQ登录
开思网工业级高精度在线3D打印服务

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?快速3D打印 手板模型CNC加工服务在线3D打印服务,上传模型,自动报价
查看: 20142|回复: 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空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
21
发表于 2003-7-13 21:25:12 | 只看该作者
应该是吧
20
发表于 2003-7-11 10:59:42 | 只看该作者
今天我发现这个向导创建的是win32动态连接库.

本帖子中包含更多资源

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

x
19
发表于 2003-7-9 13:55:51 | 只看该作者
介绍函数UserDemoHoleList()功能  
这个函数访问系统中当前零件属于孔特征的轴,然后将轴的名字和标识符写入文件visit_text.dat,最后加亮孔特征
18
发表于 2003-7-9 13:22:35 | 只看该作者
感谢zzabccn   
  
建议大家仔细看看这个例子,会有收获的
  
最后谈谈我的感想,仅供参考
   
1、用pro/e开发向导做,可能会更好一些,因为编译和链接环境已经被设置好了我们并不需要做什么,只要加一些头文件
2、用MFC AppWizard dll来做,需要对编译链接选项非常了解,我觉得把
开发向导的环境移植过去也应该可以的,那位老大有兴趣可以试试
  
3、pro/e开发向导,对MFC资源的如何引用,我不是很清楚,至少AfxMessageBox("haha");没有编译通过
  
以上这些想法和问题,期待大家有更深入的探讨
17
发表于 2003-7-9 13:05:36 | 只看该作者
在工作目录下有一个visit_test.dat
显示内容如下:

本帖子中包含更多资源

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

x
16
发表于 2003-7-9 13:03:11 | 只看该作者
点击菜单menu2
  
三个孔特征,被加亮

本帖子中包含更多资源

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

x
15
发表于 2003-7-9 13:00:06 | 只看该作者
调试成功!
加分鼓励,写出详细步骤继续加分--------by TOOL
运行结果:

本帖子中包含更多资源

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

x
14
发表于 2003-7-9 11:22:15 | 只看该作者
这个向导我有的,好我试试
13
发表于 2003-7-9 11:03:09 | 只看该作者
我还没有解决
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

GMT+8, 2025-4-27 19:40 , Processed in 0.025593 second(s), 12 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2025 www.iCAx.org

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