MdlLikeMethods#

This module contains functions that can be helpful during the construction of simple models.

Orientation(angles=None, degrees=False, rm=None, axis_type=None, axis=None, origin=Point(0.0, 0.0, 0.0), plane_type=None, plane=None, mirror=False)#

Returns the orientation for all supported MDL methods.

This includes:

  1. One Axis - ‘axis_type’ points to ‘axis’, where:

  • axis_type can be “X”, “Y” or “Z”,

  • axis can be Point, Vector or list [DxDyDz] or (Dx,Dy,Dz).

  1. Two Axes - ‘axis_type’ points to ‘axis’, ‘plane_type’ lies in ‘plane’, where:

  • plane_type can be “XY”, “XZ”, “YX”, “YZ”, “ZX”, “ZY”,

  • plane can be Point, Vector or list [DxDyDz] or (Dx,Dy,Dz).

  1. Angles

  • angles are the euler angles with respect to the rm marker in Deg or Rad.

Parameters:
  • angles – Euler angles that define the orientation.

  • degrees (bool) – Specify whether Euler angles are specified in radian or degree.

  • rm (Marker) – Reference marker upon which the orientation is defined.

  • axis_type (Enum) – Specify which axis is defined by the argument axis.

  • axis – Define the direction of the axis. Choose from “X”, “Y”, “Z”.

  • origin (Point) – Define the origin. It is only used when axis or plane is defined by Point.

  • plane_type (Enum) – Specify the second axis defined by the argument plane. Choose from “XY”, “XZ”, “YX”, “YZ”, “ZX”, “ZY”.

  • plane – Define the direction of the second axis.

  • mirror

Returns:

Two Points specifying the z-axis and x-axis of the Orientation.

createBeam(id, i, j, label='', type='arbitrary', length=1, E=1, G=1, CRatio=1, AS2=1, AS3=1, OD=1, ID=1, AS=1, P2_DIM=1, P3_DIM=1, Area=1, I11=1, I22=1, I33=1, Fx=0, Fy=0, Fz=0, Tx=0, Ty=0, Tz=0)#

Create a Beam between markers i and j. The Beam object maintains its designability.

Parameters:
  • id (bool) – ID of Beam

  • i (Marker) – Marker i of Beam.

  • j (Marker) – Marker j of Beam.

  • label (str) – Label of Beam.

  • type (Enum) – Type of Beam. Choose from “arbitrary”, “rectangular”, “circular”.

  • length (Double) – Length of Beam.

  • E (Double) – Young’s modulus.

  • G (Double) – Shear modulus.

  • CRatio (Double) – Damping ratio of Beam.

  • AS2 (Double) – Shear area ratio in the y direction.

  • AS3 (Double) – Shear area ratio in the z direction.

  • OD (Double) – Outer diameter of circular beam.

  • ID (Double) – Inner diameter of circular beam.

  • AS (Double) – Shear area ratio of circular beam.

  • P2_DIM (Double) – Y dimension of rectangular beam.

  • P3_DIM (Double) – Z dimension of rectangular beam.

  • Area (Double) – Cross sectional area of arbitrary beam.

  • I11 (Double) – Torsional stiffness shape factor for the cross-section of arbitrary beam.

  • I22 (Double) – The second moment of inertia about the y axis of arbitrary beam.

  • I33 (Double) – The second moment of inertia about the z axis of arbitrary beam.

  • Fx (Double) – Translational preload force along x,y,z axes.

  • Fy (Double) – Translational preload force along x,y,z axes.

  • Fz (Double) – Translational preload force along x,y,z axes.

  • Tx (Double) – Rotational preload torque along x,y,z axes.

  • Ty (Double) – Rotational preload torque along x,y,z axes.

  • Tz (Double) – Rotational preload torque along x,y,z axes.

Returns:

A Beam entity.

createCurveFor2DContact(paramCurveI, paramCurveJ, designableIndexI=[], boundsI=[], designableIndexJ=[], boundsJ=[])#

Create 2 curves that can be used to define a 2D Contact. The user can specify which points need to be made designable in the new curves created.

Parameters:
  • paramCurveI (Curve) – The first parametric curve upon which 2D contact is defined.

  • paramCurveJ (Curve) – The second parametric curve upon which 2D contact is defined.

  • designableIndexI – Specify the points in Curve I that should be made designable.

  • designableIndexJ – Specify the points in Curve J that should be made designable.

  • boundsI – Specify the upper and lower bounds of designable points in Curve I.

  • boundsJ – Specify the upper and lower bounds of designable points in Curve J.

Returns:

Two Curve entities that are equivalent to paramCurveI, paramCurveJ, and can be used for 2D Contact.

createNewCurve(paramCurve, normal, designableIndex, bounds)#

Create a new Curve that can be used for 2D Contact.

Parameters:
  • paramCurve (Curve) – The original Curve entity.

  • normal (Vector) – The normal vector determined by the same strategy as MV.

  • designableIndex – Specify the points in Curve that should be made designable.

  • bounds – Specify the upper and lower bounds of the designable points.

Returns:

The new Curve entity created.

createRevoluteJoint(ibody, jbody, location=None, axis=(0, 0, 1), **kwds)#

Convenience function to create a REVOLUTE joint.

Parameters:
  • ibody (Body) – The i body of the joint.

  • jbody (Body) – The j body of the joint.

  • location (Point) – The location of the revolute joint. It defaults to (0,0,0).

  • axis (Point) or (Vector) – The axis about which the joint will revolve. It defaults to (0,0,1).

Returns:

A revolute Joint.

createSphericalJoint(ibody, jbody, location=None, **kwds)#

Convenience function to create a SPHERICAL joint.

Parameters:
  • ibody (Body) – The i body of the joint.

  • jbody (Body) – The j body of the joint.

  • location (Point) – The location of the spherical joint. It defaults to (0,0,0).

Returns:

A spherical Joint.

createSteelBar(ipoint, jpoint, radius=None, density=7.8e-06, **kwds)#

Create a Cylindrical bar Part. The user can specify the radius and density of the bar, which will be used to compute the mass and inertial properties.

Parameters:
  • ipoint (Point) – The starting point of the bar.

  • jpoint (Point) – The end point of the bar.

  • radius (Double) – The radius of the bar.

  • density (Double) – The density of the bar.

  • kwds – Other properties that define the graphic entities, for example, color.

Returns:

The rigid Part and its Cylinder graphic.

createUJoint(ibody, jbody, location, ishaft, jshaft, **kwds)#

Convenience function to create UNIVERSAL joint by specifying:

Parameters:
  • ibody (Body) – The i body of the joint.

  • jbody (Body) – The j body of the joint.

  • location (Point) – The location of the spherical joint. It defaults to (0,0,0).

  • ishaft (Point) or (Vector) – The direction of ishaft if a Vector is given, otherwise it defines the end point.

  • jshaft (Point) or (Vector) – The direction of jshaft if a Vector is given, otherwise it defines the end point.

Returns:

A universal Joint.

generateExpression(request, component=1)#

Generate the solver expression for request object when its type is in:

  • DISPLACEMENT

  • VELOCITY

  • ACCELERATION

  • FORCE

Parameters:
  • request (Request) – A Request object. All properties of that request must be specified and they cannot be changed afterwards.

  • component (Int) – An integer between 1 and 8 and corresponds to the f1-f8 in mrf file.

Returns:

A string containing the specified expression.

getCurveNormal(paramCurve)#

Computes the normal vector of a planar curve. The calculation is done in the local reference frame and then converted to the global coordinate system.

Parameters:

paramCurve (Curve) – The Curve entity.

Returns:

  1. The normal Vector when paramCurve is a planar curve.

  2. Zero vector when paramCurve is a line.

  3. Raise an exception when the curve is not planar.

getCurveTangential(paramCurve)#

Get the tangential vector of a Curve entity.

Parameters:

paramCurve – (Curve) Curve object which represents a straight line.

Returns:

The normalized tangential Vector of paramCurve.

get_dc(marker)#

Returns three vectors parallel to the x, y, z axes of a Marker in the global reference frame.

get_xaxis(marker)#

Returns a vector parallel to the x-axis of a Marker in the global reference frame.

get_yaxis(marker)#

Returns a vector parallel to the y-axis of a Marker in the global reference frame.

get_zaxis(marker)#

Returns a vector parallel to the z-axis of a Marker in the global reference frame.

loc_along_dir(origin, vector, distance)#

Returns a set of three coordinate values in the Global Frame, to locate a point along the direction of a vector at a certain distance from an origin point.

Parameters:
  • origin (Point) – The start point for calculating the distance.

  • vector (Vector) – Specify the direction of the line that connects the new point and the origin.

  • distance (Double) – The distance between origin and the new point.

Returns:

A Point located in the specified distance, direction.

loc_between(first_point, end_point, dist_ratio)#

Returns a set of three coordinate values in the Global Frame, to locate a point between two points at a certain distance ratio.

Parameters:
  • first_point (Point) – Point that defines the start of the line.

  • end_point (Point) – Point that defines the end of the line.

  • dist_ratio (Double) – Distance ratio used to compute the new point.

Returns:

A Point located at the specified location.

loc_cylindrical(coord, rm, degrees=True)#

Returns a set of three coordinate values in the Global Frame, to locate a given set of cylindrical coordinate values in a given reference frame.

Parameters:
  • coord (Point) – A point in Cartesian coordinates to be expressed in cylindrical coordinates with respect to the rm marker.

  • rm (Marker) – The relative reference frame used in the transformation of the point coordinates.

Returns:

A set of cylindrical values.

loc_mirror(master_point, ref_marker, plane)#

Returns a set of three coordinate values in the Global Frame, to locate a point symmetric with respect to a reference marker about its specified plane.

Parameters:
  • master_point (Point) – Point to be reflected.

  • ref_marker (Marker) – Marker that defines the reference frame.

  • plane (Enum) – Define the plane to which master_point is reflected. Choose from “XY”,”YX”,”XZ”,”ZX”,”YZ”,”ZY”.

Returns:

The Point that satisfies the requirement.

loc_rel_to(point, marker)#

Returns a set of three coordinate values in the Global Frame, to locate a given set of coordinate values, or a point or marker in a given reference frame.

Parameters:
  • point (Point) – The point to be expressed relative to the Marker argument.

  • marker (Marker) – The relative reference frame used in the transformation of the point coordinates.

Returns:

A Point located at the specified location.