Sketchup.active_model.entities.each{|e|e.erase! if e.valid?}
works but doesn't delete all entities
Sketchup.active_model.entities.to_a.each{|e|e.erase! if e.valid?}
works and deletes all entities
Now, does this mean that to loop all entities in a model i always have to put them in an array first?
I never have run into any problems before using the first method.
Additionaly
- Code: Select all
f=0
Sketchup.active_model.entities.each{|ent|
f+=1
Sketchup.active_model.selection.clear
Sketchup.active_model.selection.add ent
ent.erase!
}
puts f
returns 4095 (on a 11200 entities model)
while
- Code: Select all
f=0
Sketchup.active_model.entities.each{|ent|
f+=1
Sketchup.active_model.selection.clear
Sketchup.active_model.selection.add ent
#ent.erase!
}
puts f
returns 11200 (on a 11200 entities model)
I must be missing something essential here...



