Thank you for the effort. I tested and encountered a problem with the method by Chris (coded by Jim):
@jim said:
What Chris said:
> bb = Geom;;BoundingBox.new
> Sketchup.active_model.selection.each { |e| bb.add(e.bounds) }
>
bounds
is not a method of Entity and hence the code failed to execute. Should I step into each entity to retrieve DrawingElement
objects in order to get the BoundingBox?
On the other hand, I tested TIG's codes and replaced center=ssg.bounds.center
by the followings to check the size of the box:
puts "Width; #{ssg.bounds.width}\nHeight; #{ssg.bounds.height}\nDepth; #{ssg.bounds.depth}"
These are the results (Tested with my SU Pro 7.0.10247):
Without Sang:
===== Without Sang ====
Width; ~ 12' 7/8"
Height; ~ 9' 5 1/2"
Depth; 6' 11 3/4"
With Sang:
==== With Sang =====
Width; ~ 12' 7/8"
Height; ~ 9' 5 1/2"
Depth; ~ 11' 6 1/2"
I just wonder why:
(1) bounds.depth
returns the height and bounds.height
returns the depth...?
(2) Sang affects the bounding box in depth that much...