Skip to content

Instantly share code, notes, and snippets.

@engina

engina/ext.rb Secret

Created September 17, 2019 09:19
Show Gist options
  • Save engina/63dfe7ad9c5a0651265ded3e18ab67ff to your computer and use it in GitHub Desktop.
Save engina/63dfe7ad9c5a0651265ded3e18ab67ff to your computer and use it in GitHub Desktop.
# Copyright 2016 Trimble Inc
# Licensed under the MIT license
require 'sketchup.rb'
module Examples
module HelloCube
def self.create_cube
model = Sketchup.active_model
model.start_operation('Create Cube', true)
group = model.active_entities.add_group
entities = group.entities
points = [
Geom::Point3d.new(0, 0, 0),
Geom::Point3d.new(1.m, 0, 0),
Geom::Point3d.new(1.m, 1.m, 0),
Geom::Point3d.new(0, 1.m, 0)
]
face = entities.add_face(points)
face.pushpull(-1.m)
model.commit_operation
end
unless file_loaded?(__FILE__)
toolbar = UI::Toolbar.new "Xenakis"
# This toolbar icon simply displays Hello World on the screen
cmd = UI::Command.new("Sync") {
## I NEED TO RUN IT HERE
}
cmd.small_icon = "ToolPencilSmall.png"
cmd.large_icon = "ToolPencilLarge.png"
cmd.tooltip = "Sync with Xenakis"
cmd.status_bar_text = "Testing the toolbars class"
cmd.menu_text = "Test"
toolbar = toolbar.add_item cmd
toolbar.show
file_loaded(__FILE__)
end
end # module HelloCube
end # module Examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment