Catia 二次开发

CATIA V5在开发之初就遵循面向对象的设计思想(OO),构建了完全基于组件的体系结构(PPR: Products,Process,Resource),有效地解决了维护、管理、扩展的困难,并大量使用了最新的计算机技术和标准以及软件工程技术,其中包括基于组件架构思想的JAVA BEAN 、COM/OLE、CORBA 技术和Web技术、C++语言、Visual Basic Journaling 、STEP-SDAI、XML、OpenGL等,这使CATIA V5具有与众不同的鲜明的特点:数据结构单一,各个模块全相关,某些模块之间还是双向相关;端到端的集成系统,拥有强大的专业应用扩展能力。
     1.软件组件结构(SCI: Software Component Infrastructure)的基本概念
      软件组件结构(SCI)是软件工程继过程模型和面向对象模型的下一代逻辑模型。面向对象技术已在许多重要应用中取得成功。
      但是,随着更多面向对象解决方法的开发和使用,很显然的是,单单采用面向对象技术难以与软件日益增长的复杂性抗衡。因为,对象只构成应用程序的一部分。它完全不能把握应用程序的结构(控制流)。只能通过重用类库里有的类来实现有限的重用。但实际情况是,大量应用程序,特别是同一领域(DOMAIN)中的应用程序,分享相似的结构。不同的程序员使用不同的技术去把握和实现这些相似的结构。结果,这些结构并没有经过通常的面向对象技术而被重用。
           面向对象技术只能通过重用类库已有的类来实现有限的重用,而软件组件结构(SCI)提供了最高层次的代码重用。
          软件组件结构(SCI:Software Component Infrastructure)有三个基本的概念:框架(FRAMEWORK)、组件(Component)和对象总线(Products Bus)。
         组件(Component):是软件的基本量子(单元)。组件既应当足够小,以便于维护;又应足够大,可具备相当的功能,可以被打包和插用。由于传统的客户/服务器应用不能应付软件应用日益增加的复杂性。它们不能加入到即插即用的环境之中。组件的特征提供了将一个应用程序分成若干个组件的机制。每个组件提供了一个相当专门的功能,它向框架的其余部分描述自己,以便别的组件能够访问它的功能。描述是通过说明性语言如IDL实现的,它本质上是把组件的接口与实现分离开来。由于组件是可单独维护、升级的,因此,组件不直接与别的组件通信是至关重要的。它必须通过使用框架或对象总线来实现组件之间的交互。
      框架(FRAMEWORK):框架提供对所有应用程序有用的功能(如接口、存储)。它提供了统一的总设计。框架是对相似应用程序集合的一个部分(统一但不完整)解决方案。开发者的任务是用这不完整的解决方案加上必要的代码建立完整的应用。在领域(DOMAIN)内的一个应用包括不变部分和可变部分。不变部分由框架把握,一般可占到80%,可变部分由开发者把握,一般可占到20% 。开发者通过向框架添加变化部分的代码把握其动作,而形成新的特定应用。框架根据是否针对特殊领域还是若干领域,可分为水平框架、垂直框架、复合文挡框架。 
       对象总线:对象总线是基本的中间件。它允许成千上万能够相互理解接口定义语言IDL的对象相互发生作用。这种作用对对象来说是完全透明的。对象总线把组件和框架的能力扩展到开放网络和其它伙伴应用程序。它使成千上万独立的软件单元在由不同操作系统、语言、硬件平台和编译工具组成的环境下互相无缝地交互运作。对象总线不仅提供对象之间的连接,它还提供对在总线上所有对象都有用的核心服务集(对象服务)。如:生命周期服务程序、安全性、持久性、命名等。    通过组件构造/修改软件,用框架把握软件结构,用对象总线连接事务,支持即插即用(Plug & Play)功能的扩展。   2.CATIA V5体系结构(Architecture Infrastructure)   CATIA V5的体系结构(Architecture Infrastructure)是一种面向行业应用的垂直框架体系结构,组件是CAD/CAM系统的各种几何特征和管理、分析单元。框架是一些应用如:2D/3D建模、分析、混合建模、制图、数控加工等,CATIA V5也称为领域(DOMAIN)或应用(APPLICATION)。并通过3D PLM PPR(PRODUCTS,PROCESS, RESOURCE)HUB产品总线连接起来。

1、Application window和document window类似于mfc中的CMainFrame和CView的关系

2、workshop是workbench的一个集合

3、CATIWorkbenchTransition interface

4、CATApplicationFrame

5、CATFrmEditor 类起检索按钮是否可用的功能等

6、In Short
The CAA V5 application window includes commands which are common to all documents in menus and in the standard toolbar. Each document type is associated with a workshop which includes commands arranged in menus and toolbars which are added to the common menus and to the standard toolbar. Changing the active document to another document changes the active workshop if the new active document's type is different from the type of the previous document. A workshop can include workbenches to gather commands dedicated to specific tasks to structure the end user interface. One workbench only can be active at a time.

7、The application layout is provided by the non-exposed CATApplicationDocument class

8、The main methods of the CATApplicationFrame class are:

GetFrame             This static method returns the unique instance of this class.
SetMessage       To set a message in the status bar. 
GetApplicationDocument This method returns the CATApplicationDocument class instance
GetMainWindow    This method returns:

9、CATIDocumentEdit interface is used to create the default window to display the document

10、The CATFrmLayout Class
This class manages all the windows created. It

11、The CATFrmLayout class enables you to activate a new window

12、You have to respect only one rule: all the dialog objects must be inside a frame created by the CATFrmWindow class:

13、HRESULT CAAEMyInterface::CreateWindow() 
{
   1/ Creating the new window
   2/ Managing the base name
   3/ Declaring the window as current
}
...

14、In Short
This article enables you to understand the role of the main objects defining or managing the V5 interactive application.

CATApplicationFrame
This class has only one instance during the session. You essentially use it to retrieve the dialog parent of your dialog box.

CATFrmLayout
This class has only one instance during the session. Its role is to manage all the document windows. You use it to retrieve windows and to define the current one.

CATFrmEditor
This class controls the visualization and the interactivity of the document. It is the C, in the MVC paradigm, where M is the document and V the window.

CATFrmWindow
It is the base class of all the classes defining a window to display a document.

15、The CATApplicationFrame class
 This CATApplicationDocument class instance is built by the CATApplicationFrame class instance.

The main methods of the CATApplicationFrame class are:

GetFrame             This static method returns the unique instance of this class.
SetMessage       To set a message in the status bar. 
GetApplicationDocument This method returns the CATApplicationDocument class instance
GetMainWindow    This method returns:

MyDialogBox will be automatically hidden when the editor will be deactivated. Therefore if you need a dialog box always visible, and independent of the life of the document, its parent must be the CATApplicationDocument class instance returned by the GetApplicationDocument method. You can also read the "Defining Headers in CATIAfrGeneralWksAddin Implementations" section in the technical article about the command headers

A property sheet is a tabbed dialog box, each tab containing a property page

This  CATEditorManager  object is used by the application to create and manage property pages

The CSO contents is retrieved and passed to the ExtractFromSelection method of each property editor

These methods are those of the CATIEditProperties interface and are either pure virtual or empty in their CATEditor implementation. You should provide their body to make them play the following role:

ExtractFromSelection returns the list of objects found in the Current Set of Objects (CSO) that implement the property interface
GetEditorTitle returns the property page title
SetEditorSize lets you request which size you need to accommodate your property page, among the possible values: small, medium, or large
BuildEditor instantiates the associated dialog class
SetPropertyValue sets the values and options in the property page dialog from the objects
CommitModification applies to the selected objects the modifications made to values and options in the property page dialog.
CancelModification is empty, but exists and could be used to delete temporary objects that could possibly be allocated in previous methods
CloseWindowFromEditor is called whenever the end user selects another property page.
The methods ExtractFromSelection, GetEditorTitle, SetEditorSize, BuildEditor, and SetPropertyValue are executed in this order when instantiating the property page.

When the end user clicks:

OK, the CommitModification method is executed and the window is closed
Apply,  the CommitModification method is executed, but the window is not closed
Cancel, the CancelModification method is executed and the window is closed
Close, the window is closed.
SetPropertyValue, CommitModification, and CancelModification call in turn the methods with the same name of the associated dialog class.

Current Set of Objects (CSO),

In memory the setting file is represented by a setting repository, an instance of the CATSettingRepository class

A property page divided in sections
This dialog is a class that derives from CATDlgFrame

Creating a property page for the Tools/Options menu implies to create a property page editor factory, a property page editor class instantiated by this factory, and to supply a property page dialog class gathering the controls to access the parameters and values you let the end user access and modify.

Setting Attributes versus Parameters
The setting repository contains setting attributes accessible thanks to the ReadSetting and WriteSetting methods. Using these methods ties the code to the formats and locations of the attributes

Model View Controller (MVC

What Is a CAA Command?
A CAA command is an instance of a class deriving from the CATCommand class and that supports these interactive mechanisms:

Desactivate is called when a shared command takes the focus from the active command

A command header instance is always an instance of a class deriving from the CATCommandHeader class

To avoid to fill up uselessly the list of CATCommandHeader instances, it is recommended to make the command header instantiation only in the following methods because these methods are called once for each instance of editor: CreateCommands of the workbench implementations [4] CreateCommands of the add-in implementations (*) [5]

To create a standard command header class, you can use the MacDeclareHeader macro. It creates for you a class which derives from CATCommandHeader which is the base class for command headers and should never be directly instantiated.

This Dialog command contains:

The list of current entities. This list is always in this order:
The workshop defined by the frame application (CATAfrGeneralWks)
The current workshop (those of the current UI-active object)
The Add-ins of the current workshop
The current workbench
The Add-ins of the current workbench

The Dialog box must manage its life cycle. When the end user clicks the Close button, or the Close/Cancel buttons if they exist, the Dialog box is deleted (by a RequestDelayedDestruction on itself)

command header stands for a command and avoids to load the command when the end user does not require it. A command header is an instance of a command header class. This class can be used for several commands, and can be created either using a macro or explicitly if the command header should manage availability information or customize its representation.

It is possible to re-use command header identifiers, but there are two rules to respect:

In a workbench or in an add-in (workshop/workbench) avoid to use an identifier coming from another workbench or workbench's Add-in.
In a contextual menu do not use an identifier coming from a workbench or a workbench's Add-in, but only coming from the workshop or an workshop's add-in.
The "Workshop Exposition" command enables you to retrieve the command header identifiers.

There are two command header resource files:

The resource file containing the title and help messages in the English language, and that can be translated into other languages. It is suffixed using CATNls
The resource file containing the icons and other resources that should not be translated. It suffixed by CATRsc

In Short
The command header resources are provided in two files whose names are the command header class, or the name set by the CATImplementHeaderResources macro in the command header cpp file. One file is for those that can be translated and is suffixed CATNls, the other for the icon names or pointer to a help file and is suffixed CATRsc. The resources are provided using keys built with the identifier of the object to which they apply.

In Short
The workshop resources are provided in two files whose names are the workshop identifier. One file is for those that can be translated and is suffixed CATNls, the other for the icon names and is suffixed CATRsc. The resources are provided using keys built with the identifier of the object to which they apply.

public class CATCommandHeader

Class to create a command header.
Role: Each command you want to make available in your workshop or workbench must have a command header. It holds the necessary information to load the command, such as the name of the shared library in which the command's executable code is located, the name of the command class, and the data to pass to the command's code when this command becomes the current one.

The command header has resources for each command to display, such as the command name shown to the end user, its ToolTip displayed in a balloon, it help message, and its icon. This enables the workshop or workbench to be displayed, that is loaded in memory, without any of its commands being itself loaded, except the default one, spares memory space, and improves performance. The end user can see the icons in the toolbars, the items in the menu bar, can ask for help on a given command, without the command being loaded. It is only when he/she clicks on the menu item or on the icon that the command code is actually loaded.

You cannot directly instanciate a CATCommandHeader, you must derive this class. The easiest way is using the MacDeclareHeader macro such that:

#include "CATCommandHeader.h"
    MacDeclareHeader(MyHeader);

System Macro CATImplementClass
Macro CATImplementClass (Class,Typeofclass,Basemeta,Impmeta)

Declares an implementation or extension class.
Role: Declares that the current class is either an implementation or an extension class. The class must derive from CATBaseUnknown. Use this macro in the class source (.cpp) file in conjunction with CATDeclareClass in the class header file. End it with a semicolon.

System Macro CATDeclareClass
Macro CATDeclareClass (private)

Declares an implementation or extension class.
Role: Declares that the current class is either an implementation or an extension class. The class must derive from CATBaseUnknown. Use this macro in the class header file in conjunction with CATImplementClass in the class source (.cpp) file. End it with a semicolon.
--------------------------------------------------------------------------------
This object is included in the file: CATMacForIUnknown.h

Catia 二次开发资料(转)的更多相关文章

  1. VB6.0环境下的CATIA二次开发简介

    CATIA作为CAD/CAE/CAM/PDM一体化的软件,广泛用于航空航天.汽车.船舶及电子工业,尤其在航空航天业,有八成以上厂商使用CATIA的市场[11].然而由于使用习惯和使用的侧重点不用,功能 ...

  2. Catia CAA 二次开发 ---- 开发准备(0)

    去年开始学习Catia CAA的二次开发,前后的间断性学习有1年吧. 现在已经好久没用,忘得也差不多了,原来的笔记都放在了Evernote,现在还是觉得边继续复习边总结一下,以后也比较好检索. 先吐槽 ...

  3. [Revit]Autodesk Revit 二次开发整理(资料、准备工作和环境搭建)

    1 前言 Revit被Autodesk收购之后,整理和开放了一大部分API,供开发者实现自己的功能和程序,总体来说API的功能比较完善,毕竟市面上已经出现了各式各样的插件. 本人也是初学者,在Revi ...

  4. 【工业串口和网络软件通讯平台(SuperIO)教程】七.二次开发服务驱动

    SuperIO相关资料下载:http://pan.baidu.com/s/1pJ7lZWf 1.1    服务接口的作用 围绕着设备驱动模块采集的数据,根据需求提供多种应用服务,例如:数据上传服务.数 ...

  5. Civil 3D API二次开发学习指南

    Civil 3D构建于AutoCAD 和 Map 3D之上,在学习Civil 3D API二次开发之前,您至少需要了解AutoCAD API的二次开发,你可以参考AutoCAD .NET API二次开 ...

  6. nagios二次开发(一)---开发思想

    NAGIOS现状   从nagios的官网http://www.nagios.org/及其它已经公开的资料,我们可以知道:在web UI层nagios只提供了给我们查看图形界面的操作,界面上有简单的启 ...

  7. nagios二次开发(四)---nagios监控原理和nagios架构简介

    nagios监控原理 下面根据上面摘自网络的原理图对nagios的监控原理进行一下简单的说明: 1.nagios通过nsca进行被动监控.那么什么是被动监控呢?被动监测:就是指由被监测的服务器主动上传 ...

  8. 运用Java对微信公众平台二次开发技术——开发者模式接入

    当初我在这碰到了很多问题,市面上以及网络上的资料特别少,所以当初碰了很多壁,所以现在跟大家分享一下,如何用Java,对微信公众平台进行二次开发. 一.开发预备知识: 最基本的JavaSE与JavaWe ...

  9. Android VLC播放器二次开发1——程序结构分析

    最近因为一个新项目需要一个多媒体播放器,所以需要做个视频.音频.图片方面的播放器.也查阅了不少这方面的资料,如果要从头做一个播放器工作量太大了,而且难度也很大.所以最后选择了VLC作为基础,进行二次开 ...

随机推荐

  1. [转] python提取计算结果的最大最小值及其坐标

    python提取计算结果的最大最小值及其坐标 我们在fluent当中后处理的时候,可以通过fluent本身得到某些物理量的最大值和最小值,但是我们却无法确定这些最大值和最小值的具体位置.其实我们可以将 ...

  2. 【算法笔记】B1024 科学计数法

    1024 科学计数法 (20 分) 科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式 [+-][1-9].[0-9]+E[+-][0-9]+,即数字的整数部分只有 1 位, ...

  3. P3332 [ZJOI2013]K大数查询

    传送门 注意操作 $1$ 是在区间的每个位置加入一个数,不是加上一个值 相当于每个位置维护的是一个集合 显然树套树 一开始想的是区间线段树套权值线段树 发现这样询问区间第 $K$ 大时就要先二分答案再 ...

  4. 计算机插U盘没用了

    今天遇到一个神奇的状况,我想把台机上面的文件通过U盘拷贝到我的笔记本上.文件拷到U盘上没问题,然后把U盘插到笔记本上,一点反应都没有.我想了下,这U盘肯定没坏.然后我笔记本又是新买没多久,一直爱护有加 ...

  5. ORACLE--12C--创建PDB

    一,关于创建介绍 1,介绍 CDB支持多种创建PDB的技术.默认CBD会有一个PDB$SEED 创建的PDB自动包括完整数据字典,包括元数据和CDB根目录中系统提供的对象的内部链接.您必须从单个根定义 ...

  6. NFS 优化及详解

    一, 启动过程: 所以启动的时候一定一定要先启用——————rpcbind———————————————— 启动 rpcbind  ------>/etc/init.d/rpcbind rest ...

  7. Android中的CardView使用

    Android 5.0 版本中新增了CardView,CardView继承自FrameLayout类,并且可以设置圆角和阴影,使得控件具有立体性,也可以包含其他的布局容器和控件. 1.配置build. ...

  8. 【程序员技术练级】学习一门脚本语言 python(三)跟数据库打交道

    接着上一篇,该篇讲述使用python对数据库进行基本的CRUD操作,这边以sqlite3为例子,进行说明.sqlite3 是一个非常轻型的数据库,安装和使用它是非常简单的,这边就不进行讲述了. 在py ...

  9. android应用签名详解

    1.Eclipse工程中右键工程,弹出选项中选择 android工具-生成签名应用包: 2.选择需要打包的android项目工程: 3.如果已有私钥文件,选择私钥文件 输入密码,如果没有私钥文件见 第 ...

  10. c#-FrameWork01

    Framwork ArrayList l  集合类似于数组,同样是用来存放连续数据的,但集合的功能比数组更强大 l  集合和数组的最大区别:数组一旦定义以后就无法改变其大小,而集合可以动态的改变其大小 ...