机械专业外文翻译--Pro ENGINEER 软件二次开发技术

上传人:红** 文档编号:180310294 上传时间:2023-01-05 格式:DOC 页数:11 大小:77.50KB
返回 下载 相关 举报
机械专业外文翻译--Pro ENGINEER 软件二次开发技术_第1页
第1页 / 共11页
机械专业外文翻译--Pro ENGINEER 软件二次开发技术_第2页
第2页 / 共11页
机械专业外文翻译--Pro ENGINEER 软件二次开发技术_第3页
第3页 / 共11页
点击查看更多>>
资源描述
附录THE TECHNOLOGY OF THE PROGRAM REDEVELOP ON PRO/ENGIN EER0IntroductionPro/ ENGINEER developed by Technology Corporation U SA is CAD / CAE / CAM software system. It integrates 3D solid modeling, designing, machining, analysis and drawing, famous for convenience, parametric feature modeling and system relativity. At present, Pro/ENGINEER has extensive used in various fields in m any countries.Although Pro/E is general utility, it has some shortages in a few facets. Furthermore its design standard differ form our countys standard. It is an important work to redevelop application to adapt requirement of designer in various fields based on commercial CAD/CAM software platform. Most CAD/ CAM software support interface to redevelop, Pro/TOOLKIT is the redevelopment interface in Pro/E software.1Introduction to Pro/TOOLKITPro/ TOOLKIT is the customization toolkit for Pro/ENGINEER from Parametric Technology Corporation (PTC). It gives customers and third parties the ability to expand Pro/ENGINEER capabilities by writing programming language code and then seamlessly integrating the resulting application in to Pro/ENGINEER. Pro/TOOLKIT provides a large library of functions to provide the external application safe and controlled access to the Pro/ENGINEER database and applications. Pro/TOOLKIT is the PTC application programmers interface (A P I).Pro/TOOLKIT uses an object oriented programming style. Data structures for the transfer information between Pro/ENGINEER and the application are not directly visible to the application. These data structures are accessible only with Pro/TOOLKIT functions. The most basic Pro/TOOLKIT concepts are objects and actions. Each Pro/TOOLKIT library function performs an action on a specific type of object. The Pro/TOOLKIT convention for function names is the prefix Pro the name of the object type, and the name of the action it performs. A Pro/TOOLKIT object is a well defined and self contained structure used to perform actions relevant to that object. Most objects are items in the Pro/ENGINEER database, such as features and surfaces. Others, however, are more abstract or transient, such as the information resulting from a select action.2The technology of develop by Pro/TOOLKIT2. 1The method of work by Pro/TOOLKIT2. 1. 1Synchronous ModeDepending on how your synchronous application from Pro/ENGINEER, your application can be classified as either DLL Mode or Spawned Mode The following sectins describe DLL and Spawned synchronous mode.DLL ModeThe standard method by which Pro/TOOLKIT application code is integrated in to Pro/ENGINEER is through the use of dynamically linked libraries (DLL s). When you compile your Pro/TOOLKIT application code and link it with the Pro/TOOLKIT library, you create an object library file designed to be linked in to the Pro/ENGINEER executable when Pro/ENGINEER starts up. This method is referred to as DLL mode.Spawned ModePro/TOOLKIT also supports a second method of integration: the multi process o r spawned mode. In this mode, the Pro/TOOLKIT application code is compiled and linked to form a separate executable. This executable is designed to be spawned by Pro/ENGINEER and runs as a child process of the Pro/ENGINEER session. In DLL mode, the exchanges between the Pro/TOOLKIT application and Pro/ENGINEER are made through direct function calls. In multi process mode, the same effect is created by an inter process messaging system that simulates direct function calls by passing the information necessary to identify the function and its argument values between the two processes. Multi process mode involves more communications overhead than DLL mode, especially when the Pro/TOOLKIT application makes frequent calls to Pro/TOOLKIT library functions, because of the more complex method of implementing those calls. However, it offers the following advantage: it enables you to run the Pro/TOOLKIT application with a source-code debugger without also loading the whole Pro/ENGINEER executable in to the debugger.If you use multi process mode during development of your application to debug more easily, you should switch to DLL mode when you install the application for your end users because the performance is better in that mode. However, take care to test your application thoroughly in DLL mode before you deliver it. Any programming errors in your application that cause corruption to memory used by Pro/ENGINEER or Pro/TOOLKIT are likely to show quite different symptoms in each mode, so new bugs may emerge when you switch to DLL mode.2. 1. 2A synchronous ModeDLL and spawned modes are synchronous modes in the sense that the Pro/TOOLKIT application and Pro/ENGINEER do not perform operations concurrently. In spawn mode, each process can send a message to the other to ask for some operation to occur, but each waits for a returning message that reports that the operation is complete. Control alternates between the two processes, one of which is always in a wait state.A synchronous mode is a multi process code in which the Pro/TOOLKIT application and Pro/ENGINEER can perform concurrent operations. Unlike the synchronous modes, asynchronous mode uses remote procedure calls (.rpc) as the means of communication between the application and Pro/ENGINEER.Simple Asynchronous ModeIn asynchronous mode, the application (containing its own main () function) is started independently of Pro/ENGINEER and subsequently either starts or connects to a Pro/ENGINEER process .A simple asynchronous application can spawn and connect to a Pro/ENGINEER process via the function Pro/Engineer Start (). During this startup, Pro/ENGINEER calls user initialize () if it is present in the application. The Pro/ENGINEER process listens for requests from the application and acts on the requests at suitable break points normally between commands.Full Asynchronous ModeIn full asynchronous mode, the application implements a control loop that listens for messages that arrive from Pro/ENGINEER. As a result, Pro/ENGINEER can call functions in the application, including callback functions for menu buttons and notifications. It is often necessary for your full asynchronous application to be notified of the termination of the Pro/ENGINEER process. In particular, your control loop need not continue to listen for Pro/ENGINEER messages if Pro/ENGINEER is no longer running. In full asynchronous mode must contain a call to the function Pro/Event Process (), which takes no arguments. This function responds to Pro/ENGINEER messages in a manner similar to synchronous mode.2. 2The steps of Developing a Pro/TOOLKIT ApplicationAn asynchronous Pro/TOOLKIT application is fundamentally different in its architecture from a synchronous mode application, so we should choose between these methods before writing any application code. As a general rule, synchronous mode should be the default choice un less there is some unavoidable reason to use asynchronous mode, because the latter mode is more complex to use.2. 2. 1Writing application codeA Pro/TOOLKIT application must always contain the functions user initialize () and user CD#3 2terminate ( ). These functions have the prefix user because they are written by the Pro/TOOLKIT application developer, but they are called from with in Pro/ENGINEER at the start and end of the session. The function user initialize () is called after the Pro/ENGINEER application has been initialized and the Graphics Window has been created. This function should contain any initializations that your Pro/TOOLKIT application needs, including any modification of Pro/ENGINEER menus. The initialization function must return 0 to indicate that the Pro/TOOLKIT application was initialized successfully. Any other return value will be interpreted as a failure, and the system will notify the Pro/ENGINEER user that the Pro/TOOLKIT application failed. The function user terminate () is called at the end of the Pro/ENGINEER session, after the user selects Yes on the Exit confirmation dialog box. Its return type is void.2. 2. 2Compiling and Linking a Pro/TOOLKIT ApplicationThe compiler options and system libraries needed to compile and link a Pro/TOOLKIT application are generally different on each platform. To ensure that the make file you use for building your Pro/TOOLKIT application uses the correct options, you should base your make file on one of the make files located under the Pro/TOOLKIT load point. These are designed for building the various Pro/TOOLKIT applications whose source is included in the Pro/TOOLKIT installation.2. 2. 3Registering a Pro/TOOLKIT ApplicationRegistering a Pro/TOOLKIT application means providing information to Pro/ENGINEER about the files that form the Pro/TOOLKIT application. To do this, create a small text file, called the Pro/TOOLKIT registry file, that Pro/ENGINEER will find and read. Pro/ENGINEER searches for the registry file in the following locations, in this order:1. A file called PROTK.DAT or PRODEV. DAT in the current directory2. A file named in a PROTK.DAT, PRODEVDAT, or TOOLKIT _ REGISTRY_ FILE statement in the Pro/ENGINEER configuration file3. A file called PROTK.DAT or PRODEV. DAT in the directory / /text/4. A file called PROTK.DAT or PRODEV. DAT in the directory / text in the last two options, the variables are as follows: The Pro/ENGINEER load point (not the Pro/TOOLKIT load point) The machine specific subdirectory (such as sgi_elf2 or i486_nt) The name of the Pro/ENGINEER language the Pro/TOOLKIT application will be used with (such as Usascii (English), German, or Japanese)The registry file is a simple text file, where each line consists of one of a predefined set of keywords, followed by a value. The standard form of the registry file in DLL mode is as follows: name Your Application Name startup dll exec_file LOADDIR/MACHINE_TYPE/obj_filename. dlltext_dir LOADD IRrevision 3endThe statements in the registry file are as follow s:name Assigns a unique name to this Pro/TOOLKIT application. This is used to identify the application if there is more than one.Startup Specifies the method Pro/ENGINEER should use to communicate with the Pro/TOOLKIT application. This example specifies DLL mode.Exec_ file Specifies the name of the file produced by compiling and linking the Pro/TOOLKIT application. In DLL mode, this is a dynamically linkable library; in multi process mode, it is the executable of a complete program.Text_ dir Specifies the directory that contains the menu and message files used by the Pro/TOOLKIT application. These files allow multi language support for menu buttons and messages used in the Pro/TOOLKIT application.RevisionSpecifies the version of Pro/TOOLKIT against which you built the application. Use the name for the current release of Pro/TOOLKIT (for example, 2001, 2000i, 2000i2, 2001).End Indicates the end of the descript ion of this Pro/TOOLKIT application.2. 2. 4Stopping and Restarting a Pro/TOOLKIT ApplicationPro/TOOLKIT supports the ability to stop and restart a synchronous application with in a single session of Pro/ENGINEER. This is particularly useful during development of an application because it enables you to make changes to your source code and retest it without having to restart Pro/ENGINEER and reload your test models. Use the Auxiliary Applications dialog box to stop and restart applications .To make this option available, the registry file (default name PROTK. DAT) should contain one of the following lines:Multi process mode:startup spawnDLL mode:startup DLLIf you want to be able to stop and restart your Pro/TOOLKIT application with in Pro/ENGINEER, you must also add the following statement to the definition of the application in the registry file:Allowed stop TRUEIf you use the allow stop option, you might also set Pro/ENGINEER to not start the Pro/TOOLKIT application until you explicitly request it. To do this, you must add the following statement in your registry file: delay start TRUE2. 2. 5Unlocking a Pro/TOOLKIT ApplicationBefore you distribute your application executable to the end user, you must unlock it. This enables the end user (your customer) to run your application without having Pro/TOOLKIT as an option. To unlock your application, enter the following command:/ bin/protk unlock file name3ConclusionsPro/TOOLKIT application extends the 3D modeling and library of the standard part, and increase some functions of the graphics informations label, product data management. In this way, we can improve the function of Pro/ENGINEER and accelerate the development of CAD/CAM software.References:1 Parametric Techno logy Corporation. Pro/TOOLKIT Users Guide Z . U SA. 2001.2 LA I Chao2an, L IZhen2nan. The Key Techno logy about Application Development of Pro/E J . computer applications 2001. 9译文Pro/ ENGINEER 软件二次开发技术李其其格, 武建新, 贺向新0 简介 Pro/ENGINEER是由美国PTC(Parametric Technology Corporation参数技术公司)开发的CAD/CAM/CAE集成软件系统。它是集成化的三维实体造型、设计、运动仿真、结构分析、绘制工程图软件,特别以方便的参数化特征造型和系统相对性而闻名。目前,Pro/ENGINEER的使用已经延伸到许多国家的各个领域了。尽管Pro/E是一个一般化的公共程序,但是它在某些方面还是存在一定的不足。此外,它自身的实际标准和我国的国标有所不同。因此,二次开发适应各种不同的领域设计者基于商业的CAD/CAM的软件平台的需求的申请是一项很重要的工作。许多CAD/CAM软件都支持接口的二次开发,Pro/TOOLKIT是Pro/E的二次开发接口。1 Pro/ TOOLKIT简介Pro/E用Pro/ TOOLKIT从美国技术参数公司(PTC)设定工具箱。这使用户可以通过编写程序源代码来提高Pro/E的能力,然后在Pro/E中得心应手地使用产生的申请。Pro/ TOOLKIT提供了一个很大的功能图书馆来保存外部的保存,并控制Pro/E的数据库的存取以及申请。Pro/ TOOLKIT是PTC程序申请的接口。Pro/TOOLKIT用一种客观的定向规画风格,Pro/E和申请之间传递的数据并不是直接可以看的见的,而只能在Pro/TOOLKIT的功能图书馆中存取。最基本的Pro/TOOLKIT概念就是实体和造型,每一个Pro/TOOLKIT功能图书馆都在一个特殊的实体上运行一个造型。Pro/TOOLKIT功能图书馆中每一个实体都有一个前缀名“Pro”,并用这个名字代表所做的造型,每一个实体都经过定义,并自动连接到相关的实体造型中。大部分实体都存在于Pro/E数据库中,比如特征和曲面。其他的,都以摘录或者暂态形式存储,例如一个造型产生的信息。2 Pro/TOOLKIT发展的技术2.1 Pro/TOOLKIT的工作方式2.1.1 同步模型根据你如何从Pro/E中申请同步模型,你的申请可以分为“DLL模型”或“Spawned模型”。接下来为您详细介绍DLL和Spawned同步模型。DLL模型把Pro/TOOLKIT申请整合到Pro/E中的标准方法是通过动态地连接到Pro/TOOLKIT图书馆中(DLLs)。在Pro/E运行的时候,当你编译一个Pro/TOOLKIT文件代码并将其导入Pro/TOOLKIT图书馆中,你便创建了一个连接到Pro/E运行器中的实体文件。这就是“DLL模型”Spawned模型Pro/TOOLKIT也支持第二种整合方法:“multi 程序”或者Spawned模型。在这个模型中,Pro/TOOLKIT申请代码被编译并连接到一个独立的运行器中,这个运行器被设计用来形成Pro/E的产物并作为它的一个子程序来运行。在DLL模型中,Pro/TOOLKIT和Pro/E之间的数据转换是通过直接的功能响应来实现的;而在multi 程序模型中,则是通过一个内部程序信息系统来完成的,这个系统是通过模拟信息在两个程序中的转换所必须的功能并通过辨别此功能值来确定功能响应的。Multi 程序模型比DLL模型包含更多的交流信息,特别是当Pro/TOOLKIT更加频繁地访问Pro/TOOLKIT图书馆功能的时候,因为实现这些功能响应需要更复杂的方法。然而它有以下几方面的优点:它可以用一个源代码纠正直接运行Pro/TOOLKIT而不用下载整个Pro/E纠正运行器。在你改进你的申请使之更容易纠错是,如果你用Multi 程序模型,那么在安装你的终端用户申请时你必须转变为DLL模型,因为DLL模型的表现比较好。然而,在你投递你的申请时,注意在你的DLL模型上彻底地测试。你程序里的任何错误都会引起Pro/E使用记录的乱码,或者Pro/TOOLKIT会给你一个完全不同的结果,这样的话,在你转换你的DLL模型时就会产生新的错误了。2.1.2 非同步模型DLL模型和Spawned模型都是同步模型,所以Pro/E和Pro/TOOLKIT不会同时产生操作。在Spawned模型中,每一个程序都可以给另一个发送信息来要求某些操作,但是每一个程序都得等待一个操作已经完成的反馈信息才能进行。两个程序中的控制代理器总有一个通常处于等待状态。非同步模型是Pro/TOOLKIT申请和Pro/E可以同时操作的一种复合程序模型。与同步模型不同的是,非同步模型用的是远程程序呼叫(.rpc),即Pro/TOOLKIT申请和Pro/E可以相互交流。简易非同步模型在非同步模型中,Pro/TOOLKIT申请(包括其自身的main()动作)是独立于Pro/E启动的,然后再启动或者连接到Pro/E程序中的。一个简易的非同步模型经由Pro/Engineer Start ()可以产生或者连接到一个Pro/E程序。在这个启动过程中,如果user initialize ()存在于申请中,那么Pro/E程序就呼叫这个程序。Pro/E程序“听”来自申请的要求并在适当的休息点对指令之间正常地执行动作。完全的非同步模型 在完全的非同步模型中,申请实施一个“听从”来自于Pro/E程序的信息的控制循环,因此,Pro/E程序可以调用申请里的动作,包括收回菜单按钮和通知的动作。通常,你的完全的非同步申请必须听从来自Pro/E程序的终止程序。有一种特殊情况就是当Pro/E程序不再运行的时候,你的控制循环就不需要听从Pro/E程序的命令了。完全的非同步模型必须要有一个无条件呼叫Pro/Event Process ()的动作。这个动作以和同步模型相似的信息反馈方式反馈给Pro/E程序。2.2 发展一个Pro/TOOLKIT申请的步骤一个非同步的Pro/TOOLKIT申请在发展步骤上和同步申请基本上是不同的,所以,在写一个申请代码之前,我们必须先考虑好用适当的方法。通常有一条规则,同步模型必须预先选择,除非有不可避免的原因才选择非同步模型,因为后者使用起来很复杂。2.2.1编写申请代码一个Pro/TOOLKIT申请必须包含user initialize () 和 user CD#terminate ( )两个动作,这些动作都有一个前缀“user”,因为它们都是由Pro/TOOLKIT申请扩展器编写的,但是它们分别在Pro/E的启动和关闭期间被呼叫。user initialize ()是在Pro/E申请设定并且图形窗口也创建之后才能使用的,这个动作必须包含任何Pro/TOOLKIT所需要的以及Pro/E菜单修改的设定初值,这个设定初值必须回零来指出Pro/TOOLKIT的初值设定成功。任何其他初值都会被认为是一个错误,系统就会通知Pro/E用户Pro/TOOLKIT申请失败。user CD#terminate ( )是在Pro/E关闭的时候,在用户选择证实退出对话框“Yes”之后被呼叫的,它的回行类型是空的。2.2.2 编译和连接一个Pro/TOOLKIT申请编译者的选择和系统图书馆需要的编译和连接的Pro/TOOLKIT申请在各自的平台上是不同的。为了保证你用来建立Pro/TOOLKIT申请的文件使用正确的选择,你必须使你的建立文件基于一个Pro/TOOLKIT建立文件的下载点上,这些文件是设计用来建立各种基于包括Pro/TOOLKIT安装来源的Pro/TOOLKIT申请。2.2.3 登记一个Pro/TOOLKIT申请登记一个Pro/TOOLKIT申请就是提供来自Pro/TOOLKIT申请文件的信息到Pro/E上。为此,我们要先创建一个名为Pro/TOOLKIT“登记文件”的文本文件,使得Pro/E可以找到和读取。Pro/E在以下位置搜索该登记文件,并通过如下顺序:1 在当前目录下寻找PROTK. DAT 或者 PRODEV. DAT的文件2 在Pro/E的结构文件中,一个以PROTK.DAT , PRODEVDA T , 或者 TOOLKIT _ REGISTRY_ FILE命名的报表文件3 在目录 / /text/下名为PROTK. DAT 或者 PRODEV. DAT的文件4在目录 / /text下名为PROTK. DAT 或者 PRODEV. DAT的文件后两者中的变量如下:是Pro/ENGINEER负荷点(而不是Pro/TOOLKIT负荷点)机器制造的特性子目录(例如sgi_elf2 or i486_ nt)Pro/TOOLKIT申请所用的Pro/E语言(比如英语、德语或者日语)登记文件是一个简单的文本文件,每一行都由预先定义的关键词组成,然后写入变量值名字 你的申请的名字启动方式 DLL管理文件 LOADDIR/MACHINE_TYPE/obj_filename. dll文本DIR LOADDIR校验次数 3回车(结束)登记文件里的变量称述如下:文件名为你的Pro/TOOLKIT申请分配一个单一的文件名,这是为了确定你的申请是独一无二的。启动模式选择Pro/ENGINEER和Pro/TOOLKIT申请信息交流的方式,本例选择DLL模式Exec_ file(管理文件)选择由编译和连接到Pro/TOOLKIT申请所产生的文件名,在DLL模型中是一个动态的可连接的图书馆,而在Multi程序模型中则是一个完整程序的运行器Text_ dirPro/TOOLKIT申请所用的包括目录和信息文件的目录,这些文件使Multi文件支持Pro/TOOLKIT申请所用的目录和信息文件校验次数选择相对于你所建立的Pro/TOOLKIT申请的版本,使用你当前所用的Pro/TOOLKIT申请的版本的名字(例如2001、2000i、2000)回车(结束)指出所用的Pro/TOOLKIT申请的结束。2.2.4 停止并重新启动一个新的Pro/TOOLKIT申请Pro/TOOLKIT支持在Pro/ENGINEER单一期间中停止和重新启动一个同步模型申请,在建立一个申请时,这是非常有用的,因为这让你可以不需要重新启动Pro/ENGINEER以及重新下载你的模型测试就直接改变申请源代码并进行测试,可使用非同步模型对话框来停止和重新启动申请。为了得到这个选项,登记文件(失败文件名为PRODK.DAT)必须包含以下几条的其中一条:Multi程序模式:重起spawmDLL模型:重起DLL如果你想在Pro/ENGINEER中停止和重起你的Pro/TOOLKIT申请,你必须在你的登记文件的定义中加入以下的条件:允许停止“TRUE”如果你用了允许停止选项,你也可以在不启动Pro/TOOLKIT申请时启动Pro/ENGINEER直到你明确地提出了你的申请。为此,你必须把以下条件加入你的登记文件延迟启动“TRUE”2.2.5 开启一个Pro/TOOLKIT申请在你分配你的申请运行器到终端用户之前,你必须启动Pro/TOOLKIT申请,这使得你的终端用户(你的顾客)在运行申请之前选择启不启动Pro/TOOLKIT。输入以下命令来启动你的申请:/ bin/protk unlock file name3 结论Pro/TOOLKIT扩充了3D模型和标准零件库,也增加了一些图形信息分类的功能以及产品数据管理,从而,我们可以提高Pro/ENGINEER的功能并加速CAD/CAM软件的发展。参考文献1PTC用户指导.Z.U.S.A.20012赖超安、李震南.关于Pro/E二次开发的主要技术.J.计算机申请.2001.9.
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 图纸设计 > 任务书类


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!