============================ Coupler (hwx.inspire.motion) ============================ Simulates the rotational or translational movements of connected parts. A coupler allows us to specify a mathematical ratio which affects the movement of parts. It is useful for conceptual prototyping and general motion modeling. Inherits: - :ref:`MotionObject (hwx.inspire.motion)` ---------- Attributes ---------- +----------------------------+----------------------------+----------------------------+ | active_: Bool | color_: Color | entities_: Attribute | +----------------------------+----------------------------+----------------------------+ | entity1_: Attribute | entity2_: Attribute | entity3_: Attribute | +----------------------------+----------------------------+----------------------------+ | name_: Attribute | reverse3rdDirection_: Bool | reverseDirection_: Bool | +----------------------------+----------------------------+----------------------------+ | scale1_: EnumUnion (type1) | scale2_: EnumUnion (type2) | scale3_: EnumUnion (type3) | +----------------------------+----------------------------+----------------------------+ | scales_: Attribute | type1_: Enum | type2_: Enum | +----------------------------+----------------------------+----------------------------+ | type3_: Enum | types_: Attribute | visible_: Bool | +----------------------------+----------------------------+----------------------------+ ---------- Properties ---------- +------------+------------+ | entityset_ | location_ | +------------+------------+ -------------- Public Methods -------------- +---------------------------------------------------------------+ | static getAxisJoint_ (obj, axisHint=None, ignore=None) | +---------------------------------------------------------------+ | static getUnambiguousJointType_ (joint) | +---------------------------------------------------------------+ | static inferRatio_ (a, b=None) | +---------------------------------------------------------------+ | static isAmbiguous_ (joint) | +---------------------------------------------------------------+ | classmethod getCandidates_ (cls, part, skip=None, distance=0) | +---------------------------------------------------------------+ | classmethod getExistingCouplerBetweenParts_ (cls, *args) | +---------------------------------------------------------------+ | classmethod showCouplers_ (cls, on=True) | +---------------------------------------------------------------+ | flipEntities_ (self) | +---------------------------------------------------------------+ | getRatioString_ (self) | +---------------------------------------------------------------+ ----------------- Attribute Details ----------------- .. _active: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ active : :ref:`Bool ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns or sets the object activeness. Setting this on or off sets all children. Setting to True sets all the parents active too. .. _color: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ color : :ref:`Color ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Color of the coupler. .. _entities: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entities : :ref:`Attribute ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ List of joint entities coupled. .. _entity1: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity1 : :ref:`Attribute ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The first joint entity used for coupling. .. _entity2: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity2 : :ref:`Attribute ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The second joint entity used for coupling. .. _entity3: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity3 : :ref:`Attribute ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The third joint entity used for coupling. .. _name: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ name : :ref:`Attribute ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Returns or sets the name of the object. It can be any text string, including spaces, although it's best to avoid using the following characters: " ' * ? and $. While these characters are allowed, they could create difficulties when you export the model to other applications. .. _reverse3rdDirection: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reverse3rdDirection : :ref:`Bool ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Reverses the direction for Joint 3 Coupling, if True. .. _reverseDirection: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reverseDirection : :ref:`Bool ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Reverses the direction of Rotation or Translation of the coupler, if True. .. _scale1: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ scale1 : :ref:`EnumUnion (type1) ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Scale for the Joint 1 Coupling. By default the scale is 360 deg for Rotational and 100 mm for Translational coupling. .. _scale2: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ scale2 : :ref:`EnumUnion (type2) ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Scale for the Joint 2 Coupling. By default the scale is 360 deg for Rotational and 100 mm for Translational coupling. .. _scale3: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ scale3 : :ref:`EnumUnion (type3) ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Scale for the Joint 3 Coupling. By default the scale is 360 deg for Rotational and 100 mm for Translational coupling. .. _scales: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ scales : :ref:`Attribute ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Specifies the scale value to determine the coupler ratio. .. _type1: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type1 : :ref:`Enum ` (ROTATION, TRANSLATION) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type of coupling used for the first joint entity. The Type can be Rotational or Translational. .. _type2: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type2 : :ref:`Enum ` (ROTATION, TRANSLATION) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type of coupling used for the second joint entity. The Type can be Rotational or Translational. .. _type3: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type3 : :ref:`Enum ` (ROTATION, TRANSLATION) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type of coupling used for third joint entity. The Type can be Rotational or Translational. .. _types: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types : :ref:`Attribute ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Specifies the type of coupling for each coupled entities. .. _visible: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ visible : :ref:`Bool ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Determines whether the object is visible in the modeling window. Setting this on or off sets all children. Setting to True sets all the parents visible too. ---------------- Property Details ---------------- .. _entityset: .. method:: entityset Returns a frozenset of entities used to create the coupler. .. _location: .. method:: location Returns the mid-location of all the joints used to create a coupler. -------------- Method Details -------------- .. _getAxisJoint: .. staticmethod:: getAxisJoint(obj, axisHint=None, ignore=None) Returns a candidate joint with axis(allows the connecting parts to move). Raises ValueError if no candidate joint can be found. :param obj: obj can be an AnalyticalShape instead of a Part, in which case data from it will be used to pick a better candidate. This will never raise when given an AnalyticalShape if it doesn't on the part that AnalyticalShape is made from; if the data from the AnalyticalShape prove that none of the candidates it would have returned otherwise make sense, it will just return one of them anyway. :type obj: AnalyticalShapeData, Part :param axisHint: Is an approximation of the rotation axis of the part, and it is used to enhance the heuristic results. :type axisHint: Vector(Point) :param ignore: To skip any specific candidate. :type ignore: CouplerCandidates .. _getUnambiguousJointType: .. staticmethod:: getUnambiguousJointType(joint) Return "ROTATION" if the given joint or entity with implicit joints can be coupled rotationally, "TRANSLATION" if it can only be coupled translationally, or None if it cannot be coupled at all. .. _inferRatio: .. staticmethod:: inferRatio(a, b=None) Given two parts, or a free joint with two parts, try to give two integer values that define their relative movement ratio, i.e. giving a rack and a pinion will return a and b where the pinion rotating b degrees moves the rack a meters. If scales can not be inferred, return None. If a free joint is provided, and shape identification fails on the parts, this will attempt to use the surface information in the free joint to infer the ratio. .. _isAmbiguous: .. staticmethod:: isAmbiguous(joint) Return True if the given joint/entity /w implicit joint would be a valid subject for both rotational and translational coupling. .. _getCandidates: .. classmethod:: getCandidates(cls, part, skip=None, distance=0) Scan out from the passed in part through the part-joint connectivity graph and return all coupleable entities. :param part: Part or parts to scan for finding coupleable entities. :type part: list[Part] :param skip: Part or parts to skip from the scan. :type skip: list[Part] :param distance: Distance of the couple entity on the scan. Defaults to 0. :type distance: Double .. _getExistingCouplerBetweenParts: .. classmethod:: getExistingCouplerBetweenParts(cls, *args) Returns the coupler that (probably) couples the given parts, or None. If there are multiple existing couplers, this picks one arbitrarily. :param \*\*parts: List of parts to find the couplers from. .. _showCouplers: .. classmethod:: showCouplers(cls, on=True) Show graphics for the contact while in the context .. _flipEntities: .. method:: flipEntities(self) Reverses the order of entities used to create a coupler. Also revereses the ratio to match. .. _getRatioString: .. method:: getRatioString(self) Return a string of the format {scale1} : {scale2} [: {scale3}]