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

 

 


SWU_cArrayToList

SWU_cArrayToList is a library procedure which allows users to convert a C array of type long, integer, float or double to a Tcl list. The input data is a C array ID.

package require SWU

SWU_cArrayToList C_array_ID
C array ID
An ID returned by the SAA_Alloc*, after it allocates memory for a C array.

Return Value

If the procedure succeeds then it returns a list of values of the element's C array, otherwise an error message string is returned on the Tk console command line.

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
set knotsList [SWU_cArrayToList $knotsArrayID]
1.345 2.456 7.876 0.876 4.789 5.456
puts $knotsList
1.345 2.456 7.876 0.876 4.789 5.456

This example gets the nurbs curve element, defines the number of knots for the nurbs curve, allocates a C array of doubles, fills this C array with the knots values, converts the knots array to a Tcl list and prints out the knots values.

See Also

SWU_cArrayToTclArray


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.