第一范文网 - 专业文章范例文档资料分享平台

CATIA二次开发

来源:用户分享 时间:2020-06-17 本文由撞进先生怀里 分享 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

CATIA+CAA+二次开发详细教程(1)-基础概念

CAA 第一讲

CATIA CAA 第一讲:基本概念 1. 什么是组件?

CAA,全称 Component Application Architecture,组件应用架构。这个东西对不搞软件 的人来说可能很陌生,我也很陌生啊,原来光知道―面向对象的技术‖就很牛逼了, ―组件 技术‖难道更牛逼吗? 既然类和组件有着这么多类似的地方, 那么传统的面向对象编程和面向组件编程有什么 区别呢?简单的说, 面向对象关注的是组合在一个二进制可执行文件中的各个类的关系, 而 面向组件的编程关注的是在彼此独立的基础上模块之间的交互性, 这种交互性使得你并不需 要熟悉它们内部的工作原理。 这两种方法最基本的不同在于它们对最终的应用程序的观点。在传统的面向对象编程 中,尽管你可以精心的把所有的商业逻辑分布在不同的类中,一旦这些类被编译,它们就被 固化成了一个巨大的二进制代码。 所有的类共享同一个物理单元 (通常是一个可执行文件) 、 被操作系统认为是同一个进程, 使用同一个地址空间以及共享相同的安全策略等等。 如果多 个开发者在同一份代码上进行开发,他们甚至还要共享源文件。在这种情况下,修改一个类 可能会让整个项目被重新链接,并重新进行必要的测试,更严重的,还有可能要修改其他的 类。 但是, 在面向组件开发中, 应用程序是由一系列可以互相交互的二进制模块组合而成的。 一个具体的二进制组件可能并不能完成什么工作。 有些组件是为了提供一些常规服务而编写 的,例如通信的封装或者文件访问组件。也有一些是为了某些特定应用而专门开发的。一个 应用程序的设计者可以通过把这些不同的组件提供的功能粘合在一起来实现他们需要的商 业逻辑。很多面向组件的技术——例如: COM 、 J2EE 、 CORBA 和 .NET 都为二进制组件 提供了的无缝链接的机制。而唯一的不同就

是你需要在组件通信上花费的力气。 把一个二进制应用程序分解成不同的二进制组件的动机和把不同的类放到不同的文件 中是类似的。 后者使得不同的类的开发人员可以彼此独立的工作, 尽管即时修改了一个类也 要重新链接整个应用程序,但是你只需要重新编译被修改的部分就可以了。 但是, 面向组件的开发还是和简单软件项目的管理更复杂一些。 因为一个面向组件的应 用程序是一个二进制代码块的集合,你可以把组件当作是 LEGO 的积木块一样,随心所欲 的拆装它们。如果你需要修改一个组件的实现,只需要修改那个组件就可以了,而组件的客 户机不需要重新编译也不需要重新开发。 对于那些不常用到的组件, 组件甚至可以在一个程 序运行的时候被更新。 这些改进和增强使得组件可以立即进行更新, 而所有该组件的客户都 将立即受益。无论是在同一台机器上还是通过网络远程访问。 面向组件的应用程序也更易于扩展。 当你需要实现新的需求的时候, 你可以提供一个新的组 件, 而不去影响那些和新需求无关的组件。 这些特点使得面向组件的开发降低了大型软件项 目长期维护的成本,这是一个最实际的商业问题,也正是如此,组件技术才如此迅速的被接 受。 面向组件的应用程序通常可以更快的响应市场, 因为你可以有很大的选择空间, 不仅仅 是自己开发的组件,还可以从第三方厂商来购买某些组件,从而避免了重复制造轮子。这 里, VB 就是一个很好的例子,丰富的 ActiveX 控件使得很多人在快速开发中得到了享受。 1

用户界面开发——实例说明 ——Creating a Workbench 一、目标 1.1 目标

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 headers are used to make the link between the workbench and the commands.

二、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, 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. 1

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 框架组成

CAAAfrGeoCreationWkb CAAAfrGeoCreationWkbFactory

CAAIAfrGeoCreationWkbFactory Workbench description class Factory class for the workbench class Factory interface implemented by CAAAfrGeoCreationWkbFactory

TIE_CAAIAfrGeoCreationWkbFactory TIE class for the factory interface

CAAIAfrGeoCreationWkbAddin Add-in interface exposed by the workbench and that all its add-ins must implement

TIE_CAAIAfrGeoCreationWkbAddin TIE 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 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 its two subdirectories LocalInterfaces and src. Then you will need to create the following files. In the framework's ProtectedInterfaces directory CAAIAfrGeoCreationWkbAddin.h The header file of the workbench exposed interface to enable clients to create add-ins In the

CAAAfrGeoCreationWbench.m\\LocalInterfaces 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 class

In the CAAAfrGeoCreationWbench.m\\src directory CAAIAfrGeoCreationWkbAddin.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 the 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 for 2

CAAIAfrGeometryWksFactory In the dictionary, that is the CNext\\code\\dictionary directory, 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 dictionary The factory dictionary

In the CNext\\resources\\msgcatalog directory, referenced at run time using the

CAAAfrGeoCreationWkbHeader.CATNls and The command header resource files

3.1.2 开发步骤

# 2 Create the workbench factory 3 Create the workbench description class 4 Create the

搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新经管营销CATIA二次开发 全文阅读和word下载服务。

CATIA二次开发 .doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/wenku/1082513.html(转载请注明文章来源)
热门推荐
Copyright © 2018-2022 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top