Пример #1
0
    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))
Пример #2
0
    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))
Пример #3
0
    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))
Пример #4
0
    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))
Пример #5
0
    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))
Пример #6
0
    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)
Пример #7
0
    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))
Пример #8
0
    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())
Пример #9
0
    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)
Пример #10
0
    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))
Пример #11
0
    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)
Пример #12
0
    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)
Пример #13
0
    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)
Пример #14
0
    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)
Пример #15
0
    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)
Пример #16
0
    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)
Пример #17
0
    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)
Пример #18
0
    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)
Пример #19
0
    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)
Пример #20
0
    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))
Пример #21
0
    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)
Пример #22
0
    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)
Пример #23
0
    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)
Пример #24
0
    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))
Пример #25
0
    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
Пример #26
0
    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))
Пример #27
0
    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())
Пример #29
0
    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.')
Пример #30
0
    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)