R
R
Roman Koff2019-12-14 16:58:04
ruby
Roman Koff, 2019-12-14 16:58:04

How to get the dimension of a selected object in SketchUp?

Started learning plugin building for SketchUp. I know Ruby only by hearsay.
I made an initial module for the extension:

require 'sketchup.rb'

module Ans
  module Stair
    def self.create_stair
      # model = Sketchup.active_model
      # model.commit_operation
    end
    unless file_loaded?(__FILE__)
      menu = UI.menu('Plugins')
      menu.add_item('Create Stair') {
        self.create_stair
      }
      file_loaded(__FILE__)
    end
  end
end

I do not really understand the ideology of the approach. If I have selected an object in the editor (for example, a box or a group), how can I get its dimension so that I can then delete it and draw another object in its place?
For example, I'm making a plugin that draws a sphere. I draw a rectangle, make a box out of it, then select and run the plugin. The plugin gets the height, length and depth of the box, as well as its origin. It removes the box and in its place, according to the received data, draws a sphere (fitting into the dimension of the box). Everything seems trivial, but how?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question