# Joint

Model ElementJoint is used to create an idealized connector between two bodies.

Joint

## Description

Joint defines a set of lower pair constraints. Physically, the joint consists of two mating surfaces that allow relative translational and/or rotational movement in certain specific directions only. The surfaces are abstracted away, and the relationships are always expressed as a set of algebraic constraint equations between points and directions on two bodies.

## Attribute Summary

Name Property Modifiable by command? Designable?
id Int ()
label Str () Yes
i Reference (Marker) Yes Yes
j Reference (Marker) Yes Yes
type Enum (Type, default= "SPHERICAL", required=True)
pd Double () Yes FD Only
pitch Double () Yes FD Only
ic Double (None, count=2)   FD Only
ictran Double (None, count=2)   FD Only
icrot Double (None, count=2)   FD Only
active Bool () Yes
virtual Bool () Yes

* Type=("CONVEL","CYLINDRICAL","FIXED",HOOKE",PLANAR","RACKPIN",REVOLUTE","SCREW","SPHERICAL", "TRANSLATIONAL","UNIVERSAL")

## Usage

Joint (i=objmarker, j=objmarker, type=string_joint_type, optional_attributes)

## Attributes

i
Reference to an existing marker.
It specifies a marker that defines the connection on the first body. The body may be a rigid body, a flexible body, or a point mass body.
Required.
j
Reference to an existing marker.
It specifies a marker that defines the connection on the second body. The body may be a rigid body, a flexible body, or a point body.
Required.
type
String that is one of ("CONVEL", "CYLINDRICAL", "FIXED", "HOOKE", "PLANAR", "RACKPIN", "REVOLUTE", "SCREW", "SPHERICAL", "TRANSLATIONAL", "UNIVERSAL")
Specifies the type of constraint connection between the i and the j markers.
Required.
id
Integer
Specifies the element identification number. This number must be unique among all the Joint objects in the model.
Optional. MotionSolve will automatically create an ID when one is not specified.
Range of values: id > 0
label
String
Specifies the name of the Joint object.
Optional. MotionSolve will create a label for you.
pitch
Double
Defines the pitch for a screw joint. The pitch defines the ratio between the translational and rotational motion in the screw joint.
Mandatory when type="SCREW". It must not be specified otherwise.
Valid range of values: pitch > 0
pd
Double
Defines the pitch diameter for the pinion gear of a rack and pinion gear joint.
Mandatory when type="RACKPIN". It must not be specified otherwise.
Valid range of values: pd > 0
ic
List of two doubles
Specifies the initial velocity and initial displacement on either a translational or revolute joint.
This attribute may be optionally specified only when type="REVOLUTE" or type="TRANSLATIONAL".
ic expects two numeric values.
ictran
List of two doubles
Specifies the initial translational velocity and initial translational displacement of the cylindrical joint.
This attribute may be optionally specified only when type="CYLINDRICAL".
ictran expects two numeric values.
icrot
List of two doubles
Specifies the initial rotational velocity and initial rotational displacement of the cylindrical joint.
This attribute may be optionally specified only when type="CYLINDRICAL"
icrot expects two numeric values.
active
Boolean
Select one from "TRUE" or "FALSE".
• "TRUE" indicates that the element is active in the model and it affects the behavior of the system
• "FALSE" indicates that the element is inactive in the model and it does not affect the behavior of the system. It is almost like the entity was removed from the model, of course with the exception that can be turned "ON" when desirable.
Optional. When not specified, active defaults to "TRUE".
virtual
Boolean
Defines whether the constraint is virtual or regular. Select "TRUE" or "FALSE".
• TRUE” indicates that the constraint is implemented as a virtual constraint.
• FALSE” indicates that the constraint is implemented as a regular algebraic constraint.

Optional. When not specified, virtual defaults to “FALSE”. For a more detailed explanation about virtual, see Constraint: Joint.

## Example 1

Create a cylindrical joint between bodies p3 and p4.

Location specified by an existing point, pc

Z-axis along global x-axis
zpval = pc + Vector(1,0,0)
p3.C  = Marker (body=p3, qp=pc, zp=zpval, label="p3.C")
p4.C  = Marker (body=p4, qp=pc, zp=zpval, label="p4.C")
jcyl  = Joint  (i=p4.C, j=p3.C, type="CYLINDRICAL", label="Joint #1")

## Example 2

Add an initial translational velocity and displacement to an existing cylindrical joint jcyl.
jcyl.ictran = (3.142, 2.71828)

## Example 3

Create your own simple function to create a cylindrical joint and use it.
#Define the function first
def CylindricalJoint (ibody, jbody, location, axis, label, **kwds):
"""
ibody    - A rigid body, point mass or flex-body
jbody    - A rigid body, point mass or flex-body
location - A Point
axis     - A Vector
label    - A name for the joint
"""

#Coordinates of a point along the axis of rotation
zpval = location + axis

i = Marker (body=ibody, qp=location, zp=zpval)
j = Marker (body=jbody, qp=location, zp=zpval)

jcyl = Joint (type="REVOLUTE", i=i, j=j, label=label, **kwds)

i.label = label + " I Marker"
j.label = label + " J Marker"

return jcyl

#Create a cylindrical joint using the convenience function described above
pc    = Point (23.1, -46.2, 69.3*math.sin(0.436332))
zaxis = Vector(1,0,0)
label = "Joint #1"
jcyl  = CylindricalJoint (p3, p4, pc, zaxis, label, ictran=(3.142, 2.71828))

## Example 4

Create a joint and then define a displacement Request between its I and J markers.
#Define the joint
pc    = Point (23.1, -46.2, 69.3*math.sin(0.436332))
zaxis = Vector(1,0,0)
label ="Joint #1"
jcyl  = CylindricalJoint (p3, p4, pc, zaxis, label, ictran=(3.142, 2.71828))

#Now define the request
comment = jcyl.label + " Displacement"
r1    = Request  (type="DISPLACEMENT", i=jcyl.i, j=jcyl.j, comment=comment)

## Example 5

Using the "dot" operator to "get" the attributes of a joint.

Assume that a joint object has been created using the first example.
jcyl  = Joint  (i=p4.C, j=p3.C, type="CYLINDRICAL", label="Joint #1")
The dot operator may be used as shown below to get the attributes for a joint:
iMarker = jcyl.i         # The I marker for the joint jcyl
jtype   = jcyl.type      # The type of the joint jcyl
iBody   = iMarker.body   # The body to which iMarker belongs
iMass   = iBody.mass     # The mass of the body to which the iMarker belongs