Firstly I went away and had some yard work to do.
Secondly, please post (or edit your original) snippet as valid code, with real points so we have a starting point.
Thirdly, often we will tell you how to do it yourself so that you learn best, rather than just coding the solution. (I myself have a policy not to give code until a newb at least tries to apply suggestions themselves.) You’ve not tried the 2 of the suggestions.
In order to do the boolean operation, you need only have references to the two group objects. But, as I said before, they need to be unique.
group1
and group2
would work. So would wall_group
and window_group
.
You even said this in your original post …
Yes you should. But these are not names, they are references to objects. (Ruby is a 100% object oriented programming language.)
You can also give SketchUp groups and component instances persistent names as they have a name property set via their .name=
method, accessed via their .name
method.
It seems that you are confounding a name which is an API property of group and instances, and the Ruby object reference (called in other languages, a variable.) Each are different things and have separate uses.
We (and you) should not worry about numbers, which are the ordinal position of an entity within the C++ entities collection. The position in the collection is something we will never control and cannot rely upon remaining static on the Ruby side of things.
The boolean methods return a result
reference. You test it for nil
… ie …
if result.nil?
# one or both of the groups was not a watertight manifold region
else
wall_with_hole = result
end
FYI …