That’s possible but a little more than I wanted to go into in this post so I’ll limit this discussion to calculating a tight fitting bounding box that’s oriented parallel to the world XYZ planes.
The easiest approach to the orientation problem is to ask the user for help by lettin them define the coordinate system the bounding box should be calculated in, essentially defining the directions for the length, width and height.
It’s something you could probably write a PhD paper on. The ability to automatically calculate a bounding box that is oriented to get the tightest fitting box possible is a very difficult problem that I haven’t seen a solution to. What I’m going to show you here will create a tight range box but it will still be oriented so it’s parallel to the world XYZ planes. However, it is possible to calculate a very close approximation on your own using other API functionality. Unfortunately, a bounding box that is always tight fitting to the visible graphics is not currently provided by either Inventor or Fusion 360. The most important feature of these objects is that they return the coordinates of the min and max points.Īs discussed above, the bounding box returned by the Inventor RangeBox property and returned by the Fusion360 boundingBox property may not be what you need. The Fusion 360 API has the BoundingBox3D and BoundingBox2D objects that provide the equivalent functionality. The Inventor API has the Box and Box2d objects that are used to pass back the bounding box information and these objects also provide properties and methods to let you work with the box information. For example you can combine bounding boxes to create a new box that contains the originals. Operations with bounding boxes like this are also very simple. This is a very simple and fast calculation that can be performed to determine if the object can be eliminated from the more complicated and costly computations. To determine if an object should be included you can often use it’s bounding box to see if it’s within the area to be calculated. So it may not be what you want but it is arguably correct and is the simplest for Inventor to calculate.īounding boxes are intended to be used in more complex operations where you need to first determine if a particular object should be considered in a calculation. At first glance this would seem to be a bug in the calculation but the bounding box is including the control polygon of the spline surface, as shown on the right. Below, on the left, is an example from Inventor where the bounding box is quite a bit larger than the visible part. In many cases, like in the first example, the size of the range box is the same as the physical size of the part but there are cases when this is not the case. The only thing guaranteed is that the object is completely contained within the box and there is no guarantee about how tight the box fits around the object. The usual intent of a bounding box is not to provide a tight fitting, orientated box around a part but instead to provide a very fast box that fits around a certain piece of geometry. What you probably really wanted was this bounding box but that box can’t be defined by a simple two points and needs additional information to define the orientation.īounding boxes aren’t something specific to the Inventor and Fusion 360 API’s but are a basic concept in computer graphics. In this case the size of the bounding box probably isn’t what you wanted and in most cases is not particularly usefu l. A limitation with defining a bounding box in this way is that the rectangle is oriented such that it’s edges are always parallel to the x and y model axes.īelow is the same part that has been rotated and its bounding box is displayed. The picture below shows the two 2D points used to define the bounding box. If we measured the size of this box I think we would all agree that it looks like an accurate measure of the overall size of the part.Ī typical bounding box is defined using just two points the minimum and maximum points.
Below is an example of a part (the shaded area) and it’s bounding rectangle (dashed lines). A 2D bounding box is a rectangle that encompasses the object. Let’s look at what a bounding box is by looking at some simple 2D examples first. The easiest way to get a size of a part is to get the bounding box (also called the range box) of the object. The discussion here applies to both Fusion 360 and Inventor (and probably most other CAD systems). Autocad sheet metal unfolding.The question of getting the size of a part frequently comes up and I wanted to spend some time discussing the existing functionality and other options.