iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 27602|回复: 20
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
楼主
发表于 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空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
 楼主| 发表于 2003-7-7 12:44:36 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
板凳
 楼主| 发表于 2003-7-7 12:47:29 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
地板
 楼主| 发表于 2003-7-7 12:49:26 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
5
 楼主| 发表于 2003-7-8 08:28:39 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
6
发表于 2003-7-8 13:00:04 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
7
发表于 2003-7-8 14:21:29 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
8
 楼主| 发表于 2003-7-8 18:17:31 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
9
发表于 2003-7-8 22:02:32 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
10
 楼主| 发表于 2003-7-8 23:15:22 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-6-2 23:36 , Processed in 0.016082 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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