Location, Direction, and Axis Specification

Many commands require that a location or a direction be specified. Although entering the three floating point numbers required to uniquely define a vector is perfectly acceptable, it may be more convenient to specify the direction or location with respect to existing entities in the model.

For example, the following commands might be used for creating straight curves using location and direction specification described here:

Create Curve [From] Location {options} Location {options}

Create Curve [From] Location {options} Direction {options} Length <val>

This section describes the {options} that can be used in these and other commands.

Drawing a Location, Direction, or Axis

Several draw commands are available to illustrate these capabilities:

 Draw Location (options)

 Draw Direction (options) [Location (options)]

 Draw Axis (options)

where (options) are defined below

Specifying a Location

A location is basically an x-y-z position in the model. The following options determine a location specification:

  • [Position] <xval yval zval>
  • Last
  • [At] {Node|Vertex} <id>
  • Extrema {Curve|Surface|Volume|Body|Group} <range> [Direction] {options} [Direction {options}]
  • [On] Curve <range> [location on curve options]
  • [On] Surface <id> [Location {options} | CENTER]
  • Center Curve <id>
  • Between { Location <options> Location <options>} |
    { Location <options> Project {Curve|Surface} <id> }
    [Stop] [Fraction <val>] }
  • [Move [all] {<xval yval zval> | {Dx|X|Dy|Y|Dz|Z} <val> | Direction {options} Distance <val>} ]
  • [Swing [all] [About] Axis {options} Angle <ang>]
  • Multiple Location Specification

    Position (XYZ values)

    [Position] <xval yval zval>

    The most basic way to specify a location is to just give the xyz values of the location. In this case the following two commands both draw a location at the coordinates (1, 2, 3), as the Position keyword is optional:

    draw location position 1 2 3
    draw location 1 2 3

    Last

    Last

    The last option recalls the last location used in a command. For example, if the following command is entered after the above position commands a location would be drawn at the position (1, 2, 3).

    draw location last

    Last locations do not carry over from CUBIT session to CUBIT session. The last location defaults to (0, 0, 0) if no location has been used during the session.

    Node or Vertex

    [At] {Node|Vertex} <range>

    Referring to a node or vertex simply returns the coordinates of that node or vertex. The following draws a location at the coordinates of Vertex 5:

    draw location vertex 5

    On Curve

    Various options are available to specify a location on a curve. See the section Specifying a Location On a Curve for details.

    On Surface

    [On] Surface <range> [Location {options} | CENTER]

    If a surface is used to specify a location without other options, the geometrical center of the surface is found (the center keyword is optional - the default). Otherwise, you can specify another general location and that location is projected to the surface. For example, the following command will draw the location that is position (5,0,0) projected to surface 1:

    draw location on surface 1 location 5 0 0

    Any valid location options can be used to specify the location that is projected to the surface.

    Center

    Center Curve <range>

    Finds the center of an arc - an error is returned if the curve is not an arc.

    Extrema

    Extrema {Curve|Surface|Volume|Body|Group} <range> [Direction] {options} [Direction {options}] [Direction {options}]

    The extrema option returns the location of the maximum value, on the specified entity or group, in the specified direction. For example, the following places a vertex on a surface at the point of maximum y-axis value.

    create vertex location extrema surf 1 direction y

    Between

    Between
    {Location <options> Location <options> } |
    {Location <options>
    Project {Curve|Surface} <range>}
    [Stop] [Fraction <val>]}

    The between option finds a location that is between two locations or a location and an entity. An optional fraction can be given to specify the fractional distance from the first location to the second location or entity. For example, the following will draw a location at (5, 0, 0):

    draw location between location 0 0 0 location 10 0 0

    The following will draw a location at (2.5, 0, 0) - 25% of the distance from (0, 0, 0) to (10, 0, 0):

    draw location between location 0 0 0 location 10 0 0 fraction .25

    The second item can be an entity:

    draw location between location 0 0 0 vertex 2
    draw location between location 0 0 0 surface 1

    In the second case, location (0, 0, 0) is projected to surface 1, then the location that is between (0, 0, 0) and the projected location is found.

    Of course, any valid location can be used in the command. In the following example a location at the top center of the brick is found:

    brick x 10
    draw location between location bet vert 3 vert 2 location bet vert 8 vert 5

    The first location is between vertices 3 and 2, and the second location is between vertices 8 and 5.

    Move

    Move {<xval yval zval> | {Dx|X|Dy|Y|Dz|Z} <val> |
    Direction {options} Distance <val>

    Any location can be optionally moved either a xyz distance or a certain distance in a given direction. As many moves as desired can be strung together. For example, the following will return a location at (5, 0, 0):

    draw location 0 0 0 move 5 0 0

    These examples add another move that basically moves the location (5, 0, 0) in a direction 45 degrees up and to the right a distance of 10 (all three commands are equivalent - see sections on directions and rotations):

    draw location 0 0 0 move 5 0 0 move {10*sind(45)} {10*sind(45)} 0
    draw location 0 0 0 move 5 0 0 move direction 1 1 0 distance 10
    draw location 0 0 0 move 5 0 0 move direction 1 0 0 rotate about 0 0 1 angle 45 dist 10

    Swing

    Swing [About] Axis {options} Angle <ang>

    Any location can be "swung" (rotated) about an axis by a certain angle. (See the section on specifying an axis for the axis syntax). As with moves, multiple swings can be strung together. The following example rotates the location (2.5, 5, 5) thirty degrees about an axis defined by Curve 11. Note that the right-hand rule is used to determine the direction of the swing about the axis.

    draw location 2.5 5 5 swing about axis curve 11 angle 30

    Figure 1 - Swinging a Location

    Multiple Location Specification

    Location {options} Location {options}...

    Multiple location specifications can be used in a single command. For example, the following command uses several locations to create a spline curve at points (0,0,0), (1,2,3), (4,5,6), and (7,8,9).

    create curve spline location 0 0 0 location 1 2 3 location 4 5 6 location 7 8 9

 

Specifying a Location on a Curve or Curves

The following are the options for specifying a location (or locations in the case of the segment option) on a curve:

  • { MIDPOINT | Start | End |
  • Fraction <val 0.0 to 1.0> [From Vertex <id> | Start|End] |
  • Distance <val> [From {Vertex|Curve|Surface} <id> | start | end ] |
  • {{Close_To|At} Location {options} | Position <xval><yval><zval> | {Node|Vertex} <id>} |
  • Extrema [Direction] {options} [Direction {options}] [Direction {options}] |
  • Segment <num_segs> |
  • Crossing {Curve|Surface} <id_list> [Bounded|Near] }

    Start, Midpoint, or End

    { MIDPOINT | Start | End |

    These options simply specify the location that is the midpoint, start or end point of a curve. By default, the midpoint is the understood location unless another location is specified.

    Fraction

    Fraction <val 0.0 to 1.0> [From Vertex <id> | Start|End] |

    The fraction option simply finds the location that is a fractional distance along the curve. By default, the fraction references the start of the curve; however, you can optionally specify which vertex to reference from.

    Distance

    Distance <d> [From {Vertex|Curve|Surface} <id> | start | end ] |

    The distance option not only can find a location that is a certain distance along the curve from the start or end of the curve, but can also find a location (or locations if there is more than one solution) on a curve that is a specified distance from another curve or a surface. If the From Curve option is used both curves must lie in the same plane.

    draw location on curve 13 distance 7 from curve 2

    Figure 2 - Location on a Curve a Distance from Another Curve

    {Close_To|At} Location

    {{Close_To|At} Location {options} | Position <xval><yval><zval> | {Node|Vertex} <id>} |

    These options take a location closest to the location on the curve.

     

    Extrema

    Extrema [Direction] {options} [Direction {options}] [Direction {options}]

    The extrema option finds the maximum value location along a curve in a specified direction. For example:

    create vertex location on curve 1 extrema ny

    Creates a vertex on curve 1 at the location where the y axis value of the curve is at a minimum.

    Segment

    Segment <num_segs>

    The segment option finds locations spaced evenly along the curve such as to break the curve into equal length "segments" (of course the curve is not modified). You must specify a minimum of two segments (if two segments were specified a location would be found at the center of the curve). The following example results in 4 locations:

    draw location on curve 1 segment 5

    create vertex on curve 1 segment 5

    Figure 3 - Five Segments on a Curve

    Crossing

    Crossing {Curve|Surface} <id_list> [Bounded|Near] }

    The crossing option finds locations at the intersection of the curve and another curve or surface. By default, the curve(s) and surface are extended to infinity and the intersections are calculated; if the bounded option is specified only intersections that lie on the bounded entities will be returned. The near option is valid only for two linear curves. If near is specified the nearest location between the two linear curves will be returned.

 

Specifying a Direction

A direction is basically a xyz vector in the model. The following options determine a direction specification:

  • [Vector] <xval yval zval>
  • Last
  • x|y|z|nx|ny|nz
  • [On] | [Tangent] [At] Curve <id> {location on curve options}
  • [On] | [Normal] [At] Surface <id> [Location {options}]
  • [From] { Location {options} | {Node|Vertex} <id> } [Project] {Location {options} | [Entity] {Node|Vertex|Curve|Surface} <id> }
  • [ Rotate {options} ]
  • [ Cross [With] Direction {options} ]
  • [ Reverse ]

    Vector (XYZ values)

    [Vector] <xval yval zval>

    The most basic way to specify a direction is to just give the vector x-y-z components of the direction. The given vector need not be a unit vector. The following three commands simply draw a direction in the x-direction (1, 0, 0) as the Vector keyword is optional and unit vectors are not required:

    draw direction vector 1 0 0
    draw direction 1 0 0
    draw direction 10 0 0

    Last

    Last

    The last option recalls the last direction used in a command. For example, if the following command is entered after the above vector commands a direction location would be drawn in the x-direction (1, 0, 0).

    draw direction last

    Last directions do not carry over from CUBIT session to CUBIT session. The last direction defaults to (1, 0, 0) if no direction has been used during the session.

    x|y|z|nx|ny|nz

    x|y|z|nx|ny|nz

    The x|y|z|nx|ny|nz options assign the x direction, y direction, z direction, negative x direction, negative y direction and negative z direction respectively.

    [On] | [Tangent] [At] Curve

    [On] | [Tangent] [At] Curve <id> {location on curve options}

    The curve option simply finds a tangent vector on a curve. Note that the on, tangent and at keywords are optional, as well as the location on the curve. If no location is specified, the tangent at the start vertex of the curve is found. See the section above, Specifying a Location on a Curve, for details on how to specify where along the curve the tangent vector is found.

    draw direction curve 1
    draw direction on curve 1
    draw direction tangent at curve 1
    draw direction tangent at curve 1 distance 3
    draw direction tangent at curve 1 fraction .5
    draw direction tangent at curve 1 distance 2 reverse

    Figure 4 - Tangents to a Curve

    [On] | [Normal] [At] Surface

    [On] | [Normal] [At] Surface <id> [Location {options}]

    The surface option simply finds a normal vector on a surface. Note that the "on", "normal" and "at" keywords are optional, as well as the location on the surface. If no location is specified, the normal vector at the center of the surface is found. If a location is specified, the location is projected to the surface, then the normal vector is found.

    draw direction on surface 1
    draw direction on surface 1 location 1 2 0

    [From] Location

    [From] {Location {options} | Node|Vertex <id>} [Project] {Location {options} | [Entity]
    {Node|Vertex|Curve|Surface} <id>}

    The from location option finds a direction that is from one location to another or from a location to an entity. If the second specification is an entity, the first location is projected to the entity to find the direction.

    draw direction from vertex 1 vertex 2
    draw direction from location on curve 1 fraction .5 surface 3

    Note that when using an entity for the second specification, the Project and Entity keywords are generally optional. However, it is sometimes necessary to remove ambiguity from the previous location specification. For example, the following will not parse correctly:

    draw direction location on curve 1 distance 2 surface 3

    In this case, the location on the curve is parsed as a distance 2.0 from surface 3. Instead, the desired behavior is to find the location on curve 1 as a distance of 2.0 along the curve from the start of the curve, and project it to surface 3 to find the direction. The following commands (all equivalent) achieve this behavior:

    draw direction location on curve 1 distance 2 project surface 3
    draw direction location on curve 1 distance 2 entity surface 3
    draw direction location on curve 1 distance 2 project entity surface 3

    Rotate

    [ Rotate {options} ]

    The rotate option allows you to rotate the direction about another vector. You can string together as many rotations as necessary. For example:

    draw direction 1 0 0 rotate about z 135 rotate about curve 1 angle 50

    Options that can be used with rotate are as follows:

    {Ax|X|Ay|Y|Az|Z [Angle] <angle>} | { {[About] | Towards} Direction {options} Angle <val> } [Rotate (options)] [Origin (location)]

    Ax, Ay, Az (or X,Y,Z) angles can be entered in any order. The optional specification of another rotate keyword in the options indicated that multiple nested rotations are permitted.

Cross

    [ Cross [With] Direction {options} ]

The cross option allows you to find the vector cross product of the direction with another direction.

[Reverse]

    [Reverse]

This keyword simply reverses the direction specification.

 

Specifying an Axis

An axis is simply a vector with a specified origin. The following options determine an axis specification:

Last

    Last

The last option recalls the last axis used in an axis command. The last axis does not carry over from CUBIT session to CUBIT session.

Specify an origin and a vector

    {Direction {options} [Origin [Location] {options}] [Length <val>] [Angle <val>]}

To specify an axis simply specify a vector (a direction) and an origin (a location). Notice that the command requires the axis direction first because the origin defaults to 0 0 0 when not specified. An example of specifying an axis to draw a location using the swing command is as follows:

draw location 1 0 0 swing about axis direction z ang 45

Figure 5 - Swinging a point about the z-axis

The location 1 0 0 was swung 45 degrees about an axis defined by a vector in the z direction and an origin at 0 0 0.

Revolve an axis about an axis

    [Axis {options} Revolve [About] Axis {options} Angle <val>]

To revolve one axis around another use the revolve keyword. The following example revolves the first axis (defined by the y-axis and origin) around the second axis (defined by the z-axis and origin) by 45 degrees and draws the result.

draw axis direction y revolve axis direction z angle 45

Figure 6 - Revolving an axis about another axis