K
Kyle X.
Hello, this is not so much a sketchup question as a Ruby one that I
cannot figure out. What I am trying to do is create new variables that
all have the same base name then add a number to make a series of
variables named like wall1, wall2, wall3, ect.
What I am trying to do is take an array, lets call it originalarray,
which has say 64 objects in it, and create 8 smaller arrays from this.
So array1 would be orginalarray[0-7], array2 would be
originalarray[8-15], and so on for 8 new arrays. The problem is I do not
know the length of the original array, as it is being populated by data
from an xml sheet, but I know the multiple of how it is being created,
ie by multiples of 8.
I have been trying to do this using loops doing something like:
n=0
while n != originalarray.length/8
n=n.to_s
array+n=originalarray[0..7]
n=n.to_i
n=n+1
end
I realize that is doesn't work at all in that you cannot make variables
like this, I am just trying to give a better picture of what my goal is.
So I am wondering is it possible to accomplish this at all, and if so
how? Or is there a much easier way to do this using classes or some
other method to accomplish the same goal?
Any help would be greatly appreciated. Thank you in advance for your
time.
cannot figure out. What I am trying to do is create new variables that
all have the same base name then add a number to make a series of
variables named like wall1, wall2, wall3, ect.
What I am trying to do is take an array, lets call it originalarray,
which has say 64 objects in it, and create 8 smaller arrays from this.
So array1 would be orginalarray[0-7], array2 would be
originalarray[8-15], and so on for 8 new arrays. The problem is I do not
know the length of the original array, as it is being populated by data
from an xml sheet, but I know the multiple of how it is being created,
ie by multiples of 8.
I have been trying to do this using loops doing something like:
n=0
while n != originalarray.length/8
n=n.to_s
array+n=originalarray[0..7]
n=n.to_i
n=n+1
end
I realize that is doesn't work at all in that you cannot make variables
like this, I am just trying to give a better picture of what my goal is.
So I am wondering is it possible to accomplish this at all, and if so
how? Or is there a much easier way to do this using classes or some
other method to accomplish the same goal?
Any help would be greatly appreciated. Thank you in advance for your
time.