Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to speed up Sketchup user scripts

Is it possible to loop over the runner.selection in a Sketchup user script?

For example, to act on selected spaces only, the approach I have used is to loop over all spaces, checking if each is in the selection..

model.getSpaces().each do |space|
  next if not runner.inSelection(space)
  # do something to the selected space(s)
end

I want to speed this up, by only looping over the spaces that are in the selection. Is there something in the SDK that could allow this?

something like...

runner.inSelection().getSpaces.each do |space|
 # do something to the space(s)
end

How to speed up Sketchup user scripts

Is it possible to loop over the runner.selection in a Sketchup user script?

For example, to act on selected spaces only, the approach I have used is to loop over all spaces, checking if each is in the selection..

model.getSpaces().each do |space|
  next if not runner.inSelection(space)
  # do something to the selected space(s)
end

I want to speed this up, by only looping over the spaces that are in the selection. Is there something in the SDK that could allow this?

something like...

runner.inSelection().getSpaces.each do |space|
 # do something to the space(s)
end

How to speed up Sketchup user scripts

Is it possible to loop over the runner.selection in a Sketchup user script?

For example, to act on selected spaces only, the approach I have used is to loop over all spaces, checking if each is in the selection..

model.getSpaces().each do |space|
  next if not runner.inSelection(space)
  # do something to the selected space(s)
end

I want to speed this up, by only looping over the spaces that are in the selection. Is there something in the SDK that could allow this?

something like...

runner.inSelection().getSpaces.each do |space|
 # do something to the space(s)
end