I am trying to figure out how to place a component with a button press

components

#1

Hello All

I am pretty good at working with sketch up.
I am trying to get into dynamic components and ruby programming
I am a wood worker,
I have made a dynamic component which will create pieces of lumber that has all the parameters I need.

I would like to do the following via ruby
Add a button to the toolbar on Sketchup 2017
Upon Button Press
Take a (Specific Dynamic Components) and put it at some Point (origin or other) in the Model
Show Component Options Window for the just placed object

How can I get more info on how to accomplish this.
It seems like this should not be that hard.
Thanks in advance for you help


Get orientation of face under cursor
#2

You first need to learn Ruby programming, then learn the SketchUp API that adds classes and modules to the Ruby core. I made a Learning Resources list:

The dictionary for the SketchUp Ruby API:


More specific pointers to docs, based upon your questions:

method: Sketchup::DefinitionList.load()

method: Sketchup::Entities.add_instance()


#3

Thank you for the references.
It took me a little while to understand your answer.
You gave me the kit to solve the problem.

Thanks Again


#4

By the way, I had written a couple of examples here previously:


#5

This topic was automatically closed after 91 days. New replies are no longer allowed.