We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2021-07-12 09:00 AM - last edited on 2021-09-14 09:01 AM by Noemi Balogh
num = 3 !will be set by the parameter DIM myArray[num]This gives an error as:
2021-07-12 10:39 AM
num=3 DIM myArray[] FOR i=1 to num myArray=something NEXT i
2021-07-12 11:28 AM
num = 3 dim _myArray[] for i = 1 to num if i > vardim1(myArray) then _myArray = "put a default value here" else _myArray = myArray endif next i myArray = _myArray parameters myArray = myArray
2021-07-12 12:09 PM
Kristian wrote:It depends on what you need your array. I'm using the method you describe when I have an array (let say coordinates of polygon) and I want to add a new node. Then if I have an array with three points coordinates, I'm passing their coordinates to temporary array, adding at the end additional dimension and coordinates of the new point.
best practice is to build a local array and pass it to to the parameter array, and then also use/reference this local array (assuming master script) in other scripts instead of the parameter array as this means you don't have to wait for the parameter to update in the array for it to apply in the code because the local array already has the value from the master script which is run first.
num = 3 dim _myArray[] for i = 1 to num if i > vardim1(myArray) then _myArray = "put a default value here" else _myArray = myArray endif next i myArray = _myArray parameters myArray = myArray
2021-07-12 12:16 PM
Podolsky wrote:I agree completely. You should be as efficient as possible in your code. Most of my arrays require the dynamic variation so that is the method I apply. If your application does not need to be dynamic like editing a polygon then perhaps it is overkill.
It depends on what you need your array. I'm using the method you describe when I have an array (let say coordinates of polygon) and I want to add a new node
2021-07-12 12:22 PM
2021-07-12 12:39 PM
dushyant wrote:yes
Thanks, Podolsky & Kristian.
Podolsky, yes, that looks like a way around it.
How do you initialise a two-dimensional array as a blank? DIM myArray[][] ?
2021-07-12 04:09 PM
2021-07-13 10:32 AM