Skip to content

Instantly share code, notes, and snippets.

@binarytemple
Created June 1, 2015 14:14
Show Gist options
  • Select an option

  • Save binarytemple/19b745faac462d5ff7c1 to your computer and use it in GitHub Desktop.

Select an option

Save binarytemple/19b745faac462d5ff7c1 to your computer and use it in GitHub Desktop.
sketchup script that allows you to push or pull multiple objects at once
require 'sketchup.rb'
# unknown origin or usage rights...
module BR_push_pull
def BR_push_pull.main
model = Sketchup.active_model
selection = model.selection
model.start_operation "Multiple Push/Pull"
faces = []
if model.selection.empty?
entities = model.active_entities
else
entities = model.selection
end
entities.each do |e|
faces.push e if e.is_a? Sketchup::Face
end
prompts = ['Push/Pull Distance']
defaults = [0.to_l]
results = UI.inputbox prompts, defaults, 'Distance to Push/Pull'
distance = results[0]
faces.each do |e|
e.pushpull distance, true
end
model.commit_operation
end # .main method
end # BR_push_pull module
#----------------menu------------------
if !file_loaded?(__FILE__)
UI.menu("Plugins").add_item("Multiple Push-Pull") { BR_push_pull.main }
end
file_loaded(__FILE__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment