Catia坐标点输出程序相关函数及参数.doc_第1页
Catia坐标点输出程序相关函数及参数.doc_第2页
Catia坐标点输出程序相关函数及参数.doc_第3页
Catia坐标点输出程序相关函数及参数.doc_第4页
Catia坐标点输出程序相关函数及参数.doc_第5页
已阅读5页,还剩33页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

从documents找到的Catia坐标点输出程序相关函数,点坐标提取及定义1HybridShapePointCoord (Object)1Property Index2Properties2对象控制3AnyObject (Object)3Property Index4Method Index4Properties4Methods5选择元素6SelectedElement (Object)6Property Index6Method Index6Properties7Methods9选择方法10Selection (Object)10Property Index12Method Index12Properties13Methods13点坐标提取及定义file:/F:/catiav5r16doc_en/English/online/interfaces/interface_hybridshapepointcoord.htm# HybridShapePointCoord (Object)IUnknown | +-IDispatch | +-CATBaseUnknown | +-CATBaseDispatch | +-AnyObject | +-HybridShape | +-Point | +-HybridShapePointCoord Point defined by coordinates.Role: To access data of the point feature created with its cartesian coordinates. See also: Length See also: Reference See also: HybridShapeFactory Property IndexPtRef Returns or Sets the reference point for PointCoord feature. RefAxisSystem Returns or Sets the reference Axis System for PointCoord feature. X Returns X coordinate of the point. Y Returns Y coordinate of the point. Z Returns Z coordinate of the point. Propertieso Property PtRef( ) As CATIAReference Returns or Sets the reference point for PointCoord feature. This data is not mandatory, if element is null, the origin point is taken. When an element is given, X, Y and Z are measured starting from this point. Sub-element(s) supported (see Boundary object): Vertex. Example: This example retrieves in oPtRef the reference point for PointCoord feature. Dim oPtRef As CATIAReference Set oPtRef = PointCoord.PtRef o Property RefAxisSystem( ) As CATIAReference Returns or Sets the reference Axis System for PointCoord feature. This data is not mandatory, if element is null, the absolute axis system is taken. When an element is given, X, Y and Z are considered in this Axis system. If reference point is not specified, X,Y and Z are measured from origin of this axis system. * Example: This example retrieves in oRefAxis the reference Axis System for PointCoord feature. Dim oRefAxis As CATIAReference Set oRefAxis = PointCoord.RefAxisSystem o Property X( ) As CATIALength (Read Only)Returns X coordinate of the point. Example: This example retrieves in oX the X coordinate for the PointCoord hybrid shape feature. Dim oX As CATIALength Set oX = PointCoord.X o Property Y( ) As CATIALength (Read Only)Returns Y coordinate of the point. Example: This example retrieves in oY the Y coordinate for the PointCoord hybrid shape feature. Dim oY As CATIALength Set oY = PointCoord.Y o Property Z( ) As CATIALength (Read Only)Returns Z coordinate of the point. Example: This example retrieves in oZ the Z coordinate for the PointCoord hybrid shape feature. Dim oZ As CATIALength Set oZ = PointCoord.Z 对象控制AnyObject (Object)IUnknown | +-IDispatch | +-CATBaseUnknown | +-CATBaseDispatch | +-AnyObject file:/F:catiav5r16doc_enEnglishonlineCAAScdBaseCAAScdAutomationHome.htm Represents the base object for all other objects except collection and reference objects.As a base object, it provides properties shared by any other object. Property IndexApplication Returns the application. Name Returns or sets the name of the object. Parent Returns the parent object. Method IndexGetItem Returns an object from its name. Propertieso Property Application( ) As CATIAApplication (Read Only)Returns the application. The application is the root object of the object structure and can be retrieved from any object in this object structure using the Application property. The root object, also called top-level object, is the object located at the top of the applications object structure. It is used by clients to retrieve and navigate across all the applications subordinate objects. If the client runs in-process, it retrieves the object at the top of the object structure. If the client runs out-process, it should call the GetApplication method to retrieve the object at the top of the object structure, which is the only object accessible from outside. The Application property is thus the way to jump from any object up to the root of the object structure, allowing then to navigate downwards. For in-process scripting, the application is always referred to as CATIA. Note that the Application property of the Application object returns the Application object itself. Example: This example retrieves in CurrentApplication the application object, root of the object structure, from a given object of this structure: a document refered to using the MyDoc variable. Dim CurrentApplication As Application Set CurrentApplication = MyDoc.Application o Property Name( ) As CATBSTR Returns or sets the name of the object. The name is a character string automatically assigned to any object to handle it easier. Even if the Name property allows you to reassign an object name, this is not advised. Many objects, such as the application and the collections, have names that you must not change, and its safer to use Name as a read only property. When an object is part of a collection, the object name can often be used in place of the object rank to retrieve or remove the object, providing the Item and Remove methods of the collection feature an argument with the Variant type. A name must start with a letter. It can include numbers, but it cant include spaces. If the object has no name set, the default name returned is the object type. For example, the Name property of a Viewer3D object with no name set returns Viewer3D. Example: This example retrieves in MyObjectName the name of the MyObject object. MyObjectName = MyObject.Name o Property Parent( ) As CATBaseDispatch (Read Only)Returns the parent object. The parent object of a given object is the object just above in the object structure, usually the object that created this object and that aggregates it. In the case of an object part of a collection, the parent object is not the collection object itself, but the object that aggregates the collection object. The Parent property is the way to step upwards in the object structure. Note that the Parent property of the Application object returns the Application object itself. Example: This example retrieves in ParentObject the parent object of the GivenObject object. Dim ParentObject As AnyObject Set ParentObject = GivenObject.Parent Methodso Func GetItem( CATBSTR IDName) As CATBaseDispatch Returns an object from its name. Role: To retrieve an object when only its name is available. You should not use this method, but you can find it in the macros generated by the Tools-Macro command. Parameters: IDName The searched obect name Returns: The searched object 选择元素SelectedElement (Object)IUnknown | +-IDispatch | +-CATBaseUnknown | +-CATBaseDispatch | +-AnyObject | +-SelectedElementfile:/F:catiav5r16doc_enEnglishonlineCAAScdBaseCAAScdAutomationHome.htm Represents an element contained by a Selection object.This object is an object contained by a Selection object. The Selection object contains SelectedElement objects, which are accessed through the Selection.Count2 and Selection.Item2 methods. Property IndexDocument Returns the document to which the selected element belongs. LeafProduct Returns the leaf product corresponding to the selection in the specification tree. Reference Returns a Reference version of the Value property. Type Returns the string constant which describes the selected element Automation type. Value Returns the actual selected automation object. Method IndexGetCoordinates Returns the coordinates of the pick point. Propertieso Property Document( ) As CATIADocument (Read Only)Returns the document to which the selected element belongs. o Property LeafProduct( ) As CATIABase (Read Only)Returns the leaf product corresponding to the selection in the specification tree. Role: Returns the leaf Product (component, corresponding for example to Product1.1 in the specification tree). The AnyObject returned is a Product if a product appears in the specification tree, in the path corresponding to the current selection, and a fake AnyObject whose AnyObject.Name property equals to InvalidLeafProduct otherwise.Cumulated with the use of the AnyObject.Parent property (which enables to navigate into the object structure), the current property enables the scripter to obtain the path, in the specification tree, corresponding to the selection. Example: The following example supposes a Part or a Product is opened. It asks the end user to select a Shape in the current window. It then sends message boxes containing the names of the automation objects contained in the specification tree path corresponding to the shape selected, and, regarding the automation objects which are products (only products which are components), a message box containing the abcissa of the translation of the product compared to its reference product. Dim Status,Feature,LeafProduct,LeafProductProcessed,InputObjectType(0) Dim Document,Selection,AutomationTreeNodeOrProduct,Position,AxisComponentsArray(11) Set Document = CATIA.ActiveDocument : Set Selection = Document.SelectionWe propose to the user that he select a feature InputObjectType(0)=AnyObject Status=Selection.SelectElement2(InputObjectType,Select a feature,true) if (Status = Cancel) then Exit Sub Set Feature = Selection.Item(1).Value Set LeafProduct = Selection.Item(1).LeafProduct LeafProductProcessed = true if (LeafProduct.NameInvalidLeafProduct) then LeafProductProcessed = false Set AutomationTreeNodeOrProduct = Feature do while (TypeName(AutomationTreeNodeOrProduct)Application) We send a message box, if AutomationTreeNodeOrProduct is not nor a Shapes object neither a PartDocument object if (TypeName(AutomationTreeNodeOrProduct)Shapes) And _ (TypeName(AutomationTreeNodeOrProduct)Bodies) And _ (TypeName(AutomationTreeNodeOrProduct)PartDocument) And _ (TypeName(AutomationTreeNodeOrProduct)Products) And _ (TypeName(AutomationTreeNodeOrProduct)ProductDocument) then msgbox AutomationTreeNodeOrProduct.Name if (TypeName(AutomationTreeNodeOrProduct)=Product) then We display a message box containing the abcissa of the translation, except in the case of the root product if (TypeName(AutomationTreeNodeOrProduct.Parent.Parent)Application) then Set Position = AutomationTreeNodeOrProduct.Position Call Position.GetComponents(AxisComponentsArray) msgbox AxisComponentsArray(9) end if end if end if We determine the next automation tree node or product Set AutomationTreeNodeOrProduct = AutomationTreeNodeOrProduct.Parent if (TypeName(AutomationTreeNodeOrProduct)=Application) And (Not LeafProductProcessed) then The specification tree path corresponding to the selection contains at least one product, which the current loop as not yet processed. It means that the parent in the specification tree of the feature corresponding to the last message box sent is LeafProduct Set AutomationTreeNodeOrProduct = LeafProduct LeafProductProcessed = true end if loopIf you run the preceeding piece of script, the current document beeing a product with the following specification tree: +-+ !Product3! +-+-+ ! +- Product2 (Product2.1) translation value: 10 ! ! ! +- Product1 (Product1.1) translation value: 20 ! ! ! +- Part1 (Part1.1) ! ! ! +- Part1 ! ! ! +- PartBody ! ! ! +- Pad.1 +- Part2 (Part2.1)and you select Pad.1, the message boxes displayed will be: Pad.1 PartBody Part1 Part1.1 Product1.1 20 Product2.1 10 Product3 o Property Reference( ) As CATIAReference (Read Only)Returns a Reference version of the Value property. Role: Returns a Reference version of Value . o Property Type( ) As CATBSTR (Read Only)Returns the string constant which describes the selected element Automation type. This type is returned by the Value property, and may be, for instance Pad or Line2D. Caution: This property gives the leaf automation type of the object, in the inheritance hierarchy. Nevertheless, after a call to Selection.SelectElement2 , Selection.SelectElement3 , Selection.SelectElement4 , Selection.IndicateOrSelectElement2D or Selection.IndicateOrSelectElement3D , this property gives the input filter string constant relative to the effective selection (more precisely the first filter string constant delivered through the iFilterType parameter, for which the current automation object fullfills the string constant). This string constant may be an automation object name corresponding to the iFilterType parameter with which Selection.SelectElement2 has previously been called, or even a CATSelectionFilter value name. Example: Suppose you run the following piece of script: Set Selection = CATIA.ActiveDocument.Selection We propose to the user that he select a Prism or a Hole ReDim InputObjectType(1) : InputObjectType(0)=Prism : InputObjectType(1)=Hole Status=Selection.SelectElement2(InputObjectType,Select a prism or a hole,true) if (Status = Cancel) then Exit Sub AutomationType = Selection.Item(1).TypeIf the user selects a Pad, the script AutomationType variable will contain Prism and not Pad. Consequently, in most cases, use the VBScript TypeName function instead of this property. o Property Value( ) As CATBaseDispatch (Read Only)Returns the actual selected automation object. Methodso Sub GetCoordinates( CATSafeArrayVariant ioPoint)Returns the coordinates of the pick point. Parameters: oPoint The coordinates of the pick point, i.e. the hit between the geometric object and the cursor.The length of this parameter will be 3, except if the document is a DrawingDocument Example: This example retrieves the coordinates of the pick point in the array myArray: Dim oSelElem As SelectedElement Set oSelElem = CATIA.ActiveDocument.Selection.Item(1) ReDim myArray(2) oSelElem.GetCoordinates myArray选择方法Selection (Object)IUnknown | +-IDispatch | +-CATBaseUnknown | +-CATBaseDispatch | +-AnyObject | +-Selection file:/F:catiav5r16doc_enEnglishonlineCAAScdBaseCAAScdAutomationHome.htm Represents the selection.The Selection object contains the features the end user selected, usually with the mouse, and which are candidates as subjects for the next action.A feature possess parent objects in the specification tree (hierarchy). For example, the Pad below possess parent objects in the specification tree: +-+ !Product3! +-+ ! +- Product2 (Product2.1) ! ! ! +- Product1 (Product1.1) ! ! ! +- Part1 (Part1.1) ! ! ! +- Part1 ! ! ! +- PartBody ! ! +-+ ! +- Pad.1 ! Selected feature ! ! ! +-+ ! +- Sketch.1 +- Part2 (Part2.1) For a given selected feature, its parent objects which are exposed to automation can be accessed through a recursive call to the AnyObject.Parent property. When a given feature is selected, there are three possibilities: The feature is exposed to automation (a Pad for example, this is the common case): the feature can be accessed by all Selection object methods The feature is not exposed to automation, but at least one of its parent objects is exposed to automation (a DMU Navigator URL for example: the Hyperlink is not exposed to automation, but the root Product, which contains the Hyperlink, is exposed to automation): o no access is given to the feature through the Count2 and Item2 methods of the Selection object o nevertheless, the first parent object of the feature, which is exposed to automation (the root Product in our example) can be accessed through the Item2 and Count2 methods o The Search, Delete, VisProperties, Copy, Cut, Paste and PasteSpecial methods of the Selection object, take into account the feature.For example, if the user: Puts a DMU Navigator URL in the clipboard Runs a script calling the PasteSpecial method then, during the paste, the DMU Navigator URL will be pasted The feature is not exposed to automation, and he has no parent object which is exposed to automation (a ResourcesList object of a .CATProcess for example): o no access is given to the feature through the Count2 and Item2 methods of the Selection object o no access is given neither to any parent object of the feature through the Item2 and Count2 methods o The Search, Delete, VisProperties, Copy, Cut, Paste and PasteSpecial methods of the Selection object take into account the feature.F

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论