How do you create a group of lines from a while loop and how do entities and groups work in Sketchup/Ruby? I can not seem to make this work:
mod = Sketchup.active_model # Open model ent = mod.entities # All entities in model sel = mod.selection # Current selection i = 0 # initiation num = 10 # iterations while i < num do pti = [i,i*i,0] # create first point i += 1 # go to next ptj = [i,i*i,0] # create second point ent.add_line(pti,ptj) # connect grp = ent.add_group # add to group end ent = grp.entities
I have tried inserting the following inside, before and after the while loop. It only worked when it was inside the loop, but then it created a group for each iteration.
grp = ent.add_group ent = grp.entities
I saw another Topic that said: Create the empty group first and then add entities to the group. However, I do not quite understand how to implement that into my code.