Coupler

Coupler

Class Coupler()

Coupler(parent='MODEL', name='Coupler_n', label='Coupler_n', active=True, 
itype='2JOINT', j1=None, j2=None, j3=None, dir1='TRANS', dir2='TRANS', dir3='TRANS', 
ratio=1, ratio2=0)

A coupler defines the ratio of displacement of one joint to another joint. Couplers can connect three types of joint combinations: - Revolute to revolute - Revolute to translational - Translational to translational.

Keyword Arguments

Argument Data Type Desription Default
name String The variable name. Coupler_n, for next available integer n.
label String The descriptive label. Coupler_n, for next available integer n.
parent Object The parent. MODEL
active Boolean Used to activate or deactivate this entity. True
itype Enum The type. One of 2JOINT or 3JOINT. 2JOINT
j1 Joint The first joint. None
j2 Joint The second joint. None
j3 Joint The third joint(only when itype is 3JOINT). None
dir1 Enum The direction, if first joint is cylindrical. One of TRANS or ROT. TRANS
dir2 Enum The direction, if second joint is cylindrical. One of TRANS or ROT. TRANS
dir3 Enum The direction, if third joint is cylindrical. One of TRANS or ROT. TRANS
ratio Double The displacement ratio between j1 and j2 for each joints respective direction of displacement. 1
ratio2 Double The displacement ratio between j1 and j3 for each joints respective direction of displacement. 0
user Bool Use user defined properties, if true. False
usr_sub Function The expression passed to the user dll. When using solver expressions, Templex syntax (within ``) is used and all variables are enclosed in braces {} and the rest is treated as literal. ‘USER()'
local_funcname String The function/subroutine name. ‘MOTSUB'
use_local_dll Bool Uses a local function instead of default if True. False
local_dll File The path of the local dll. Defaults to ‘'. * local_func_type (Enum) - The type of the user subroutine. one of DLL, PYTHON or MATLAB. ‘DLL'

Notes

1. The parent parameter can only be initialized by the constructor and should not be modified directly.

2. Only parent can be used as a positional argument in the constructor.

Methods

getAssociatedGraphics()

Get all the graphics that are associated with this object.

Returns:

List of all graphic associated with this coupler.

Return type:

(list)

setValue(name, value)

Sets value of an attribute.

Parameters:

       
name str Name of the attribute.  
value ** Value of the attribute to be set.  

Returns:

Returns True if the value was successfully set else False.

Return type:

Bool

Coupler Pair

Class CouplerPair()

CouplerPair(parent='MODEL', name='CouplerPair_n', label='CouplerPair_n', active=True, sym='NONE')

Coupler pair containing left and right instances of singles.

Keyword Arguments:

Argument Data Type Description Default
name String The variable name. CouplerPair_n, for next available integer n.
label String The descriptive label. CouplerPair_n, for next available integer n.
parent Object The parent. MODEL
active Bool Defines if entity is activated when True or deactivated when False. False
sym Enum The symmetry of pair entity. Takes values 'LEFT' for left entity as master, 'RIGHT' for right entity as master or 'NONE' when it is not symmetric. NONE

Instances

Instance Type Description
l Coupler The left coupler.
r Coupler The right coupler.

Examples

========
Create and modify attributes of a Coupler.
>>> from hw import mview
>>> #Create a pinion center-point, body, graphic and joint
>>> p_1 = mview.Point(label = "Base point",x = 0,y = 0,z = 0)
>>> body1 = mview.Body(label = "pinion body",inertia_props_from_graphic = True)
>>> pinion = mview.Cylinder(label = "Gear graphic",
 align_meth1 = "VECTOR",
 align_vec1 = "V_Global_Y",
 length = 10.0,
 r1 = 20.0)
>>> pinion.setValues(body = body1,origin = p_1)
>>> j1 = mview.Joint(label = "Revolute1",
 type = "RevJoint",
 origin = p_1,
 align_meth1 = "VECTOR",
 align_vec1 = "V_Global_Y",
 b1 = body1,
 b2 = "B_Ground")
>>> #Create a gear center-point, body, graphic and joint
>>> p_2 = mview.Point(label = "Base point 2",x = 70,y = 0,z = 0)
>>> body2 = mview.Body(label = "Gear body",inertia_props_from_graphic = True)
>>> gear = mview.Cylinder(label = "Gear graphic",
 align_meth1 = "VECTOR",
 align_vec1 = "V_Global_Y",
 length = 10.0,
 r1 = 50.0)
>>> gear.setValues(body = body2,origin = p_2)
>>> j2 = mview.Joint(label = "Revolute2",
 type = "RevJoint",
 origin = p_2,
 align_meth1 = "VECTOR",
 align_vec1 = "V_Global_Y",
 b1 = body2,
 b2 = "B_Ground")
>>> #Create a Coupler to couple the two Revolute joints
>>> c_0 = mview.Coupler(label = "Gear Coupler",
 itype = "2JOINT",
 ratio = 2.0)
>>> #Set multiple values and references at once
>>> c_0.setValues(j1 = j1,j2 = j2)
>>> #Gear pair model is ready to simulate