4 messages in com.googlegroups.sketchuprubyRe: Simple question (I hope)
FromSent OnAttachments
povlhp28 Jan 2007 10:30 
Jim28 Jan 2007 10:52 
povlhp28 Jan 2007 12:22 
TB02 Feb 2007 19:17 
Subject:Re: Simple question (I hope)
From:Jim (jim.@gmail.com)
Date:01/28/2007 10:52:04 AM
List:com.googlegroups.sketchupruby

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