Catia 二次开发资料(转)

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 二次开发资料(转)

时间: 2024-10-09 11:40:43

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

VB.Net实现下CATIA二次开发方法

源自网络. 在visual studio(vb,c#,c++)下使用CATIA进行二次开发有如下特点: -->需要引用CATIA的对象库 -->需要对象声明(visual studio语法要求).在声明对象时,应指明对象类型为CATIA的某种对象,否则可能执行出错. 下面对以上两点过程详细说明. 1.引用CATIA类型库     1)创建项目,按下组合键(ALT+F7)或点击“项目-->属性” 2)为项目添加引用:在属性窗口中点击“引用",然后点”添加...“ . 2011-5

Automation(以下简称自动化)与CAA的区别--Catia 二次开发方法比较

本文摘自网络.相比CAA开发,COM自动化接口的好处在于:1.不需要购买安装CAA2.因为是基于COM组件调用进行开发,所以可以用任何(高)版本VS进行开发,有更好的智能感知和代码提示3.CAA开发中涉及大量复杂的设计模式,而且必须用C++开发,编译环境也必须是达索提供的编译环境,而自动化开发可以基于C++,也可以使用CLR语言如C#.http://VB.NET,开发难度大大降低,可以非常非常顺手的写图形化程序,可以在同一个工程中同时用C#.VB.C++/CLI开发,这非常酷4.开发前准备只需要

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

去年开始学习Catia CAA的二次开发,前后的间断性学习有1年吧. 现在已经好久没用,忘得也差不多了,原来的笔记都放在了Evernote,现在还是觉得边继续复习边总结一下,以后也比较好检索. 先吐槽catia caa的二次开发,自身背景是只会点C++编程,机械相关一窍不通,当时看二次开发的那1个月,真是朝9晚10的全身心投入,动手写了各种test_xxxxx练习,知识就是越练越灵活,当初在CAA的群里各种问问题,现在也能勉强回答问题了.两个资料,CAA_Doc大法好,caa_cag大法好,耐下

zimbra二次开发的相关资料

需求描述: 当前用户接受某约会邀请后,其free/busy状态会显示为busy:但用户设置外出,即outgoing或out off office时,其用户状态反倒显示free.管理层希望实现设置外出后,free/busy状态为busy或outgoing.这样就必须得到该用户的free/busy状态和outgoing设置. 以下为预研资料 zimbra支持二次开发和扩展 1.服务器端扩展,使用soap响应点,如增加账户等: 如果使用soap获取服务器端数据,目前在网上没有相关代码示例,只找到一篇通

Arcengine 二次开发添加右键菜单

最近在搞arcengine 二次开发,遇到了好多问题,也通过网上查资料试着慢慢解决了,把解决的步骤记录下来,有需要帮助的可以看一下,也欢迎各位来批评指正. 想给自己的map application在图层上添加右键菜单,谷歌了一下,找到了解决的方法,原文的地址edndoc.esri.com/arcobjects/9.2/NET/1ED14BF2-A0E3-4e56-A70D-B9A7F7EC7880.htm.然后我根据这个添加了自己的右键菜单,又有一些改动. 效果如图所示(有点简陋),仅仅是简单的

java快速开发平台 二次开发 SSM后台框架

获取[下载地址]     [免费支持更新]三大数据库 mysql  oracle  sqlsever   更专业.更强悍.适合不同用户群体[新录针对本系统的视频教程,手把手教开发一个模块,快速掌握本系统] A 集成代码生成器 [正反双向(单表.主表.明细表.树形表,开发利器)+快速构建表单; freemaker模版技术 ,0个代码不用写,生成完整的一个模块,带页面.建表sql脚本,处理类,service等完整模块B 集成阿里巴巴数据库连接池druid;  数据库连接池  阿里巴巴的 druid.

如何查找STM32开发资料

Ⅰ.概述 该文写给那些处于初学ST芯片开发.英文不好而又想偷懒的人. 该文主要的目的是提醒大家:学习一门技术是需要舍得花功夫,捷径是你在起点与终点之间不断的探索,最终总结出来的一条适合自己的路. 下面我将相关搜索.查找的方法教给大家,最后会把相关资料的下载地址放在最后,详情请往下看. 本着免费分享的原则,方便大家手机学习知识,定期在微信平台分享技术知识.如果你觉得分享的内容对你有用,又想了解更多相关的文章,请用微信搜索“EmbeddDeveloper” 或者扫描下面二维码.关注,将有更多精彩内容

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

nagios监控原理 下面根据上面摘自网络的原理图对nagios的监控原理进行一下简单的说明: 1.nagios通过nsca进行被动监控.那么什么是被动监控呢?被动监测:就是指由被监测的服务器主动上传数据到nagios监控系统中.这种监测方式提高了实时性(出现问题的时候,被监测的服务器可以及时上传数据通知nagios,从而使管理员可以尽快作出处理,而不用像主动监测中一样,非要等到下一个监测周期才能获知被监测服务器的状态).NSCA就是可以实现Nagios被动监测的一个程序.目前所知道的,只能通过

AutoCAD二次开发——AutoCAD.NET API开发环境搭建

AutoCAD二次开发--AutoCAD.NET API开发环境搭建 AutoCAD二次开发--AutoCAD.NET API开发环境搭建 AutoCAD二次开发工具:1986年AutoLisp,1989年ADS,1990年DCL,1993年ADS-RX,1995年ObjectARX,1996年Active X Automation(COM),1997年VBA,1998年Visual Lisp,2006年.net API(DLL). 趋势和方向:AutoCAD.net API(AutoCAD20