CAA插件的开发方法(CATIA二次开发).doc_第1页
CAA插件的开发方法(CATIA二次开发).doc_第2页
CAA插件的开发方法(CATIA二次开发).doc_第3页
CAA插件的开发方法(CATIA二次开发).doc_第4页
CAA插件的开发方法(CATIA二次开发).doc_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

插件的开发方法2004-8-24一、创建插件接口1.1 头文件如:#ifndef CAAIAfrGeoCreationWkbAddin_h#define CAAIAfrGeoCreationWkbAddin_h/ ApplicationFrame Framework#include / Needed to derive from CATIWorkbenchAddin/ Local Framework#include CAAAfrGeoCreationWbench.h / Needed to export the IID/ Global Unique IDentifier defined in .cpp / exported by CAAAfrGeoCreationWbenchextern IID ExportedByCAAAfrGeoCreationWbench IID_CAAIAfrGeoCreationWkbAddin;class ExportedByCAAAfrGeoCreationWbench CAAIAfrGeoCreationWkbAddin : public CATIWorkbenchAddin / Used in conjunction with CATImplementInterface in the .cpp file CATDeclareInterface; public:;#endif1.2 源文件1.2.1 组成1)接口标识符(IID)构造2)接口实现1.2.2 实例如:#include / Use uuid_gen -C on UNIX or uuidgen -s on NT to generate the IID IID IID_CAAIAfrGeoCreationWkbAddin = /* a4188b88-d4c1-11d3-b7f5-0008c74fe8dd */ 0xa4188b88, 0xd4c1, 0x11d3, 0xb7, 0xf5, 0x00, 0x08, 0xc7, 0x4f, 0xe8, 0xdd ;/ Declares that CAAIAfrGeoCreationWkbAddin is an interface that / OM-derives from CATIWorkbenchAddinCATImplementInterface(CAAIAfrGeoCreationWkbAddin, CATIWorkbenchAddin);1.3 TIE文件1.3.1 内容头文件引用1.3.2 实例如:/ Used by mkmk to create TIE_CAAIAfrGeoCreationWkbAddin.h#include 详见接口开发二、插件开发2.1 头文件2.1.1 结构#ifndef _H#define _H/ System framework#include CATBaseUnknown.h / Needed to derive from CATBaseUnknown/ ApplicationFrame framworkclass CATCmdContainer; / Needed by CreateToolbarsclass : public CATBaseUnknown / Used in conjunction with CATImplementClass in the .cpp file CATDeclareClass; public: (); /构造函数 virtual (); /析构函数 / Instantiates the command headers for the commands void CreateCommands(); /定义命令标签 / Creates toolbars and arranges the commands inside CATCmdContainer * CreateToolbars(); /创建菜单和工具条 private:;#endif2.1.2 实例#ifndef CAAAfrGeoOperationAdn_H#define CAAAfrGeoOperationAdn_H/ System framework#include CATBaseUnknown.h / Needed to derive from CATBaseUnknown/ ApplicationFrame framworkclass CATCmdContainer; / Needed by CreateToolbarsclass CAAAfrGeoOperationAdn : public CATBaseUnknown / Used in conjunction with CATImplementClass in the .cpp file CATDeclareClass; public: CAAAfrGeoOperationAdn(); virtual CAAAfrGeoOperationAdn(); / Instantiates the command headers for the commands void CreateCommands(); / Creates toolbars and arranges the commands inside CATCmdContainer * CreateToolbars(); private:;#endif2.2 源文件2.2.1 定义命令标签类如:2.2.2 建立“联结(TIE)”对象指定插件插入的交互界面,如:1)界面#Include “TIE_CATIShapeDesignWorkshopAddin.h”;TIE_CATIShapeDesignWorkshopAddin(CAAEMmrCombinedCurveAdn);2)“零件设计(Part Design)”界面#include TIE_CATIPrtWksAddin(CAAMmrDebugAdn);2.2.3 声明插件类CATImplementClass(CAAMmrDebugAdn, DataExtension, CATBaseUnknown, CAAMmrDebugAddin);2.2.4 更新接口字典文件2.2.4.1 字典文件名.dico2. 2.4.2 存放目录CNextCodeDictionay2. 2.4.3 语句如插入如下结构的语句行: 如:CAAMmrCombinedCurveAddin CATIShapeDesignWorkshopAddin libCAAMmrCombinedCurveAddIn其中:(1)在CATImplementClass中指定,如CAAMmrCombinedCurveAddin:CATImplementClass ( CAAEMmrCombinedCurveAdn , DataExtension , CATBaseUnknown , CAAMmrCombinedCurveAddin );(2) TIE语句中所定义,如CATIShapeDesignWorkshopAddin:TIE_CATIShapeDesignWorkshopAddin(CAAEMmrCombinedCurveAdn);2.2.5 编制构造函数与析构函数2.2.6 定义命令标签(CreateCommands)和创建菜单/工具条(CreateToolbars)详见菜单与工具条的开发方法如:/ Local Framework#include CAAAfrGeoOperationAdn.h/ ApplicationFrame Framework #include / Creates the CAAAfrGeoOperationAdnHeader command header class#include CATCommandHeader.hMacDeclareHeader(CAAAfrGeoOperationAdnHeader); / To declare that the class / is a DataExtension of (late type) CAAAfrGeoOperationAddinCATImplementClass(CAAAfrGeoOperationAdn, DataExtension, CATBaseUnknown, CAAAfrGeoOperationAddin(在接口字典中定义,见下句);/ To create the TIE Object (即设置指向本插件的接口)(*)#include TIE_CAAIAfrGeoCreationWkbAddin(CAAAfrGeoOperationAdn); / To declare that CAAAfrGeoOperationAddin implements CAAIAfrGeoCreationWkbAddin, insert / the following line in the interface dictionary: (?功用)/CAAAfrGeoOperationAddin CAAIAfrGeoCreationWkbAddin libCAAAfrGeoCreationWkbAddin/-CAAAfrGeoOperationAdn:CAAAfrGeoOperationAdn()CAAAfrGeoOperationAdn:CAAAfrGeoOperationAdn()void CAAAfrGeoOperationAdn:CreateCommands() / Instantiation of the header class created by the macro MacDeclareHeader - / commands are always available and are represented by a push button new CAAAfrGeoOperationAdnHeader(CAAAfrUnionHdr ,CommandLib,CommandName,(void *)NULL); new CAAAfrGeoOperationAdnHeader(CAAAfrSubstractHdr,CommandLib,CommandName,(void *)NULL); new CAAAfrGeoOperationAdnHeader(CAAAfrFilletHdr ,CommandLib,CommandName,(void *)NULL);CATCmdContainer * CAAAfrGeoOperationAdn:CreateToolbars() / CAAAfrOperationTlb Toolbar NewAccess(CATCmdContainer,pCAAAfrOperationTlb,CAAAfrOperationTlb); NewAccess(CATCmdStarter,pCAAAfrTUnionStr,CAAAfrTUnionStr); SetAccessCommand(pCAAAfrTUnionStr,CAAAfrUnionHdr); SetAccessChild(pCAAAfrOperationTlb,pCAAAfrTUnionStr); NewAccess(CATCmdStarter,pCAAAfrTSubstractStr,CAAAfrTSubstractStr); SetAccessCommand(pCAAAfrTSubstractStr,CAAAfrSubstractHdr); SetAccessNext(pCAAAfrTUnionStr,pCAAAfrTSubstractStr); NewAccess(CATCmdStarter,pCAAAfrTFilletStr,CAAAfrTFilletStr); SetAccessCommand(pCAAAfrTFilletStr,CAAAfrFilletHdr); SetAccessNext(pCAAAfrTSubstractStr,pCAAAfrTFilletStr); /- / Menu bar (?)NewAccess(CATCmdContainer,pCAAAfrOperationMbr,CAAAfrOperationMbr); / menu Tools with three new commandNewAccess(CATCmdContainer,pCAAAfrOperationToolsMnu,CATAfrToolsMnu); SetAccessChild(pCAAAfrOperationMbr,pCAAAfrOperationToolsMnu);NewAccess(CATCmdSeparator,pCAAAfrOperationToolsSep,CAAAfrOperationToolsSep); SetAccessChild(pCAAAfrOperationToolsMnu,pCAAAfrOperationToolsSep); NewAccess(CATCmdStarter,pCAAAfrMUnionStr,CAAAfrMUnionStr); SetAccessCommand(pCAAAfrMUnionStr,CAAAfrUnionHdr); SetAccessNext(pCAAAfrOperationToolsSep,pCAAAfrMUnionStr);NewAccess(CATCmdStarter,pCAAAfrMSubstractStr,CAAAfrMSubstractSt

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论