# 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:

## 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

## 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 : 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¶

Color of the coupler.

### entities : Attribute¶

List of joint entities coupled.

### entity1 : Attribute¶

The first joint entity used for coupling.

### entity2 : Attribute¶

The second joint entity used for coupling.

### entity3 : Attribute¶

The third joint entity used for coupling.

### name : 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 : Bool¶

Reverses the direction for Joint 3 Coupling, if True.

### reverseDirection : Bool¶

Reverses the direction of Rotation or Translation of the coupler, if True.

### scale1 : EnumUnion (type1)¶

Scale for the Joint 1 Coupling.

By default the scale is 360 deg for Rotational and 100 mm for Translational coupling.

### scale2 : EnumUnion (type2)¶

Scale for the Joint 2 Coupling.

By default the scale is 360 deg for Rotational and 100 mm for Translational coupling.

### scale3 : EnumUnion (type3)¶

Scale for the Joint 3 Coupling.

By default the scale is 360 deg for Rotational and 100 mm for Translational coupling.

### scales : Attribute¶

Specifies the scale value to determine the coupler ratio.

### type1 : Enum (ROTATION, TRANSLATION)¶

Type of coupling used for the first joint entity.

The Type can be Rotational or Translational.

### type2 : Enum (ROTATION, TRANSLATION)¶

Type of coupling used for the second joint entity.

The Type can be Rotational or Translational.

### type3 : Enum (ROTATION, TRANSLATION)¶

Type of coupling used for third joint entity.

The Type can be Rotational or Translational.

### types : Attribute¶

Specifies the type of coupling for each coupled entities.

### visible : 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()

Returns a frozenset of entities used to create the coupler.

location()

Returns the mid-location of all the joints used to create a coupler.

## Method Details¶

static 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. AnalyticalShapeData, Part Is an approximation of the rotation axis of the part, and it is used to enhance the heuristic results. Vector(Point) To skip any specific candidate. CouplerCandidates
static 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.

static 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.

static isAmbiguous(joint)

Return True if the given joint/entity /w implicit joint would be a valid subject for both rotational and translational coupling.

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. list[Part] Part or parts to skip from the scan. list[Part] Distance of the couple entity on the scan. Defaults to 0. Double
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.
classmethod showCouplers(cls, on=True)

Show graphics for the contact while in the context

flipEntities(self)

Reverses the order of entities used to create a coupler. Also revereses the ratio to match.

getRatioString(self)

Return a string of the format {scale1} : {scale2} [: {scale3}]