First time here? Check out the Help page!
1 | initial version |
This is my bad. I had tried with an array doing plant_loops_tokeep = []
and then 'plant_loops_tokeep += plant_loop` but it didn't work. This is a very basic Ruby mistake.
Here's code that works:
plant_loops = model.getPlantLoops
plant_loops_tokeep =[]
#Initial loop to store air loops
plant_loops.each do |plant_loop|
#Criteria...
if ....
# Correct way to assign to an array
plant_loops_tokeep << plant_loop
end #end if
end #end do
# Loop to retrieve air loop objects
plant_loops_tokeep.each do |plant_loop|
#Do stuff with the plant_loop, such as returning its name
runner.registerInfo("Plant loop name: #{plant_loop.name}")
end #end do
I'm still interested in knowing how one can return the object from its handle (especially without knowing the type of object it is).
2 | No.2 Revision |
This is my bad. I had tried with an array doing plant_loops_tokeep = []
and then 'plant_loops_tokeep += plant_loop` but it didn't work. This is a very basic Ruby mistake.
Here's code that works:
plant_loops = model.getPlantLoops
plant_loops_tokeep =[]
#Initial loop to store air loops
plant_loops.each do |plant_loop|
#Criteria...
if ....
# Correct way to assign to an array
plant_loops_tokeep << plant_loop
end #end if
end #end do
# Loop to retrieve air loop objects
plant_loops_tokeep.each do |plant_loop|
#Do stuff with the plant_loop, such as returning its name
runner.registerInfo("Plant loop name: #{plant_loop.name}")
end #end do
I'm still interested in knowing how one can return the object from its handle handle (especially without knowing the type of object it is).
3 | No.3 Revision |
This is my bad. I had tried with an array doing plant_loops_tokeep = []
and then 'plant_loops_tokeep plant_loops_tokeep
+= plant_loop` plant_loop but it didn't work. This is a very basic Ruby mistake.
I'm still interested in knowing how one can return the object from its handle (especially without knowing the type of object it is).
Here's code that works:
plant_loops = model.getPlantLoops
plant_loops_tokeep =[]
#Initial loop to store air loops
plant_loops.each do |plant_loop|
#Criteria...
if ....
# Correct way to assign to an array
plant_loops_tokeep << plant_loop
end #end if
end #end do
# Loop to retrieve air loop objects
plant_loops_tokeep.each do |plant_loop|
#Do stuff with the plant_loop, such as returning its name
runner.registerInfo("Plant loop name: #{plant_loop.name}")
end #end do
I'm still interested in knowing how one can return the object from its handle (especially without knowing the type of object it is).