Can you "Combine Textures" through use of Ruby API?

I’m looking to make a plugin that will allow me to combine textures from multiple faces like you can do through the UI.

Before Combine(2 faces):

After Combine(1 face):

I’ve looked at some other threads but I’m still unsure how I would edit an image using an outside image editor.

Here’s basically what I think I would need to do:

  1. Grab image from each face(assuring first that they’re co-planer and share an interior edge)
  2. Meld the two images into a single image
  3. If melding is successful erase interior edges
  4. Apply newly created texture to the merged faces.

Problems I foresee:
Maintaining resolutions and sizes of images relative to each other.
Assuring the melded image is appropriately aligned
Doing this potentially 100 times without being incredibly slow.

Really the more I look into this the more I’m thinking this isn’t the most ideal way to solve the problem I’m having which is cutting into multiple adjacent faces with a single cutting component. I’ve tried the FaceCutter plugin but had trouble making it work without manually placing components.

Can anyone aid me in finding a workable solution? Hopefully I was able to explain well enough what I need.

New for SketchUp 2018 is an internal virtual image class with which you can do image manipulation in memory, but without affecting the model.

Previously, you would need to do this with a third party image library.
Some have used FreeImage (which SketchUp also uses,) and some have used ImageMagick. It would make sense to check RubyGems to see if there already exists Ruby bindings for these (or other) image manipulation libraries.✓&query=imagemagick

Or other binding projects at GitHub:


I forgot to post search for FreeImage Ruby bindings. So:✓&query=FreeImage

Also if you know C and are comfy calling C functions from Ruby you can use Ruby’s FFI (Foreign Function Interface) implementation called Fiddle:

1 Like

I’m not familiar with C but maybe down the road it’d be useful to learn. Thanks for the help!

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