tcl script for rbe3


I want to make a tcl script which will generate an rbe3 element inside a cylindrical surface. I made one, first creating faces and adding nodes present on the inner surfaces to an array. The problem is while defining an rbe3 element it asks for the no. of indepent and dependent nodes, which I'm extracting from the size of an array (used to select nodes) using (llength) and assigning it to a variable, but while defining rbe3 it doesn't accept variables even though the variable is assigned a numerical value. How to overcome this problem ?
Also, instead of creating faces and selecting nodes by face, is there any other way to select nodes present only on the cylindrical surface (defining some cyl doman/region something?) ? so that it'll be easy to implement in script.
Thanks !