5

I have downloaded car models where each model consists of multiple meshes including some modifiers. I would like to determine the dimension of the set of all these objects (window, bumper, trunk, ...). I know I can get the dimension of a single object in the transform panel. And I know I can apply all modifiers, join the objects and get the dimension of the resulting object and then undo the joining etc. But isn't there a more straight forward way?

In the end I would like to position the car model such that the center of it's bounding box coincides with the origin. Doing a plain Object > Transform > Geometry to Origin and then selecting "Bounds Center" usually destroys the model unless I apply modifiers and join the objects first.

user1225999
  • 223
  • 2
  • 4

1 Answers1

3

As Chebhou already pointed out in his comment, what people usually do when transforming a disjoint model is have an EMPTY at the centre or wherever you want it (you can use it as a pivot), and then PARENT all objects with the empty. Then you would simply transform the empty and everything should stay in the same position relative to it.

You can have a hierarchy of empties if you want to be able to move some objects separately (say wheels, doors, etc.)

I am not sure how getting the dimensions of all objects would help you solve your problem, but if that is what you want you will have to write a simple script (something like that):

for each object in selected
  print object.getDimensions()

But then you will have to go through them manually unless you don't attach it to some other script.

Timaroberts
  • 12,395
  • 6
  • 39
  • 73
G.Rassovsky
  • 954
  • 7
  • 12
  • Ok this would solve the original problem. However, I do need the overall dimension - not just the dimension of each component. – user1225999 Apr 28 '15 at 16:12
  • Oh you can do that, by getting the bounding box of the selected objects, and it will have the overall dimension. – G.Rassovsky Apr 28 '15 at 16:19
  • And how does this work for multiple selected objects? – user1225999 Apr 29 '15 at 06:23
  • If blender doesn't still support this feature out of the box, then have a look at this excellent answer by gandalf3 http://blender.stackexchange.com/a/6131/5341 , you need it as far as getting the dimensions of each object. You don't need to actually construct the box. Have an array of the extreme values, eg: zMin, yMin, xMin, zMax, yMax, xMax, and simply compare the current object's values against these extremes, if the object has a 'more extreme' value, then save it in these extreme variables... at the end you will have the dimensions of bbox around your selected objects. – G.Rassovsky Apr 29 '15 at 08:27
  • I know what you mean. However, since these bounding boxes are rotated, the overall bounding-box will most likely be a bit larger than necessary. – user1225999 Apr 30 '15 at 07:07
  • Huh, the way I pointed out in the prev comment will give you Axis-Aligned Bounding Boxes (AABB) - they are not rotated. They are not the most optimal, therefore people use Oriented Bounding Box (OBB) when possible. However if you explicitly don't need them rotated then just use that method, and it will give you the axis-aligned (non-rotated) bbox's coordinates, no matter what shape or form the underling object takes. – G.Rassovsky Apr 30 '15 at 08:44
  • Yes it will give you axis-aligned bounding boxes but not the smallest possible one if I understood you right. Take for instance a cylinder oriented along the z-axis. Let initially be the OBB be equal to the AABB. If you now rotate the cylinder by 45° around the z-axis then you obtain an AABB, which is considerably larger if you compute it the way I think you suggest, that is from the corners of the OBB. – user1225999 Apr 30 '15 at 08:58