vcanim.gif (8357 bytes)SWU_cArrayToTclArray
Home ] Sales ] Products ] Services ] Support ] Downloads ]

 

 


SWU_cArrayToTclArray

Convert a C array to a Tcl Array

SWU_cArrayToTclArray is a library procedure which allows a user to convert a C array of type integer, long, float, double to a Tcl array. The input parameters are a C array ID and name of the Tcl array. If the procedure succeeds then it sets elements of the specified Tcl array to the values of the corresponding element's of the C array, if the array or elements of the array do not exist they are created.

package require SWU

SWU_cArrayToTclArray C_array_ID  ArrayName
C_array_ID
An ID returned by the SAA_Alloc, after it allocates memory for a C array.
ArrayName
Name of the Tcl array to set (or create).

Return Value

There is no return value if function succeeds. If an error condition occurs, the return value will be a descriptive string message giving information about the error.

Side Effects

None.

Examples

set curScene [SAA_AllocScene]
Scene1
SAA_sceneGetCurrent $curScene
package require SW
1.0
set nurbsID [SW_name2Element nurbs1 $curScene]
Elem4
SAA_nurbsCurveGetNbKnots $curScene $nurbsID nb_knots
set nb_knots
6
set knotsArrayID [SAA_AllocDouble $nb_knots]
DoubleArray5
SAA_nurbsCurveGetKnots $curScene $nurbsID 0 0 $nb_knots $knotsArrayID
SWU_cArrayToTclArray $knotsArrayID knotsArray
puts [array get knotsArray]
0 1.345 1 2.456 2 7.876 3 0.876 4 4.789 5 5.456

Gets the nurbs curve element, defines the number of knots for the nurbs curve, allocates array of doubles, fills this array with the knots values, convert the knots array to the tcl array and prints out the knots values.

See Also

SWU_cArrayToList


Behaviors Overview ] Behavior Evaluate ] Behavior Edit ] Debugger ] Console ] Find ] SAA Library ] SW library ] SWC library ] SWN library index ] SWU library ] Attributes Index ] Scripting Examples ]

copyright Video-Collage Inc.