Ejemplo n.º 1
0
    def item(self, index: cat_variant) -> any_parameter:
        """
        .. note::
            :class: toggle

            CAA V5 Visual Basic help
                | Item
                | o Func Item(    CATVariant    iIndex) As Parameter
                |
                | Retrieves a parameter  using its index or its name from the from the
                | Parameters collection.
                | Parameters:
                | iIndex
                |    The index or the name of the parameter to retrieve from
                |    the collection of parameters.
                |    As a numeric, this index is the rank of the parameter
                |    in the collection.
                |    The index of the first parameter in the collection is 1, and
                |    the index of the last parameter is Count.
                |    As a string, it is the name you assigned to the parameter using
                |    the
                |
                |  activateLinkAnchor('AnyObject','Name','AnyObject.Name')  property or when
                |  creating the parameter.
                | Examples:
                | This example retrieves the last parameter in the parameters
                | collection:
                |
                | Set lastParameter = parameters.Item(parameters.Count)


        :param cat_variant index:
        :return: any_parameter
        :rtype: any_parameter
        """

        p: any_parameter

        if not self.is_parameter(index):
            raise CATIAApplicationException(
                f'Could not find parameter name "{index}".')

        if isinstance(self.parameters.Item(index).value, bool):
            p = BoolParam(self.parameters.Item(index))

        elif isinstance(self.parameters.Item(index).value, int):
            p = IntParam(self.parameters.Item(index))

        elif isinstance(self.parameters.Item(index).value, str):
            p = StrParam(self.parameters.Item(index))

        elif isinstance(self.parameters.Item(index).value, float):
            p = RealParam(self.parameters.Item(index))

        else:

            raise CATIAApplicationException(
                f'Could not assign parameter name "{index}".')

        return p
Ejemplo n.º 2
0
    def instances_count(self) -> IntParam:
        """
        .. note::
            :class: toggle

            CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)
                | o Property InstancesCount() As IntParam (Read Only)
                | 
                |     Returns the total number of copied shapes.
                | 
                |     Example:
                |         The following example returns in Nb the number of shapes of the
                |         repartition firstRepartition:
                | 
                |          Set Nb = firstRepartition.InstancesCount

        :return: IntParam
        :rtype: IntParam
        """

        return IntParam(self.repartition.InstancesCount)
Ejemplo n.º 3
0
    def angular_direction_row(self):
        """
        .. note::
            :class: toggle

            CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
                | o Property AngularDirectionRow() As IntParam (Read Only)
                | 
                |     Returns the position of the shape to be copied along the angular
                |     direction.
                | 
                |     Example:
                |         The following example returns in AngularDirPos the position of the
                |         shape to be copied along the angular direction.
                | 
                |          Set AngularDirPos = firstPattern.AngularDirectionRow

        :return: IntParam
        """

        return IntParam(self.close_surface.AngularDirectionRow)
Ejemplo n.º 4
0
    def angular_direction_row(self) -> IntParam:
        """
        .. note::
            :class: toggle

            CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)
                | o Property AngularDirectionRow() As IntParam (Read Only)
                | 
                |     Returns the position of the shape to be copied along the angular
                |     direction.
                | 
                |     Example:
                |         The following example returns in AngularDirPos the position of the
                |         shape to be copied along the angular direction.
                | 
                |          Set AngularDirPos = firstPattern.AngularDirectionRow

        :return: IntParam
        :rtype: IntParam
        """

        return IntParam(self.circ_pattern.AngularDirectionRow)
Ejemplo n.º 5
0
    def first_direction_row(self) -> IntParam:
        """
        .. note::
            :class: toggle

            CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)
                | o Property FirstDirectionRow() As IntParam (Read Only)
                | 
                |     Returns the position of the shape to be copied along the first linear
                |     direction.
                | 
                |     Example:
                |         The following example returns in FirstDirPos the position of the shape
                |         to be copied along the first linear direction in the rectangular pattern
                |         firstPattern:
                | 
                |          Set FirstDirPos = firstPattern.FirstDirectionRow

        :return: IntParam
        :rtype: IntParam
        """

        return IntParam(self.rect_pattern.FirstDirectionRow)
Ejemplo n.º 6
0
    def create_integer(self, i_name: str, i_value: int) -> IntParam:
        """
        .. note::
            :class: toggle

            CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
                | o Func CreateInteger(CATBSTR iName,
                | long iValue) As IntParam
                | 
                |     Creates an integer parameter and adds it to the part's collection of
                |     parameters.
                | 
                |     Parameters:
                | 
                |         iName
                |             The parameter name 
                |         iValue
                |             The parameter value 
                | 
                |     Example:
                |         This example creates the RevisionNumber integer parameter and adds it
                |         to the newly created part:
                | 
                |         Dim CATDocs As Documents
                |          Set CATDocs = CATIA.Documents
                |          Dim part1 As Document
                |          Set part1   = CATDocs.Add("CATPart")
                |          Dim revision As IntParam
                |           Set revision = part1.Part.Parameters.CreateInteger ("RevisionRumber", 17)

        :param str i_name:
        :param int i_value:
        :return: IntParam
        :rtype: IntParam
        """
        return IntParam(self.parameters.CreateInteger(i_name, i_value))