MotionView User's Guide

3D Curves

3D Curves

Previous topic Next topic Expand/collapse all hidden text  

3D Curves

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

This section describes the 3D Curve entity of MotionView and shows the various usage, creation, and editing methods.

Theory/Background

3D Curves are geometrical curves in a three dimensional space that can be used to define entities such as Point-to-Curve joints and other Advanced Joints.

The are two types of 3D curves available in MotionView:

3D Cartesian

3D Cartesian curves consist of three vectors.  All three vectors must be of the same length (or in other words, should have the same number of data points).

3D Parametric

A 3D parametric curve is defined in terms of one free parameter, u, and the remaining three vectors that are function of u.  3D parametric curves can be defined either by explicitly defining the vectors, or as a user-defined curve using a user subroutine.

Creating and Editing 3D Curves

To learn how to add a 3D Curve to a model, please see the Curves topic.

3D Cartesian Curves

hmtoggle_plus1To define a 3D Cartesian curve:
1.Once an Curve has been added to the model using any of the entity creation methods, the panel for the Curve will be displayed in the panel area.

3d_curves_panel_mv

Curve Panel - Properties Tab

2.From the first drop-down menu diagram_number_one_round_mv, select 3D Cartesian.
3.From the second drop-down menu diagram_number_two_round_mv, select the curve vector type to define the curve properties.  Each column for the curve can be defined using either of the following vector types:
File
Math
Values

To know more about how define the curve data using the curve vector types, please refer to the Vector Types topic.

4.The property of the curve can be defined based on the vector type selected.
5.To define the curve attributes, click on the Attributes tab.

3d_cartesian_curve_panel_attributes_tab_mv

hmtoggle_plus13D Cartesian curve in MDL (Model Definition Language)

Syntax:

*Curve(crv_name, "crv_label", 3D,

                             CARTESIAN,

                            [WRITE|NOWRITE],

                            [CONTROL_POINTS|CURVE_POINTS],

                             OPEN|CLOSED])

Example:

*Curve( crv_3D_cart, "3D_Cartesian", 3D, CARTESIAN, WRITE, CURVE_POINTS, OPEN )

The syntax to define the curve data:

*SetCurve(crv_name, Block-X, Block-Y, LIN_EXTRAP)

Block-X, Block-Y, Block-Z can be of the following three types:

FILE: "[path]/filename", datatype, request, component

MATH: expr

VALUE: numpts, v1, v2, v3, ..., vn

Example:

*SetCurve( crv_3d_cart, FILE, "3D-Cart-Curve.txt", "Unknown", "Block 1", "X",

                       FILE, "3D-Cart-Curve.txt", "Unknown", "Block 1","Y",

                       FILE, "3D-Cart-Curve.txt", "Unknown", "Block 1","Z" )

To understand the complete syntax of the MDL statements mentioned above, please refer to the following MotionView MDL Reference Guide topics: *Curve() and *SetCurve().

hmtoggle_plus13D Cartesian curve in XML Format

MotionSolve writes out the 3D Cartesian curve as Reference_ParamCurve when exported to the MotionSolve XML format.

Syntax:

<Reference_ParamCurve

      id                  = "integer"

      label               = “Name of the Curve”

      is_u_closed         = { "TRUE" | "FALSE" }

      is_curve_points     = { "TRUE" | "FALSE" }  

 {

      matrix_id           = "integer" >

    | u_start             = "real"

      u_end               = "real"

      usrsub_dll_name     = "valid_path_name"

      usrsub_param_string = "USER( [[par_1][, ...][, par_n]] )"

      usrsub_fnc_name     = "custom_fnc_name" >

    | u_start             = "real"

      u_end               = "real"

      script_name         = valid_path_name

      interpreter         = "PYTHON" | "MATLAB"

      usrsub_param_string = "USER( [[par_1 [, ...][,par_n]] )"

      usrsub_fnc_name     = "custom_fnc_name" >

    | num_xyz_triple      = "integer" >

        x1    y1     z1

        x2    y2     z2

        ...  ...    ...

        xn    yn     zn

 }

/>

In case of the 3D Cartesian curve, the model statement will be as shown below:

<Reference_ParamCurve

    id                  = "301002"

    label               = "3D_Cartesian"

    is_u_closed         = "FALSE"

    is_curve_points     = "TRUE"

    num_xyz_triple      = "10">

  1.0000000E+00   2.0000000E+00   3.0000000E+00

  2.0000000E+00   4.0000000E+00   6.0000000E+00

  3.0000000E+00   6.0000000E+00   9.0000000E+00

  4.0000000E+00   8.0000000E+00   1.2000000E+01

  5.0000000E+00   1.0000000E+01   1.5000000E+01

  6.0000000E+00   1.2000000E+01   1.8000000E+01

  7.0000000E+00   1.4000000E+01   2.1000000E+01

  8.0000000E+00   1.6000000E+01   2.4000000E+01

  9.0000000E+00   1.8000000E+01   2.7000000E+01

  0.0000000E+00   0.0000000E+00   0.0000000E+00

 </Reference_ParamCurve>

To understand the complete syntax of the Reference_ParamCurve XML model statement, please refer to the MotionSolve Reference Guide topic for Reference_ParamCurve.

hmtoggle_plus13D Cartesian curve in Tcl Format

In MotionView, Tcl can be used to add any MDL entities to the model.  There are two Tcl commands that can be used to add an entity:

Syntax:

mdlmodel_handle InterpretEntity new_handle keyword varname label

In case of the 3D Cartesian curve the statement will look as shown below:

mdlmodel_handle InterpretEntity curve_handle Curve crv_3d_cart "\"3D Cartesian \"" "3D" "CARTESIAN" "WRITE" "CURVE_POINTS" "OPEN";

Syntax: 

mdlmodel_handle InterpretSet keyword tokens

In case of the 3D Cartesian curve the statement will look as shown below:

mdlmodel_handle InterpretSet SetCurve crv_3d_cart "FILE" "3D-Cart-Curve.txt"        "Unknown" "Block 1" "X" "FILE" "3D-Cart-Curve.txt" "Unknown" "Block 1" "Y" "FILE" "3D-Cart-Curve.txt" "Unknown" "Block 1" "Z";

The InterpretEntity command is used to add entities to the model and the InterpretSet command is used to set the entity properties.  To understand the complete usage and syntax of these commands, please refer to the InterpretEntity and InterpretSet topics located within the HyperWorks Desktop Reference Guide.

Note - When using the InterpretEntity and InterpretSet commands, it is important to also use the Evaluate command in order for the changes to take effect immediately.

To learn how to create a complete model using Tcl commands, please refer to tutorial MV-1040: Model Building Using Tcl.

3D Parametric Curves

hmtoggle_plus1To define a 3D Parametric curve:

In the case of a Parametric curve, a parameter U will be introduced more arbitrarily, mainly as a tool for describing the curve. One often uses the language of a point "moving" along the curve even in more abstract situations where the curve does not have a mechanical interpretation.

An example use case for using 3D parametric curves is discussed below. The data of the u parameter of the curve is available in a File vector type.  The X, Y, and Z vectors of the 3D Parametric curve are derived from the File based U vector.

The example curve could be represented like this:

U Vector –
File Reference Values

X Vector –
Math Expression

Y Vector –
Math Expression

Z Vector –
Math Expression

1

cos(crv_3D_para.u)

sin(crv_3D_para.u)

tan(crv_3d_para.u)

2

3

4

5

The values for the X and Y are computed using the Math expressions, by taking the u parameter as the reference values.

X Value

Y Value

Z Value

8.4147098E-01

5.4030231E-01

1.5574077E+00

9.0929743E-01

-4.1614684E-01

-2.1850399E+00

1.4112001E-01

-9.8999250E-01

-1.4254654E-01

-7.5680250E-01

-6.5364362E-01

1.1578213E+00

-9.5892427E-01

2.8366219E-01

-3.3805150E+00

1.Once an Curve has been added to the model using any of the entity creation methods, the panel for the curve will be displayed in the panel area.

3d_parametric_curve_panel_example_mv

Curve Panel - Properties Tab

2.From the first drop-down menu diagram_number_one_round_mv, select 3D Parametric.
3.From the second drop-down menu diagram_number_two_round_mv, select the curve vector type to define the curve properties.  Each column for the curve can be defined using either of the following vector types:
File
Math
Values

To know more about how define the curve data using the curve vector types, please refer to the Vector Types topic.

4.The property of the curve can be defined based on the vector type selected.
5.To define the curve attributes, click on the Attributes tab.

3d_parametric_curve_panel_attributes_tab_mv

hmtoggle_plus13D Parametric curve in MDL (Model Definition Language)

Syntax:

*Curve(crv_name, "crv_label", 3D,

                             PARAMETRIC,

                            [WRITE|NOWRITE],

                            [CONTROL_POINTS|CURVE_POINTS],

                            OPEN|CLOSED])

Example:

*Curve( crv_3D_para, "3D_Parametric", 3D, PARAMETRIC, WRITE, CURVE_POINTS, OPEN )

The syntax to define the curve data:

*SetCurve(crv_name, Block-U, Block-X, Block-Y, Block-Z )

Block-X and Block-Y can be of the following three types:

FILE: "[path]/filename", datatype, request, component

MATH: expr

VALUE: numpts, v1, v2, v3, ..., vn

Example:

*SetCurve(crv_3d_para, MATH, 1:100:1, MATH, crv_3d_para.u, MATH, crv_3d_para.u, MATH, cos(crv_3d_para.u)+sin(crv_3d_para.u) )

To understand the complete syntax of the MDL statements mentioned above, please refer to the following MotionView MDL Reference Guide topics: *Curve() and *SetCurve().

hmtoggle_plus13D Parametric curve in XML Format

MotionSolve writes out the 3D Cartesian curve as Reference_ParamCurve when exported to the MotionSolve XML format.  The syntax for the 3D Parametric curve is same as the 3D Cartesian curve.  While getting exported to XML, MotionSolve writes out the values for X, Y, and Z by taking the U parameter as the reference value.  The extent of the curve is governed by the number of U points (that is, the start and end points).

Syntax:

<Reference_ParamCurve

      id                  = "integer"

      label               = “Name of the Curve”

      is_u_closed         = { "TRUE" | "FALSE" }

      is_curve_points     = { "TRUE" | "FALSE" }  

 {

      matrix_id           = "integer" >

    | u_start             = "real"

      u_end               = "real"

      usrsub_dll_name     = "valid_path_name"

      usrsub_param_string = "USER( [[par_1][, ...][, par_n]] )"

      usrsub_fnc_name     = "custom_fnc_name" >

    | u_start             = "real"

      u_end               = "real"

      script_name         = valid_path_name

      interpreter         = "PYTHON" | "MATLAB"

      usrsub_param_string = "USER( [[par_1 [, ...][,par_n]] )"

      usrsub_fnc_name     = "custom_fnc_name" >

    | num_xyz_triple      = "integer" >

        x1    y1     z1

        x2    y2     z2

        ...  ...    ...

        xn    yn     zn

 }

/>

To understand the complete syntax of the Reference_ParamCurve XML model statement, please refer to the MotionSolve Reference Guide topic for Reference_ParamCurve.

hmtoggle_plus13D Parametric curve in Tcl Format

In MotionView, Tcl can be used to add any MDL entities to the model.  There are two Tcl commands that can be used to add an entity:

Syntax:

mdlmodel_handle InterpretEntity new_handle keyword varname label

In case of the 3D Parametric curve the statement will look as shown below:

mdlmodel_handle InterpretEntity curve_handle Curve crv_3d_para "\"3D Parametric \"" "3D" "PARAMETRIC" "WRITE" "CURVE_POINTS" "OPEN";

Syntax: 

mdlmodel_handle InterpretSet keyword tokens

In case of the 3D Parametric curve the statement will look as shown below:

mdlmodel_handle InterpretSet SetCurve crv_3d_para "MATH" "1:100:1" "MATH" "crv_3d_para.u" "MATH" "crv_3d_para.u" "MATH" "cos(crv_3d_para.u)+sin(crv_3d_para.u) ";

The InterpretEntity command is used to add entities to the model and the InterpretSet command is used to set the entity properties.  To understand the complete usage and syntax of these commands, please refer to the InterpretEntity and InterpretSet topics located within the HyperWorks Desktop Reference Guide.

Note - When using the InterpretEntity and InterpretSet commands, it is important to also use the Evaluate command in order for the changes to take effect immediately.

To learn how to create a complete model using Tcl commands, please refer to tutorial MV-1040: Model Building Using Tcl.

Example Model

The following example shows the 3D curve entity in various formats:

hmtoggle_plus13DCurves.mdl

*BeginMDL( the_model, "Model", "12.0.110.20" )

 

 *StandardInclude(FILE)

 *SetCurrentSolverMode(MotionSolve)

 *Point( p_a, "Point A" )

 *Point( p_b, "Point B" )

 *SetPoint(p_b,           50)

 *Body( b_a, "Body A", p_a, , , ,  )

 *Body( b_b, "Body B", p_b, , , ,  )

 *Set( b_a.usecm, true )

 *Set( b_b.usecm, true )

 

//Example for 3D Cartesian Curve

 *Curve( crv_3d_cart, "3D_Cartesian", 3D, CARTESIAN, WRITE, CURVE_POINTS, OPEN )

 *SetCurve( crv_3d_cart,                FILE, "D:/Documents/curve.csv", "Unknown", "Block 1", "column0", FILE, "D:/Documents/curve.csv", "Unknown", "Block 1", "column0", FILE, "D:/Documents/curve.csv", "", "", "" )

 

//Example for 3D Parametric Curve

 *Curve( crv_3d_para, "3D_Parametric", 3D, PARAMETRIC, WRITE, CURVE_POINTS, OPEN )

 *SetCurve( crv_3d_para,                FILE, "D:/Documents/curve.csv", "Unknown", "Block 1", "column0", FILE, "D:/Documents/curve.csv", "Unknown", "Block 1", "column0", FILE, "D:/Documents/curve.csv", "Unknown", "Block 1", "column0", FILE, "D:/Documents/curve.csv", "", "", "" )

 *PointToCurveJoint( aj_ptcv_cartcrv, "PTCV_Cartesian_CurveValue", b_a, , p_a, crv_3d_cart, Global_Frame, aj_ptcv_cartcrv.rm )

 *PointToCurveJoint( aj_ptcv_paracrv, "PTCV_Parametric_CurveValue", b_b, , p_b, crv_3d_para, Global_Frame, aj_ptcv_paracrv.rm )

   *EndMDL()

See Also:

Curves Panel

Adding and Removing Entities

*Curve() (MDL Model Statement)

*SetCurve() (MDL Model Statement)

Reference_ParamCurve (XML Command)

InterpretEntity (Tcl Command)

InterpretSet (Tcl Command)