povlhp,
After you run this once on a model, there should be NO components left
as they have all been exploded.
Try this line instead:
php_recurse( ent.definition.entities, depth + 1 )
On Jan 28, 1:30 pm, "povlhp" <pov...@gmail.com> wrote:
I wrote this simple piece of code below. My problem is, that every
time I run the phptest, it prints fewer lines. Any good suggestions
why ? I am on OS X, Sketchup 6.
model.entities should return the same every time.
require "sketchup.rb"
def php_recurse( entitiess, depth)
entitiess.each do |ent|
if (ent.is_a? Sketchup::ComponentInstance)
puts " " * (depth*3) + "Component: " +
ent.definition.name
php_recurse( ent.explode, depth + 1 )
end
end
end
def phptest
model = Sketchup.active_model
entities = model.entities
php_recurse( entities, 0 )
end