Geometry String Functions Geometry String Functions

The string function for points is one of the most useful, and its form is:


     &POINT(ACTION, DATA,  -OPTION)

Here, ACTION must be either COORDINATES, D_NODE, PART, EULER_ANGLES, N_2NODES, N_BOX, RATIO, DEFLECTION, HOOK_LOC, OFFSET, CLOSE, NEAREST, or REL_MOTION. The details of DATA vary with ACTION, but normally DATA will be one or more point names. If ACTION is COORDINATES, this function returns the location of the point specified with DATA. Here, the location returned will be in the part system, unless one of the options -BODY or -GLOBAL has been specified. If the point has not been defined, a null string will be returned. One can use this function during an INMODEL, to define locations which may be required, provided that the point referenced has been previously defined. If ACTION is D_NODE, the function will return the distance between the two points specified via DATA. If ACTION is PART, the part name of the point specified with DATA is returned.

When changing frames of reference, the ACTION EULER_ANGLES may be useful. This action returns a set of Euler angles from three points specified via DATA. These angles will establish the new x axis along the line from first point to second, a new Z axis perpendicular to the plane formed by the three points, and a new Y axis given by the right-hand rule. The Z axis is defined by the cross product of the X axis and the vector from the first to the third point.

The ACTION N_2NODES returns all points along the line segment between the first point specified via DATA and the second one. These points will be in order with the first point specified being the first point returned and the second one specified as the last one returned.

The remaining values ACTION are different than those above in that the DATA are not strictly point names. The ACTION N_BOX is different from the others in that the data here is a set of global coordinates: X1, X2, Y1, Y2, Z1, and Z2. The function will return all points which are in the "box" defined by the six planes defined by these coordinates. The ACTION RATIO will return the last value of joint unity ratio computed for the specified point, and an ACTION of DEFLECTION will return the three components of the last computed deflection of the point.

The ACTION HOOK_LOC has a form for DATA of: *NN1, LEN1, *NN2, LEN2, ....., *NN4, LEN4, and is used to find the global position of a hook which is connected to points *NN1, *NN2, etc. It assumes that the harness lengths are LEN1, LEN2, ... respectively. This function is useful primarily in setting up a lifting problem when one models the sling as a collection of flexible connectors.

The values of ACTION OFFSET and CLOSE are used to find offsets. Normally, they are used in the definition of connectors. The form of DATA for OFFSET is: *POINT, :SEL, X, Y, Z and for CLOSE PART_NAME, :SEL, X, Y, Z. Here, X, Y, and Z are locations (feet or meters). For both values of ACTION, MOSES finds the point closest to a specified location but they differ in detail. For an ACTION of OFFSET, the specified point is the location of *POINT plus the X, Y, and Z specified, and any point which matches :SEL in a part different than that of *POINT is a candidate. The string returned is -GO1, the x, y and z values of the offset from specified point to the "close" point, and the string *POINT itself. For CLOSE, the specified point is simply the location in the part PART_NAME defined by X, Y, and Z, and all points which match :SEL are considered for being "close". In either case, the vector returned is represented in the part system of the "close" point. As an example, consider:

     CONNECTOR ~CC &POINT(OFFSET *1 @ 0 0 10)

This will define a connector of class ~CC. End 1 of the connector is at a physical location of *1 plus 0 0 10 in the part system of *1 and end two is at *1. This connection is actually defined via the closest point and an offset and the command set to MOSES will look like

     CONNECTOR ~CC -GO1  XX YY ZZ *B22 *1

where XX, YY, ZZ, and *B22 will be values computed so that the end of the connector is at the correct location.

The ACTION of NEAREST takes a point name and a selector and returns the point which matches the selector closest to the given point. In particular:

     &POINT(NEAREST *R *R@)

will return the name of the point which begins with *R (and which is not *R itself) that is closest the point *R.

Another useful ACTION is REL_MOTION. Here, data is two point names *P1, *P2, and six numbers: X-, X+, Y-, Y+, Z-, and Z+. What the function returns is the minimum and maxima of the relative location between the two points and the values input, i.e. the output is part of the input which has been modified. This is best seen by example. Suppose that one issues:

     &SET ENVEL =
     &SET ENVEL = &POINT(REL_MOT *1 *2 %ENVEL )

You will find that at this point X- = X+, Y- = Y+, and Z- = Z+, and X-, Y-, Z- is the vector from *1 to *2 in the *1 body system. If you issue the second of these commands several times, the result will be that ENVEL will contain the extremes of the relative position between the two points. From the above example, if this ACTION is used with null data, the accumulation is initialized. Also, the values returned are in feet or meters.

Often, one wants to transform vectors from body to global coordinates and conversely. This is easily accomplished with the string function:


     &V_TRANSF(ACTION, BODY_NAME, DATA)

Here, ACTION must be either V_B2G, V_G2B, V_P2B, V_B2P, L_B2G, L_G2B, L_P2B, L_B2P, F_B2G, F_G2B, F_P2B, or F_B2P and DATA is either three or six coordinates (feet or meters) or six force components (bforce, bforce-feet or meters). The function takes the input and transforms it, returning the same number of components as DATA input. If ACTION begins with: a V then a simple vector rotation will be performed, with an L a rotation and a translation will be performed, and with an F a force transformation will be performed. The remainder of ACTION defines the direction of the transformation. The action B2G transforms a body representation into a global one, and G2B the inverse. The action P2B transforms a part representation into a body one, and B2P the inverse.