def get_parameter(self, i_name: str) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)) | o Func GetParameter(CATBSTR iName) As AnyObject | | Gets a parameter of a shape instance by its name. | | Parameters: | | iName | The name of the parameter of the shape instance | | Returns: | The parameter, if found | Example: | The following example tests if the parameter was | found: | | Set parameter = shapeInstance.GetParameter("Parameter1") | If TypeName(parameter)="Nothing" Then | MsgBox "Parameter not found" | End If :param str i_name: :return: AnyObject :rtype: AnyObject """ return AnyObject(self.shape_instance.GetParameter(i_name))
def get_output_from_position(self, i_position: int) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)) | o Func GetOutputFromPosition(long iPosition) As AnyObject | | Gets a Ouput from its position. | | Parameters: | | iPosition | The position | | Returns: | The output, if found | Example: | The following example tests if the output was found: | | Set output = shapeInstance.GetOuputFromPosition(2) | If TypeName(output)="Nothing" Then | MsgBox "Output not found" | End If :param int i_position: :return: AnyObject :rtype: AnyObject """ return AnyObject(self.shape_instance.GetOutputFromPosition(i_position))
def get_parameter_from_position(self, i_position: int) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)) | o Func GetParameterFromPosition(long iPosition) As AnyObject | | Gets a parameter of a hybrid shape instance from its | position. | | Parameters: | | iPosition | The position | | Returns: | The parameter, if found | Example: | The following example tests if the parameter was | found: | | Set parameter = hybridShapeInstance.GetParameterFromPosition(2) | If TypeName(input)="Nothing" Then | MsgBox "Parameter not found" | End If :param int i_position: :return: AnyObject :rtype: AnyObject """ return AnyObject( self.shape_instance.GetParameterFromPosition(i_position))
def get_output(self, i_name: str) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)) | o Func GetOutput(CATBSTR iName) As AnyObject | | Gets a Ouput by its name. | | Parameters: | | iName | The name of the output of the shape instance | | Returns: | The output, if found | Example: | The following example tests if the output was found: | | Set output = shapeInstance.GetOuput("Output1") | If TypeName(output)="Nothing" Then | MsgBox "Output not found" | End If :param str i_name: :return: AnyObject :rtype: AnyObject """ return AnyObject(self.shape_instance.GetOutput(i_name))
def add_instance(self, i_reference: AnyObject) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)) | o Func AddInstance(AnyObject iReference) As AnyObject | | Creates a new instance of a shape or hybrid shape. | | Parameters: | | iReference | The reference shape or hybrid shape. | | Example: | This example creates the instance NewInstance in the | part. | | Set NewInstance = instanceFactory.AddInstance(reference) :param AnyObject i_reference: :return: AnyObject :rtype: AnyObject """ return AnyObject( self.instance_factory.AddInstance(i_reference.com_object))
def parent(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-10 10:58:07.270911) | o Property Parent() As CATBaseDispatch (Read Only) | | Returns the parent object. The parent object of a given object is the | object that created this object, usually the object just above in the object | tree structure 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 data 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 :return: AnyObject :rtype: AnyObject """ return AnyObject(self.com_object.Parent)
def item(self, i_index: cat_variant) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)) | o Func Item(CATVariant iIndex) As AnyObject | | Retrieves a Feature using its index or its name from the Features | collection. | | Parameters: | | iIndex | The index or the name of the Feature to retrieve from the | collection of Features. As a numerics, this index is the rank of the Feature in | the collection. The index of the first Feature in the collection is 1, and the | index of the last Feature is Count. As a string, it is the name you assigned to | the Feature using the | | AnyObject.Name property or when creating the Feature. | Returns: | The retrieved Feature | Example: | This example retrieves the last Feature in the Features | collection. | | Dim lastFeature As CATIABase | Set lastFeature = Features.Item(Features.Count) :param cat_variant i_index: :return: AnyObject :rtype: AnyObject """ return AnyObject(self.list.Item(i_index))
def instantiate(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)) | o Func Instantiate() As AnyObject | | Instantiates the reference in the current document. | Role: This is the fourth method of the second step of | instantiation. | It is used to duplicate or instantiate the data of the | reference. | | In case of Power Copy instantiation, the data are duplicated and there | is no created instance. | In case of User Feature instantiation, the data are instantiated and an | instance is created and returned. | | Example: | The following example instantiates the reference: | | Set Instance = InstanceFactory.Instantiate :return: AnyObject :rtype: AnyObject """ return AnyObject(self.instance_factory.Instantiate())
def current(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property Current() As CATBaseDispatch (Read Only) | | Returns the current DMUReview. | | Returns: | The current DMUReview (the collection is returned if there is no | current review) | Example: | | This example retrieves the current oDMUReview DMU | Review | from the cDMUReviews collection. | | | Set oDMUReview = cDMUReviews.Current :return: AnyObject :rtype: AnyObject """ return AnyObject(self.dmu_reviews.Current)
def get_parameter(self, i_name: str) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)) | o Func GetParameter(CATBSTR iName) As AnyObject | | Retrieves a parameter of the reference by its name. | Role: This is the third method of the second step of | instantiation. | This step is optional. | It is used to retrieve a parameter of the reference in order to change its | value, using the ValuateFromString method of the Parameter | interface. | It has to be called on each parameter whose value has to be | changed. | | Parameters: | | iName | The name of the parameter. | | Example: | The following example retrieves a parameter on the | reference: | | Set parameter = InstanceFactory.GetParameter("Parameter1") :param str i_name: :return: AnyObject :rtype: AnyObject """ return AnyObject(self.instance_factory.GetParameter(i_name))
def value(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property Value() As CATBaseDispatch (Read Only) | | Returns the actual selected automation object. :return: AnyObject :rtype: AnyObject """ return AnyObject(self.selected_element.Value)
def mirroring_object(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property MirroringObject() As AnyObject (Read Only) | | Returns the mirroring Object. :return: AnyObject :rtype: AnyObject """ return AnyObject(self.mirror.MirroringObject)
def context(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445) | o Property Context() As AnyObject (Read Only) | | Returns the context of the parameter : a part, a product, a drafting, a process, depending where | the parameter is. :return: AnyObject :rtype: AnyObject """ return AnyObject(self.parameter.Context)
def tail_target(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445) | o Property TailTarget() As CATBaseDispatch | | Returns or sets target element of tail side. | | Example: | This example retrieves the target element of tail side on MyArrow | drawing arrow. | | oTarget = MyArrow.TailTarget :return: AnyObject :rtype: AnyObject """ return AnyObject(self.drawing_arrow.TailTarget)
def head_target(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445) | o Property HeadTarget() As CATBaseDispatch | | Returns or sets target element of head side. | | Example: | This example retrieves the target element of head side on MyLeader | drawing leader. | | oTarget = MyLeader.HeadTarget :return: AnyObject :rtype: AnyObject """ return AnyObject(self.drawing_leader.HeadTarget)
def anchor_point(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property AnchorPoint() As AnyObject | | Returns the anchor point of the user pattern. | | Example: | The following example returns in anchor the anchor point of the Pattern | firstPattern: | | Set anchor = firstPattern.AnchorPoint :return: AnyObject :rtype: AnyObject """ return AnyObject(self.user_pattern.AnchorPoint)
def item_to_copy(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property ItemToCopy() As AnyObject | | Returns or sets the shape to be copied. | | Example: | The following example returns in shape the copied shape of the pattern | firstPattern, and then sets it to pad1: | | Set shape = firstPattern.ItemToCopy | firstPattern.ItemToCopy = pad1 :return: AnyObject :rtype: AnyObject """ return AnyObject(self.pattern.ItemToCopy)
def feature_to_locate_positions(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property FeatureToLocatePositions() As AnyObject (Read | Only) | | Returns the collection of feature to locate instances. | | Example: | The following example returns in list the list of feature to locate | instances of the Pattern firstPattern: | | Set list = firstPattern.FeatureToLocatePositions :return: AnyObject :rtype: AnyObject """ return AnyObject(self.user_repartition.FeatureToLocatePositions)
def source_element(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property SourceElement() As AnyObject (Read Only) | | Returns the source element of the imported solid. | Role: returns the linked element in the source part. | | Example: | The following example returns in element the source element of the | imported solid importedSolid: | | Set element = importedSolid.SourceElement :return: AnyObject :rtype: AnyObject """ return AnyObject(self.solid.SourceElement)
def get_modifiable_object(self, i_index: cat_variant) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)) | o Func GetModifiableObject(CATVariant iIndex) As AnyObject | | Gets a modifiable object by index or name in this drawing component | instance. | | Example: | This example Gets the first modifiable object in the MyComponent | drawing component instance. | | Object = MyComponent.GetModifiableObject(1) :param cat_variant i_index: :return: AnyObject :rtype: AnyObject """ return AnyObject(self.drawing_component.GetModifiableObject(i_index))
def plane_zx(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property PlaneZX() As AnyObject (Read Only) | | Returns the ZX plane of the part 3D reference axis system. | | Example: | The following example returns in plnZX the ZX plane of the partRoot | part from the partDoc part document: | | Set partRoot = partDoc.Part | Set plnZX = partRoot.originElements.PlaneZX :return: AnyObject :rtype: AnyObject """ return AnyObject(self.origin_elements.PlaneZX)
def associative_element(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445) | o Property AssociativeElement() As CATBaseDispatch | | Returns or sets the associative object of the drawing | text. | | Example: | This example sets an associative line of the MyText drawing text to top | left position. | | MyText.AssociativeElement = line :return: AnyObject :rtype: AnyObject """ return AnyObject(self.drawing_text.AssociativeElement)
def context(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445) | o Property Context() As AnyObject (Read Only) | | Returns the context of the parameter. | The context of a parameter can be a part, a product, a drafting, or a | process document, depending where the parameter is. | | Returns: | The context | See also: | Part, Product, CATIADrawing, CATIAProcess :return: AnyObject :rtype: AnyObject """ return AnyObject(self.relation.Context)
def get_in_parameter(self, i_index: int) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)) | o Func GetInParameter(long iIndex) As AnyObject | | Returns an input parameter of the relation. | This method can return an object that is not a parameter, that is, you | cannot handle it as a Parameter object. For example, in a relation | like | | Area.1 = area(PartBody/Pad.1/Sketch.1) | | the object PartBody/Pad.1/Sketch.1 is a sketch and not a | parameter. | To use such an object, call the Visual Basic TypeName function to retrieve | its real type. | | Dim objectType | objectType = TypeName(oParameter) | If objectType = "Parameter" Then | ... | | Parameters: | | iIndex | The searched input parameter index in the | relation. | Legal values: 1 ≤ iIndex ≤ | | NbInParameters :param int i_index: :return: AnyObject :rtype: AnyObject """ return AnyObject(self.relation.GetInParameter(i_index))
def search_for_items(self, selection_objects): """ # todo: This search is currently restricted to GSD objects only. Selection objects is a list of items to search for. Example: selection_objects = ['Point', 'Line'] Example query string to search for all lines and points "('Generative Shape Design'.Point + 'Generative Shape Design'.Line),in" :param list selection_objects: :return Selected Automation Object: """ self.logger.warning('This method may be deprecated in future versions.') gsd_items = [ 'Point', 'Line' ] query_string = str() # build query string for counter, item in enumerate(selection_objects): boolean = str() if counter > 0 and not counter == len(selection_objects): boolean = ' + ' if item in gsd_items: query_string = f"{query_string}{boolean}'Generative Shape Design'.{item}" query_string = f"({query_string}),in" selection = self.document.Selection selection.Search(query_string) selected = list() for i in range(0, selection.Count): selected.append(AnyObject(selection.Item(i + 1).Value)) return selected
def item(self, i_index: cat_variant) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)) | o Func Item(CATVariant iIndex) As AnyObject | | Retrieves an optimization using its index or its name from the | Optimizations collection. | | Parameters: | | iIndex | The index or the name of the item (optimization or | constraintSatisfaction) to retrieve from the collection of optimizations. As a | numerics, this index is the rank of the item in the collection. The index of | the first item in the collection is 1, and the index of the last item is Count. | As a string, it is the name you assigned to the item using the | | | AnyObject.Name property or when changing the item name by the property | panel. | Returns: | either the retrieved optimization or the retreived | constraintSatisfaction | Example: | This example retrieves the last item (optimization or | constraintSatisfaction) in the optimizations | collection. | | Set lastItem = optimizations.Item(optimizations.Count) :param cat_variant i_index: :return: AnyObject :rtype: AnyObject """ return AnyObject(self.optimizations.Item(i_index))
def source_product(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384) | o Property SourceProduct() As AnyObject (Read Only) | | Returns the source product instance of the imported solid. | Role: returns the product instance which was selected when the import was | created. | | Example: | The following example returns in prod1 the source product instance of | the imported solid importedSolid: | | Set prod1 = importedSolid.SourceProduct :return: AnyObject :rtype: AnyObject """ return AnyObject(self.solid.SourceProduct)
def next_link(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)) | o Func NextLink() As AnyObject | | Returns the next link of the drawing view. | | Example: | This example retrieves the next link of the MyView drawing | view. | | Dim viewLinks As DrawingViewGenerativeLinks | Set viewLinks = MyView.GenerativeLinks | Dim nextLink As AnyObject | nextLink = viewLinks.NextLink() :return: AnyObject :rtype: AnyObject """ return AnyObject(self.drawing_view_generative_links.NextLink())
def find_object_by_name(self, i_obj_name: str) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)) | o Func FindObjectByName(CATBSTR iObjName) As AnyObject | | Finds an object that is not a collection by its name. Scan in depth among | all the direct and indirect children (expensive, but hard to | escape). | | Parameters: | | iObjName | The name to be searched | | Returns: | The object, if found | Example: | The following example tests if the object was found: | | Set partRoot = partDoc.Part | Set obj = partRoot.FindObjectByName("Wrong name") | If TypeName(obj)="Nothing" Then | MsgBox "Object not found" | End If :param str i_obj_name: :return: AnyObject :rtype: AnyObject """ if self.part.FindObjectByName(i_obj_name): return AnyObject(self.part.FindObjectByName(i_obj_name)) else: raise CATIAApplicationException('Could not find object.')
def sheet_metal_parameters(self) -> AnyObject: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445) | o Property SheetMetalParameters() As AnyObject (Read Only) | | Returns the sheet metal parameters of the part. | | Example: | The following example returns in sheetMetalParm the sheet metal | parameters of the partRoot part from the partDoc part | document: | | Set partRoot = partDoc.Part | Dim sheetMetalParm As SheetMetalParameters | Set sheetMetalFact = partRoot.SheetMetalParameters :return: AnyObject :rtype: AnyObject """ return AnyObject(self.part.SheetMetalParameters)