pycatia.in_interfaces.selected_element¶
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
Warning
The notes denoted “CAA V5 Visual Basic Help” are to be used as reference only. They are there as a guide as to how the visual basic / catscript functions work and thus help debugging in pycatia.
- class pycatia.in_interfaces.selected_element.SelectedElement(com_object)¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
System.IUnknownSystem.IDispatchSystem.CATBaseUnknownSystem.CATBaseDispatchSystem.AnyObjectSelectedElementRepresents an element contained by a Selection object.This object is an object contained by a Selection object. The Selection objectcontains SelectedElement objects, which are accessed through theSelection.Count2 and Selection.Item2 methods.- property document: Document¶
Note
- CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)
- o Property Document() As Document (Read Only)Returns the document to which the selected element belongs.
- Return type:
- get_coordinates() tuple ¶
Note
- CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384))
- o Sub GetCoordinates(CATSafeArrayVariant ioPoint)Returns the coordinates of the pick point.Parameters:oPointThe coordinates of the pick point, i.e. the hit between thegeometric object and the cursor.The length of this parameter will be 3, except if the document is aDrawingDocumentExample:This example retrieves the coordinates of the pick point inthearray myArray:Dim oSelElem As SelectedElementSet oSelElem = CATIA.ActiveDocument.Selection.Item(1)ReDim myArray(2)oSelElem.GetCoordinates myArray
- Parameters:
io_point (tuple) –
- Return type:
None
- property leaf_product: AnyObject¶
Note
- CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)
- o Property LeafProduct() As AnyObject (Read Only)Returns the leaf product corresponding to the selection in thespecification tree.Role: Returns the leaf Product (component, corresponding for example to“Product1.1” in the specification tree). The AnyObject returned is a Product ifa product appears in the specification tree, in the path corresponding to thecurrent selection, and a fake AnyObject whose AnyObject.Name property equals to“InvalidLeafProduct” otherwise.Cumulated with the use of the AnyObject.Parent property (which enables tonavigate into the object structure), the current property enables the scripterto obtain the path, in the specification tree, corresponding to theselection.Example:The following example supposes aPart or a Product is opened. It asks the end user to select a Shape in thecurrent window. It then sends message boxes containing the names of theautomation objects contained in the specification tree path corresponding tothe shape selected, and, regarding the automation objects which are products(only products which are components), a message box containing the abcissa ofthe translation of the product compared to its referenceproduct.Dim Status,Feature,LeafProduct,LeafProductProcessed,InputObjectType(0)Dim Document,Selection,AutomationTreeNodeOrProduct,Position,AxisComponentsArray(11)Set Document = CATIA.ActiveDocument : Set Selection = Document.Selection‘We propose to the user that he select a featureInputObjectType(0)=”AnyObject”Status=Selection.SelectElement2(InputObjectType,”Select afeature”,true)if (Status = “Cancel”) then Exit SubSet Feature = Selection.Item(1).ValueSet LeafProduct = Selection.Item(1).LeafProductLeafProductProcessed = trueif (LeafProduct.Name<>”InvalidLeafProduct”) then LeafProductProcessed = falseSet AutomationTreeNodeOrProduct = Featuredo while(TypeName(AutomationTreeNodeOrProduct)<>”Application”)‘ We send a message box, if AutomationTreeNodeOrProduct is not nor aShapes object neither a PartDocument objectif ((TypeName(AutomationTreeNodeOrProduct)<>”Shapes”) And_(TypeName(AutomationTreeNodeOrProduct)<>”Bodies”) And_(TypeName(AutomationTreeNodeOrProduct)<>”PartDocument”) And_(TypeName(AutomationTreeNodeOrProduct)<>”Products”) And_(TypeName(AutomationTreeNodeOrProduct)<>”ProductDocument”))thenmsgbox AutomationTreeNodeOrProduct.Nameif (TypeName(AutomationTreeNodeOrProduct)=”Product”)then‘ We display a message box containing the abcissa of thetranslation, except in the case of the‘ root productif(TypeName(AutomationTreeNodeOrProduct.Parent.Parent)<>”Application”)thenSet Position = AutomationTreeNodeOrProduct.PositionCall Position.GetComponents(AxisComponentsArray)msgbox AxisComponentsArray(9)end ifend ifend if‘ We determine the next automation tree node or productSet AutomationTreeNodeOrProduct = AutomationTreeNodeOrProduct.Parentif ((TypeName(AutomationTreeNodeOrProduct)=”Application”) And (NotLeafProductProcessed)) then‘ The specification tree path corresponding to the selection containsat least one product, which the current‘ loop as not yet processed. It means that the parent in thespecification tree of the feature corresponding‘ to the last message box sent is LeafProductSet AutomationTreeNodeOrProduct = LeafProductLeafProductProcessed = trueend ifloopIf you run the preceeding piece of script, the current document beeing aproduct 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.1PartBodyPart1Part1.1Product1.120Product2.110Product3
- Return type:
- property reference: Reference¶
Note
- CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)
- o Property Reference() As Reference (Read Only)Returns a Reference version of the Value property.Role: Returns a Reference version of Value .
- Return type:
- property type: str¶
Note
- CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)
- o Property Type() As CATBSTR (Read Only)Returns the string constant which describes the selected element Automationtype.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 theinheritance 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 effectiveselection (more precisely the first filter string constant delivered throughthe iFilterType parameter, for which the current automation object fullfillsthe string constant). This string constant may be an automation object namecorresponding to the iFilterType parameter with which Selection.SelectElement2has previously been called, or even a CATSelectionFilter valuename.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 aHoleReDim InputObjectType(1) : InputObjectType(0)=”Prism” : InputObjectType(1)=”Hole”Status=Selection.SelectElement2(InputObjectType,”Select a prism or ahole”,true)if (Status = “Cancel”) then Exit SubAutomationType = Selection.Item(1).TypeIf the user selects a Pad, the script AutomationType variable willcontain “Prism”and not “Pad”.Consequently, in most cases, use the VBScript TypeName function insteadof this property.
- Return type:
str