Solid Boolean Operations


The complexity of the exterior wainscoting of my Wall Plugin has now exceeded the capabilities of my own home brewed “trim” function/method. At this point it would appear that my only choice is to restrict this added level of functionality within the wainscoting module to the PRO version of SketchUp and then use the built in solid editing methods of SU Pro, primarily the subtraction method.

It has been a while since I visited this topic however I do recall some misgivings by some about the builtin boolean tools of SU. My primary concern is that whatever I employ needs to be both robust and efficient (fast).

My own trim function utilizes the intersect_with method and works remarkably well where I am trimming an object (group) to a single plane. However, I am now faced with situations where I need to trim to multiple planes in one operation and my algorithm to do this comes up short.

Any thoughts or suggestions are greatly appreciated.


As usual I ask the question before looking for the answer. It appears that Eneroth has done some excellent work in this regard already. I have my homework cut out for me.

Here is a link to the GitHub page for those interested:

Utilizing the Axes Class with the API

It seems to require also the Pro version (with some improved behavior and usability).

Intersection algorithms as well as those algorithms in SketchUp’s solid operations are quite complex, and difficult to get right in all edge cases. Certainly it would be nice if API users could rely on what is already included in SketchUp, but if you really want to support that functionality for non-Pro users you’d better include a well-tested external library like e.g. CGAL via a Ruby C extension rather than implementing something on your own.

Would it hurt many users when you think about who regularly makes wainscotings, hobbyists or professionals (who would have Pro anyways)?

If you want to keep your extension available for SketchUp Make <=2017, you could choose from two algorithm implementations (trim_to_single_plane, trim_to_planes), where the latter is only available for Pro users.

  • A possibility to implement such a switch depending on the feature of your plugin (type of geometric object) could be the strategy pattern.
  • Or your features/type of objects are classes in which you mix-in a module that provides the trim algorithm. So into a class for a simple object you mix-in SimpleTrimAlgorithm, and into the class for WainScoting you mixin ComplexTrimAlgorithm (or more generically ComplexBooleanOperations).


My solid tools has been set to only work in Pro because otherwise I couldn’t host them in extension Warehouse. If you use it as a library within your own extension there is no such limitation.

Actually I started coding these solid operations so they could be used in another extension because how awful the native ones are to work with (creates new groups rather than editing existing instances, doesn’t honor materials, doesn’t honor axes etc). The native solid operations are a bit more stable than mine in some edge cases, but their biggest problem IMO is that they do a lot of unwanted stuff as well.


Ok, that explains it!

Let me guess :smirk:, they didn’t allow you that "Eneroth Solids Tools in Extension Warehouse is only available for SketchUp Pro." includes a link to where users can download the other version?


Not a direct link, but as they are open source this limitation an be removed.


Note that it is likely CGAL is too expensive for small commercial developers.

Just their industrial research license is 5000 euros annually.
They do not say what the commercial license is, but I expect it to be more than the research license.


I spent the better part of yesterday going through the source code of Eneroth’s solid tools trying to understand it and let’s just say I’m very impressed. I’m glad I’m not the one who had to figure that one out, I’m a SketchUp padawan in comparision.

The biggest plus with this code over the builtin tools is that it respects or retains the group properties as well as modifying the existing group rather than recreating it. A stroke of genius really. SketchUp really needs to take a hard look at this.

I’ve gone ahead and pulled out just the subtraction method and required methods associated with it, reconfigured it slightly and have inserted it into the wainscoting module. I haven’t tested it extensively yet but so far it seems more than fast enough and robust.

Eneroth, I’m still struggling with sales right now but if I hit the big time with this plugin I will see to it that you are duly compensated for the work you have done on this valuable piece of code, I am in debt to you. There is absolutely no way I would have been able to write this. Thank-you.


I’d recommend taking the whole SolidOperations module, change the containing modules and place it in your extension. Even if you only use subtract this module can be thought of as a unit. This way you can more easily update it if my solid tools are updated.

This is open source so you don’t have to. If you do anyway I’ll be much grateful! :slight_smile: