Juncture plane of two touching Solid group

Post code correctly in the forum, not tiny images or video.

There are other boolean methods besides intersect.

I don’t know what you are doing as the video image is too small. But it works for me when the objects are aligned with the model axes. (This is the caveat with the BoundingBox method. Bounding boxes are always aligned with the model axes. This means that they can get bigger and no longer match the objects perimeter if the object is rotated.)

With two solid groups in the model alone …

g1, g2 = Sketchup.active_model.entities.to_a
bb = g1.bounds.intersect(g2.bounds)

#=> false

pts = []

# Use Array#include? to test point "sameness". It uses the member
# class' #== method for comparison (in this case Geom::Point3d#==
# that compares points within SketchUp's coordinate tolerance):

for i in 0..7
  pt = bb.corner(i)
  pts << pt if !pts.include?(pt)

Note: Array#uniq and Array#uniq! will not work here to remove
duplicates as they use Object#eql? and Object#hash, which always
produce different values for SketchUp Geom::Point3d objects, even
though they may be coincident points within SketchUp’s tolerance.

#=> 4
# pts is now an array of the 4 remaining corners of the
#  intersected bounding box (which is flat in this case.)

plane = Geom::fit_plane_to_points(pts)
#=> [1.0, -0.0, -0.0, -20.75]

But again the bounding box pattern would fail if either of the objects were rotated away from the model axes.

1 Like