Weight by Volume Calculator w/ Toolbar Buttons

HI EVERYBODY!

This is my inaugural post! Long time creeper first time poster hehe.

I have learned a lot over the last few years from these forums and all the great folks who contribute their time daily to answer questions and solve problems, it’s very heartwarming!

I have recently become interested in calculating weights by volume of solid objects, I do a lot of CNC milling, and have put together a list of the most common materials and their respective weight unit per volume unit.

I personally know next to nothing about any coding…it is a sad fact that I have been forced to accept after taking multiple courses and online tutorials only to fail miserably time and again.

That being said, this is my first go around with anything Ruby related, other than importing Ruby extensions in the past. I am willing to put forth the effort, I just can’t guarantee with what level of patience anyone is willing to suffer me…

So far I have found this bit of Ruby code(?) that yields the desired response. It does indeed accurately calculate the weight of a solid using the predetermined unit of density.

What I would like, nay love, to be able to have is a toolbar with buttons assigned to different density’s. So for example, a button called Aluminum that when clicked with a solid object selected, pops up a message box containing the calculated weight! Basically just like the native Area calculator!

I’ve read the knowledge base article about creating toolbars but I don’t know how to take the multiple bits of Ruby and implement those into buttons…is this even possible?

In the 3+ years of using Sketchup, quite extensively at times, this is the one thing I haven’t been able to do. I’ve spent hours learning how to do everything I’ve ever wanted/needed to do in Sketchup, and equally so with this request but alas, I am stumped, and rather forlorned by that fact.

Any help is greatly appreciated!

I recall @TIG has an extension for assigning weights to objects…

have a search on the SketchUcation forum…

john

I’ve got Toolbar Editor by Aurelius and I think this is the way to go!

All I need now is to figure out how to string together all the necessary code to make the custom buttons do what I want!