ImageVerifierCode 换一换
格式:DOCX , 页数:25 ,大小:29.65KB ,
资源ID:27977009      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/27977009.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(CATIA二次开发.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

CATIA二次开发.docx

1、CATIA二次开发CATIA+CAA+二次开发详细教程(1)-基础概念CAA 第一讲CATIA CAA 第一讲:基本概念1. 什么是组件?CAA,全称 Component Application Architecture,组件应用架构。这个东西对不搞软件 的人来说可能很陌生,我也很陌生啊,原来光知道“面向对象的技术”就很牛逼了, “组件 技术”难道更牛逼吗? 既然类和组件有着这么多类似的地方, 那么传统的面向对象编程和面向组件编程有什么 区别呢?简单的说, 面向对象关注的是组合在一个二进制可执行文件中的各个类的关系, 而 面向组件的编程关注的是在彼此独立的基础上模块之间的交互性, 这种交互性使

2、得你并不需 要熟悉它们内部的工作原理。 这两种方法最基本的不同在于它们对最终的应用程序的观点。在传统的面向对象编程 中,尽管你可以精心的把所有的商业逻辑分布在不同的类中,一旦这些类被编译,它们就被 固化成了一个巨大的二进制代码。 所有的类共享同一个物理单元 (通常是一个可执行文件) 、 被操作系统认为是同一个进程, 使用同一个地址空间以及共享相同的安全策略等等。 如果多 个开发者在同一份代码上进行开发,他们甚至还要共享源文件。在这种情况下,修改一个类 可能会让整个项目被重新链接,并重新进行必要的测试,更严重的,还有可能要修改其他的 类。 但是, 在面向组件开发中, 应用程序是由一系列可以互相交

3、互的二进制模块组合而成的。 一个具体的二进制组件可能并不能完成什么工作。 有些组件是为了提供一些常规服务而编写 的,例如通信的封装或者文件访问组件。也有一些是为了某些特定应用而专门开发的。一个 应用程序的设计者可以通过把这些不同的组件提供的功能粘合在一起来实现他们需要的商 业逻辑。很多面向组件的技术例如: COM 、 J2EE 、 CORBA 和 .NET 都为二进制组件 提供了的无缝链接的机制。而唯一的不同就是你需要在组件通信上花费的力气。 把一个二进制应用程序分解成不同的二进制组件的动机和把不同的类放到不同的文件 中是类似的。 后者使得不同的类的开发人员可以彼此独立的工作, 尽管即时修改了

4、一个类也 要重新链接整个应用程序,但是你只需要重新编译被修改的部分就可以了。 但是, 面向组件的开发还是和简单软件项目的管理更复杂一些。 因为一个面向组件的应 用程序是一个二进制代码块的集合,你可以把组件当作是 LEGO 的积木块一样,随心所欲 的拆装它们。如果你需要修改一个组件的实现,只需要修改那个组件就可以了,而组件的客 户机不需要重新编译也不需要重新开发。 对于那些不常用到的组件, 组件甚至可以在一个程 序运行的时候被更新。 这些改进和增强使得组件可以立即进行更新, 而所有该组件的客户都 将立即受益。无论是在同一台机器上还是通过网络远程访问。 面向组件的应用程序也更易于扩展。 当你需要实

5、现新的需求的时候, 你可以提供一个新的组 件, 而不去影响那些和新需求无关的组件。 这些特点使得面向组件的开发降低了大型软件项 目长期维护的成本,这是一个最实际的商业问题,也正是如此,组件技术才如此迅速的被接 受。 面向组件的应用程序通常可以更快的响应市场, 因为你可以有很大的选择空间, 不仅仅 是自己开发的组件,还可以从第三方厂商来购买某些组件,从而避免了重复制造轮子。这 里, VB 就是一个很好的例子,丰富的 ActiveX 控件使得很多人在快速开发中得到了享受。1用户界面开发实例说明Creating a Workbench一、目标1.1 目标Showing how to create a

6、 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 headers are used to make the link between the workbench and the comman

7、ds.二、CAAAfrGeoCreationWbench 实例说明2.1 功能The CAAAfrGeoCreationWbench use case creates a workbench named CAA Geometrical Creation for the CAAGeometry document. Its specifications cover most of the cases you will meet. Two toolbars are provided: The Solids toolbar. It includes five new commands: Cuboid,

8、 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 submenus below the existing ones.12.2 运行运行 CATIA 系统,并依次选择

9、Start-Infrastructure-CAA V5: Geometrical Creation: This creates a new CAAGeometry document with the CAA V5: Geometrical Creation workbench active.2.3 框架组成CAAAfrGeoCreationWkb CAAAfrGeoCreationWkbFactory CAAIAfrGeoCreationWkbFactory Workbench description class Factory class for the workbench class Fa

10、ctory interface implemented by CAAAfrGeoCreationWkbFactoryTIE_CAAIAfrGeoCreationWkbFactory TIE class for the factory interface CAAIAfrGeoCreationWkbAddin Add-in interface exposed by the workbench and that all its add-ins must implementTIE_CAAIAfrGeoCreationWkbAddin TIE class for the add-in interface

11、三、程序结构(Step-by-Step)3.1 编程准备 3.1.1 确认? ? Make sure that the workshop to which it is dedicated exposes the CATIxxxConfiguration interface, where xxx is the workshop identifier, in a PublicInterfaces or ProtectedInterfaces directory. Create the module directory to store the workbench code along with i

12、ts two subdirectories LocalInterfaces and src. Then you will need to create the following files. In the frameworks ProtectedInterfaces directory CAAIAfrGeoCreationWkbAddin.h The header file of the workbench exposed interface to enable clients to create add-ins In the CAAAfrGeoCreationWbench.mLocalIn

13、terfaces directory CAAIAfrGeoCreationWkbFactory.h CAAAfrGeoCreationWkbFactory.h CAAAfrGeoCreationWkb.h The header file of the workbench factory interface The header file of the workbench factory class The header file of the workbench description classIn the CAAAfrGeoCreationWbench.msrc directory CAA

14、IAfrGeoCreationWkbAddin.cpp CAAIAfrGeoCreationWkbFactory.cpp CAAAfrGeoCreationWkbFactory.cpp CAAAfrGeoCreationWkb.cpp TIE_CAAIAfrGeoCreationWkbAddin.tsrc TIE_CAAIAfrGeoCreationWkbFactory.tsrc The source file of the workbench exposed interface to enable clients to create add-ins The source file of th

15、e workbench factory interface The source file of the workbench factory class The source file of the workbench description class The file to create the TIE for CAAIAfrGeometryWksAddin The file to create the TIE for2CAAIAfrGeometryWksFactory In the dictionary, that is the CNextcodedictionary directory

16、, referenced at run time using the CATDictionaryPath environment variable, create or update CAAApplicationFrame.edu.dico CAAApplicationFrame.edu.fact CATMsgCatalogPath environment variable CAAAfrGeoCreationWkb.CATNls CAAAfrGeoCreationWkbHeader.CATRsc The workbench message file The interface dictiona

17、ry The factory dictionaryIn the CNextresourcesmsgcatalog directory, referenced at run time using theCAAAfrGeoCreationWkbHeader.CATNls and The command header resource files3.1.2 开发步骤# 2 Create the workbench factory 3 Create the workbench description class 4 Create the command headers 5 Create the wor

18、kbench and arrange the commands 6 Provide the resources and insert the workbench into the Start menu 7 Create the workbench exposed interface Step Where LocalInterfaces and src LocalInterfaces and src LocalInterfaces and srcCreateCommands method CreateWorkbench method1 Create the workbench factory i

19、nterfaceResource files ProtectedInterfaces and src3.2 建立 Workbench 的 Factory Interface(Creating the Workbench Factory Interface)3.2.1 命名CAAIAfrGeoCreationWkbFactory3.2.2 头文件(the header file )CAAIAfrGeoCreationWkbFactory.h#include extern IID IID_CAAIAfrGeoCreationWkbFactory; class CAAIAfrGeoCreationW

20、kbFactory : public CATIGenericFactory CATDeclareInterface; public : ;A factory interface is a CAA interface, that is, an abstract class that derives from CATIGenericFactory. As any interface, it has an IID declared as IID_ followed by the interface name, and includes theCATDeclareInterface macro tha

21、t declares that this abstract class is an interface. No additional 3method than those of CATIGenericFactory is necessary. Dont forget the public keyword required by the TIE compiler.(?)3.2.3 源文件(The source file )CAAIAfrGeoCreationWkbFactory.cpp#include IID IID_CAAIAfrGeoCreationWkbFactory = 0xb32eed

22、10, 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 to make an interface from this abstract class and to declare

23、 that it OM-derives from CATIGenericfactory.3.2.4 TIE 文件(The TIE tsrc file)TIE_CAAIAfrGeoCreationWkbFactory.tsrc#include CAAIAfrGeoCreationWkbFactory.hThe Multi-Workspace Application Builder (mkmk) will generate the TIE for this interface for you, that is, the TIE_CAAIAfrGeoCreationWkbFactory.h file

24、 in the ProtectedGenerated directory.3.3 建立 Workbench 的 Factory(Creating the Workbench Factory)3.3.1 注意事项The factory class that creates workbench instances must concatenate the name of the class to instantiate, that is, the workbench description class CAAAfrGeoCreationWkb, with the string Factory. T

25、his gives CAAAfrGeoCreationWkbFactory.3.3.2 头文件CAAAfrGeoCreationWkbFactory.h#include CATWorkshopConfigurationFactory.h CATDeclareConfigurationFactory(CAAAfrGeoCreationWkb);The CATDeclareConfigurationFactory macro argument is the name of the workbench description class.43.3.3 源文件CAAAfrGeoCreationWkbF

26、actory.cpp#include #include #include CATImplementConfigurationFactory(CAAAfrGeoCreationWkb, CAAIAfrGeoCreationWkbFactory);The CATImplementConfigurationFactory arguments are the name of the workbench description class and the name of the workbench factory interface respectively. TheCATDeclareConfigur

27、ationFactory and CATImplementConfigurationFactory macros create theworkbench factory implementation class as a data extension of the CATApplicationFrame component3.3.4 更新字典3.3.4.1 The interface dictionary that is a file whose name is the framework name suffixed by dico, such as CAAApplicationFrame.d

28、ico, and that you should create or update in the framework CNext/code/dictionary directory. The interface dictionary contains the following declaration to state that the CATApplicationFrame component implements the CAAIAfrGeoCreationWkbFactory interface, by means of the extension class created by th

29、e macros, whose code is located in the libCAAAfrGeoCreationWbench shared library or DLL:(不太明白)CATApplicationFrame CAAIAfrGeoCreationWkbFactory libCAAAfrGeoCreationWbench3.3.4.2 The factory dictionary that is a file whose name is the framework name suffixed by fact, such as CAAApplicationFrame.fact,

30、and that you should create or update in the framework CNext/code/dictionary directory. The factory dictionary contains the following declaration to state that the CAAIAfrGeoCreationWkbFactory interface is an interface to a factory whose implementation creates a CAAAfrGeoCreationWkb class instance:CA

31、AAfrGeoCreationWkb CAAIAfrGeoCreationWkbFactory3.4 定义与实现 Workbench 类(Creating the Workbench Description Class)3.4.1 说明The CAAAfrGeoCreationWkb 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 menus, and the toolbars, andarrange the commands in the menus and toolbarsGetCustomInterfaces which returns the names of the interfac

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1