版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、18用户界面开发实例说明Creating a Workbench、目标i.i目标Showing how to create a workbench to be added to a given workshop.1.2 显示界面(workbench )Like the workshop, the workbench is an object that gathers the commands to work on the document and arrange them in toolbars and menus.1.3 命令标签(command header )Command header
2、s are used to make the link between the workbench and the commands.二、CAAAfrGeoCreationWbench实例说明CAA Geometrical Creation2.1功能The CAAAfrGeoCreationWbench use case creates a workbench namedprovided:for the CAAGeometry document. Its specifications cover most of the cases you will meet. Two toolbars are
3、The Solids toolbar. It includes five new commands: Cuboid, Sphere, Torus, and Cylinder 1 and 2.The Surfaces toolbar. It includes three new commands: Revolution Surface, Nurbs Surface, and Offset Surface.The only change in the menu bar is the addition of these commands in the Insert menu using two su
4、bmenus below the existing ones.2.2运行运行CATIA系统,并依次选择Start->Infrastructure->CAA V5: Geometrical Creation:This creates a new CAAGeometry document with the CAA V5: Geometrical Creation workbench active.2.3框架组成CAAAfrGeoCreationWkbWorkbench description classCAAAfrGeoCreationWkbFactoryFactory class f
5、or the workbench classCAAIAfrGeoCreationWkbFactoryFactory interface implemented by CAAAfrGeoCreationWkbFactoryTIE_CAAIAfrGeoCreationWkbFactoryTIE class for the factory interfaceAdd-in interface exposed by the workbench and that all its add-insCAAIAfrGeoCreationWkbAddinmust implementTIECAAIAfrGeoCrea
6、tionWkbAddinTIE class for the add-in interface三、程序结构(Step-by-Step)3.1编程准备3.1.1确认 Make sure that the workshop to which it is dedicated exposes theCATIxxxConfiguration interface,where xxx is the workshop identifier, in a PublicInterfaces or ProtectedInterfaces directory. Create the module directory to
7、 store the workbench code along with its two subdirectories LocalInterfaces and src. Then you will need to create the following files.In the framework's ProtectedInterfaces directoryCAAIAfrGeoCreationWkbAddin.hThe header file of the workbench exposed interface to enable clients to create add-ins
8、In the CAAAfrGeoCreationWbench.mLocalInterfaces directoryCAAIAfrGeoCreationWkbFactory.hThe header file of the workbench factory interfaceCAAAfrGeoCreationWkbFactory.hThe header file of the workbench factory classCAAAfrGeoCreationWkb.hIn the CAAAfrGeoCreationWbench.msrc directoryThe header file of th
9、e workbench description classCAAIAfrGeoCreationWkbAddin.cppThe source file of the workbench exposed interface to enable clients to create add-insCAAIAfrGeoCreationWkbFactory.cppThe source file of the workbench factory interfaceCAAAfrGeoCreationWkbFactory.cppCAAAfrGeoCreationWkb.cppThe source file of
10、 the workbench factory classThe source file of the workbench description classTIE_CAAIAfrGeoCreationWkbAddin.tsrcThe file to create the TIE forCAAIAfrGeometryWksAddinTIE_CAAIAfrGeoCreationWkbFactory.tsrcThe file to create the TIE forCAAIAfrGeometryWksFactoryIn the dictionary, that is the CNextcodedi
11、ctionary directory, referenced at run time using theCATDictionaryPath environment variable, create or updateCAAApplicationF.dicoThe interface dictionaryCAAApplicationF.factThe factory dictionaryIn the CNextresourcesmsgcatalog directory, referenced at run time using theCATMsgCatalogPa
12、th environment variableCAAAfrGeoCreationWkb.CATNlsThe workbench message fileCAAAfrGeoCreationWkbHeader.CATNls and The command header resource filesCAAAfrGeoCreationWkbHeader.CATRscWhereLocalInterfaces and srcLocalInterfaces and srcLocalInterfaces and srcCreateCommands methodCreateWorkbench methodRes
13、ource filesProtectedInterfaces and src3.1.2开发步骤#Step1 Create the workbench factory interface2 Create the workbench factory3 Create the workbench description class4 Create the command headers5 Create the workbench and arrange the commands6 Provide the resources and insert the workbench into the Start
14、 menu7 Create the workbench exposed interface3.2 建立 Workbench 的 Factory Interface(Creating the Workbench Factory Interface3.2.1命名CAAIAfrGeoCreationWkb Factory3.2.2 头文件(the header file )CAAIAfrGeoCreationWkbFactory.h #include <CATIGenericFactory.h> extern IID IID_CAAIAfrGeoCreationWkbFactory;cl
15、ass CAAIAfrGeoCreationWkbFactory : publicCATIGenericFactory CATDeclareInterface ; public :;A factory interface is a CAA interface, that is, an abstract class that derives fromCATIGenericFactoryAs any interface, it has an IID declared as IID_ followed by the interface name, and includes the CATDeclar
16、eInterface I macro that declares that this abstract class is an interface. No additional method than those of CATIGenericFactory is necessary. Don't forget the public keyword required by the TIE compiler. (?)3.2.3 源文件(The source file )CAAIAfrGeoCreationWkbFactory.cpp#include <CAAIAfrGeoCreati
17、onWkbFactory.h>IID IID_CAAIAfrGeoCreationWkbFactory =0xb32eed10,0xd4c1,0x11d3,0xb7, 0xf5, 0x00, 0x08, 0xc7, 0x4f, 0xe8, 0xdd;CATImplementInterface (CAAIAfrGeoCreationWkbFactory, CATIGenericFactory);The CATImplementInterface macro is used in conjunction with CATDeclareInterface in the header file
18、to make an interface from this abstract class and to declare that it OM-derives from CATIGenericfactory .3.2.4 TIE 文件(The TIE tsrc file)TIE_CAAIAfrGeoCreationWkbFactory.tsrc#include "CAAIAfrGeoCreationWkbFactory.h”The Multi-Workspace Application Builder (mkmk) will generate theTIE for this inte
19、rface for you, that is,the TIE_CAAIAfrGeoCreationWkbFactory.h file in the ProtectedGenerated directory.3.3 建立 Workbench 的 Factory(Creating the Workbench Factory3.3.1注意事项The factory class that creates workbench instances must concatenate the name of the class to instantiate, that is, the workbench de
20、scription class CAAAfrGeoCreationWkb , with the string Factory . This gives CAAAfrGeoCreationWkbFactory.3.3.2头文件CAAAfrGeoCreationWkb Factory .h#include "CATWorkshopConfigurationFactory.h"CATDeclareConfigurationFactory(CAAAfrGeoCreationWkb);The CATDeclareConfigurationFactorymacro argument i
21、s the name of the workbench descriptionclass.3.3.3源文件CAAAfrGeoCreationWkb Factory .cpp#include <CAAAfrGeoCreationWkb.h>#include <CAAAfrGeoCreationWkbFactory.h>#include <TIE_CAAIAfrGeoCreationWkbFactory.h>CATImplementConfigurationFactory(CAAAfrGeoCreationWkb,CAAIAfrGeoCreationWkbFac
22、tory);The CATImplementConfigurationFactoryarguments are the name of the workbench descriptionclass and the name of the workbench factory interface respectively. TheCATDeclareConfigurationFactoryand CATImplementConfigurationFactorymacros create theworkbench factory implementation class as a data exte
23、nsion of theCATApplicationFrame component3.3.4更新字典 The interface dictionarythat is a file whose name is the framework name suffixed by dico , such as CAAApplicationFrame.dico, and that you should create or update in the framework CNext/code/dictionary directory.The interface dictionarycontain
24、s the following declaration to state that the CATApplicationFrame component implements the CAAIAfrGeoCreationWkbFactory interface, by means of the extension class created by the macros, whose code is located in the libCAAAfrGeoCreationWbench shared library or DLL:(不太明白)CATApplicationFrame CAAIAfrGeo
25、CreationWkbFactory libCAAAfrGeoCreationWbench The factory dictionarythat is a file whose name is the framework name suffixed by fact , such as CAAApplicationFrame.fact, and that you should create or update in the framework CNext/code/dictionary directory. The factory dictionarycontains the fo
26、llowing declaration to state that the CAAIAfrGeoCreationWkbFactory interface is an interface to a factory whose implementation creates a CAAAfrGeoCreationWkb class instance:CAAAfrGeoCreationWkb CAAIAfrGeoCreationWkbFactory3.4定义与实现Workbench 类(Creating the Workbench Description Class3.4.1说明The CAAAfrG
27、eoCreationWkb class implements the CATICAAAfrGeometryWksConfiguration interface exposed by the CAAGeometry workshop . It includes the following methods: CreateCommands to instantiate the command headers for the commands of the workbench CreateWorkbench to create the containers for the workbench, the
28、 menus, and the toolbars, and arrange the commands in the menus and toolbars GetCustomInterface s which returns the names of the interfaces exposed by the workbench to enable its customization GetAddinInterface which returns the name of the interface exposed by the workbench to create add-ins.3.4.2头
29、文件CAAAfrGeoCreationWkb.h#include "CATBaseUnknown.h”#include "CATListPV.h”class CATCmdWorkbench;class CAAAfrGeoCreationWkb : public CATBaseUnknownCATDeclareClass;public:CAAAfrGeoCreationWkb();virtual CAAAfrGeoCreationWkb();void CreateCommands();CATCmdWorkbench * CreateWorkbench();CATClassId
30、 GetAddinInterface();void GetCustomInterfaces(CATListPV * oDefaultllDList ,CATListPV * oCustomIIDList);private:CAAAfrGeoCreationWkb(const CAAAfrGeoCreationWkb &iObjectToCopy););The CAAAfrGeoCreationWkb class C+-derives from CATBaseUnknown . The CATDeclareClass macro declares that the class CAAAf
31、rGeoCreationWkb belongs to a component. The class has a constructor, a destructor, the four methods of the CATIWorkbench interface, and a copy constructor. Note that the copy constructor is set as private. This prevents the compiler from creating the copy constructor as public without you know. This
32、 copy constructor is not implemented in the source file.3.4.3源文件CAAAfrGeoCreationWkb.cpp#include <CAAAfrGeoCreationWkb.h>#include <CATCommandHeader.h> / SeeCreating the Command HeadersMacDeclareHeader(CAAAfrGeoCreationWkbHeader);#include <CATCreateWorkshop.h>CATImplementClass(CAAAf
33、rGeoCreationWkb,Implementation, CATBaseUnknown, CATNull);#include <TIE_CATICAAAfrGeometryWksConfiguration.h>TIE_CATICAAAfrGeometryWksConfiguration(CAAAfrGeoCreationWkb);CAAAfrGeoCreationWkb:CAAAfrGeoCreationWkb() ()CAAAfrGeoCreationWkb:CAAAfrGeoCreationWkb() void CAAAfrGeoCreationWkb:CreateCom
34、mands()./ See Creating the Command HeadersCATCmdWorkbench * CAAAfrGeoCreationWkb:CreateWorkbench()./ See Creating the Workbench and Arranging the CommandsCATClassId CAAAfrGeoCreationWkb:GetAddinInterface()return "CAAIAfrGeoCreationWkbAddin"void CAAAfrGeoCreationWkb:GetCustomInterfaces(CATL
35、istPV * oDefaultIIDList, CATListPV * oCustomIIDList) TIE_CATICAAAfrGeometryWksConfiguration宏The CAAAfrGeoCreationWkb class states that it implements the CATICAAAfrGeometryWksConfiguration interface TIE_ CATImplementClass 宏declaring that the CAAAfrGeoCreationWkb class is a component mai
36、n class 2, thanks to theImplementation keyword, and that it OM-derives from CATBaseUnknown 2. The fourth parameter mustalways be set to CATNull for component main classes. 创建命令标签(Creating the Command Headers )(见命令标签).1命令标签Each command available in your workbench must have a command hea
37、der . A command header is an instance of a command header class , and different commands can share the same command header class to create their command header..2创建命令标签类CAAAfrGeoCreationWkbHeader command header class is careated in CAAAfrGeoCreationWkb.cpp:#include <CATCommandHeader.h>M
38、acDeclareHeader(CAAAfrGeoCreationWkbHeader);The MacDeclareHeader macro creates the header file and the source file for the CAAAfrGeoCreationWkbHeader class, and associates with this class the resource files CAAAfrGeoCreationWkbHeader.CATNls and CAAAfrGeoCreationWkbHeader.CATRsc. .3定义命令标签 Crea
39、te the code to instantiate your command headers in the emptyCreateCommands method. This methodshould contain one instantiation statement of the command header class per command. Each statement has the following form, for example for the Cuboid command.void CAAAfrGeoCreationWkb:CreateCommands() .new
40、CAAAfrGeoCreationWkbHeader("CAAAfrCuboidHdr”,"CAADegGeoCommands", "CAADegCreateCuboidCmd", (void *) NULL);. 其中:1) CAAAfruboidHdr is the identifier you need to assign to the command header. It will be used afterwards:(1) To associate the command starters you will define to pu
41、t the command in a menu and in toolbars with the command header.(2) To build the variables that define the command header resources, such as the name seen by the end user in his/her own language in the menu, or the icon to display in a toolbar.2) CAADegGeoCommands is the name of the shared library o
42、r DLL containing the Cuboid command's code, without the prefix lib, and without the suffix depending on the operating system.3) CAADegCreateCuboidCmd is the name of the Cuboid command class4) the last argument is the possible pointer to the object to pass to the command when executing it. It is
43、often a character string that indicates the action to carry out when the same command can perform several actions depending on the active document and data, such as "update" or "update all", or "cut" or "copy". Creating the Workbench and Arranging the C
44、ommands.1 创建 workbench using the NewAccess macro : CATCmdWorkbench * CAAAfrGeoCreationWkb :CreateWorkbench() NewAccess (CATCmdWorkbench,pCAAAfrGeoCreationWkb,CAAAfrGeoCreationWkb );. See Creating the Containers for the Toolbars and the Menu Bar return pCAAAfrGeoCreationWkb;pCAAAfrGeoCreationW
45、kb is the variable used to handle the workbench instance pointer, and CAAAfrGeoCreationWkb is the workbench identifier. Note that the workbench class name and the workbench identifier must be identical to take into account the workbench resources in the Start menu.They appear both in bold typeface.
46、This identifier is also used to name the workbench resource files CAAAfrGeoCreationWkb.CATNls and CAAAfrGeoCreationWkb.CATRsc. The workbench resources, and how to provide them, are described in Creating Resources for Workbenches..2 仓U建 containersCAA V5 : Gooinnry Crflflitlan Worts benc hSotds
47、sChildI囹以皿怔SuifacK£iaii Fit Edis View Inti Formal Twls: Expiate业irdo*He|pNewAccess ( CATCmdContainer ,pCAAAfrSolidEltTlb,CAAAfrSolidEltTlb); SetAccessChild( pCAAAfrGeoCreationWkb, pCAAAfrSolidEltTlb );./ SeeCreating the Solids Toolbar ContentAddToolbarView(pCAAAfrSolidEltTlb,1,Right);NewAccess(
48、 CATCmdContainer ,pCAAAfrSurfacicEltTlb,CAAAfrSurfacicEltTlb); SetAccessNext (pCAAAfrSolidEltTlb,pCAAAfrSurfacicEltTlb);./ SeeCreating the Surfaces Toolbar ContentAddToolbarView(pCAAAfrSurfacicEltTlb,-1,Right);NewAccess( CATCmdContainer ,pCAAAfrGeoCreationMbr,CAAAfrGeoCreationMbr);./ SeeCreating the
49、 Menu Bar ContentSetWorkbenchMenu (pCAAAfrGeoCreationWkb,pCAAAfrGeoCreationMbr);.其中:(1) The Solids toolbar is created as an instance of the CATCmdContainer class using the NewAccess macro. pCAAAfrSolidEltTlb is the variable used to handle the Solids toolbar command containerinstance pointer, and CAA
50、AfrSolidEltTlb is the identifier used to refer to it in the workbench resource files. This identifier must be unique among all the toolbar identifiers that can be found within the application. The Solids toolbar is set as the child of the workbench using theSetAccessChild macro, and its defaultlocat
51、ion is defined using the AddToolbarView macro, where 1 means that the Solids toolbar is visible by default ( -1 means invisible), and Right means that the toolbar is docked at the right side of the application window.(2) The Surfaces toolbar is created in the same way, but it is set next to the Soli
52、ds toolbar using the SetAccessNext macro. It is invisible (-1 means invisible) by default, and is also docked at the right side of the application window.(3) The menu bar is also created as an instance of the CATCmdContainer class and is referred to using the pCAAAfrGeoCreationMbr pointer. Its ident
53、ifier is CAAAfrGeoCreationMbr and is used for its resources. It is set as the workbench's menu bar using the SetWorkbenchMenu macro.The toolbar resources, and how to provide them, are described in Creating Resources for Workbenches.See also Providing the Resources and Inserting the Workbench int
54、o the Start Menufor an overview of allthe resources to create.1) 添加 Solids工具条按钮(Creating the Solids Toolbar ContentTcslbarSetXccessChildSetAcfSsNextThis toolbar contains four commands: Cuboid, Sphere, Torus, and Cylinder. You should, for each command:(1) Create a command starter using the NewAccess
55、macro(2) Associate the command starter, using the SetAccessCommand macro, with the appropriate command header identifier defined in the CreateCommands method(3) Arrange the command starters in the toolbar using the SetAccessChild and SetAccessNext macros.NewAccess(CATCmdStarter,pCAAAfrTSolidEltCuboi
56、dStr,CAAAfrTSolidEltCuboidStr);SetAccessCommand(pCAAAfrTSolidEltCuboidStr,"CAAAfrCuboidHdr");SetAccessChild(pCAAAfrSolidEltTlb,pCAAAfrTSolidEltCuboidStr);NewAccess(CATCmdStarter,pCAAAfrTSolidEltSphereStr,CAAAfrTSolidEltSphereStr);SetAccessCommand(pCAAAfrTSolidEltSphereStr,"CAAAfrSpher
57、eHdr"); SetAccessNext(pCAAAfrTSolidEltCuboidStr,pCAAAfrTSolidEltSphereStr);NewAccess(CATCmdStarter,pCAAAfrTSolidEltTorusStr,CAAAfrTSolidEltTorusStr);SetAccessCommand(pCAAAfrTSolidEltTorusStr,"CAAAfrTorusHdr");SetAccessNext(pCAAAfrTSolidEltSphereStr,pCAAAfrTSolidEltTorusStr);NewAccess(
58、CATCmdStarter,pCAAAfrTSolidEltCylinder1Str,CAAAfrTSolidEltCylinder1Str);SetAccessCommand(pCAAAfrTSolidEltCylinder1Str,"CAAAfrCylinder1Hdr");SetAccessNext(pCAAAfrTSolidEltTorusStr,pCAAAfrTSolidEltCylinder1Str);NewAccess(CATCmdStarter,pCAAAfrTSolidEltCylinder2Str,CAAAfrTSolidEltCylinder2Str);SetAccessCommand(pCAAAfrTSolidEltCylinder2Str,"CAAAfrCylinder2Hdr");SetAccessNext(pCAAAfrTSolidEltCylinder1Str,pCAAAfrTSolidEltCyl
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 渠道维护工变更管理模拟考核试卷含答案
- 纯碱碳化工风险评估与管理水平考核试卷含答案
- 扬声器号筒擀制工变更管理水平考核试卷含答案
- 有机合成工QC管理考核试卷含答案
- 织袜工岗后测试考核试卷含答案
- 2026中国农业科学院第一批招聘359人笔试考试参考题库及答案解析
- 木模板工创新方法模拟考核试卷含答案
- 会展服务师风险识别知识考核试卷含答案
- 化工检修电工保密评优考核试卷含答案
- 大型藻类栽培工操作水平能力考核试卷含答案
- 中国淋巴瘤治疗指南(2025年版)
- 2025年云南省人民检察院聘用制书记员招聘(22人)考试笔试模拟试题及答案解析
- 2026年空气污染监测方法培训课件
- 实习2025年实习实习期转正协议合同
- 疗伤旅馆商业计划书
- 2025西部机场集团航空物流有限公司招聘考试笔试备考题库及答案解析
- 2025年广西公需科目答案6卷
- 四年级《上下五千年》阅读测试题及答案
- 江苏省五高等职业教育计算机网络技术专业指导性人才培养方案
- GB/T 35347-2017机动车安全技术检测站
- 急性呼吸窘迫综合征
评论
0/150
提交评论