I am constructing a function that would take an array(list) as its argument(input) and returns another array. On calling the function the code shows a warning and returns null. The warning says “Converting an array to var would cause array rank reduction and is not permitted”.
However, the same function works fine if only one single element is given as a return. I am attaching screenshots of the function for reference. Can someone tell me what is wrong?
In your function definition, you are calling
: var which forces the function to call itself at the rank value of 1. If you are looking for a list, then try changing that to
: var.. which allows arbitrary rank.
As shown below:
You can find more information on DesignScript here: https://dynamobim.org/wp-content/links/DesignScriptGuide.pdf
Hello Sol Amour,
Thanks for clearing the doubt on ranks. The function is working now as needed.
The new function:
def func : var..(IN : var..)
geo = Autodesk.Geometry.Circle.ByCenterPointRadius(IN,IN);
geo = Autodesk.Geometry.Line.ByStartPointEndPoint(IN,IN);