Find the length of one side of the Bounding Box
You can solve this as follows:
Here I first create a Bounding Box
for each instance. Don't forget to activate the option Separate Children in the node Collection Info
.
Then I use Realize Instances
to convert these Bounding Boxes into a mesh.
A Bounding Box is a cuboid with 12 edges. One of the edges running on the local Y-axis always has the index $1$.
So I can conveniently filter this out here with Separate Geometry
.
Note: Index $1$ always corresponds to the Y-axis, $2$ to the X-axis and $3$ to the Z-axis.
By converting this edge into a curve, the node Spline Length
then directly returns the length of this former edge, and you have the value you are looking for.
Of course you can also calculate the length with the node Edge Vertices
if you want to process the positions directly:
Dimensions of the Bounding Box
Alternatively, you can also capture the lengths of all three local axes at the same time:
Here I first separate one of the edges on all three axes of each object (Thanks to @GordonBrinkman for the trick with comparing float values and epsilon!).
Then I capture the lengths of these edges and transfer them to the instances with Combine XYZ
.
This way you have all three lengths available for each object separately.
Bounding Box as Node Group
However, it would actually be much more convenient to implement the whole thing as a reusable node group that could be used in almost exactly the same way as the node Bounding Box
.
Let's call this group "Instances Bounding Box".
This can be solved as follows:
The trick here is that I simply filter the first and the last point of the bounding box geometry and their positions.
However, since these are absolute positions, they must be set in relation to the current object.
The positions generated in this way are then exactly the values that the node Bounding Box
would also supply.
(Blender 3.1+)