Change the bounding box for an object

This topic has been viewed 2684 times and has 2 replies
Thread status: Active
How can I do this? [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
User avatar
Keet
Posts: 1807
Joined: Fri Apr 08, 2022 7:13 am
Country: Netherlands

Change the bounding box for an object

Post by Keet »

Is there a way to change the bounding box for an object without changing the size of the object itself?

I have 2 objects, virtually the same but one has small protrusions on 2 sides. This makes the bounding boxes of the two objects different. Stacking the smaller on top of the larger means I have to align top-left and then move the smaller one a little to fit on top of the larger one where it correctly aligns with the base part the larger object. Of course I know the numbers so this is easy but if I want to share those models it's difficult for other users.
There are several tricks to accomplish the correct alignment but they are all a little awkward for a user that doesn't know the internal numbers of the objects. I want to offer the simple align top-left for these models.

As I see it this can be accomplished if I can set a larger bounding box for the smaller object so the normal alignment tools can be used. This means setting a different top, left, bottom, and right line around the actual object without changing the size of the object itself. In a way it's like setting a cutout shape: define a different square without changing the size of the object. The object just gets a little extra space around to match the larger object. This also has the advantage that resizing both objects keeps the alignment as it should.

In the Home.xml file and in the PluginFurnitureCatalog.properties file you can set additional properties that are not available through the user interface (wall-distance, sash, etc). Are there properties available to set such a bounding box? I searched the API docs but I can't find if there is such a thing.
Dodecagon.nl
1300+ 3D models, manuals, and projects
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Change the bounding box for an object

Post by Puybaret »

The bounding box of the 3D model always matches the width x depth x height dimensions. If you want to cheat, you could add some invisible boxes to the model or create a group containing your model and the invisible parts.
Emmanuel Puybaret, Sweet Home 3D creator
User avatar
Keet
Posts: 1807
Joined: Fri Apr 08, 2022 7:13 am
Country: Netherlands

Re: Change the bounding box for an object

Post by Keet »

That works. I didn't know that objects with d 0.0 were still exported, they are 'invisible' after all.
It's not perfect, you get an extra material property 'invisibleBox' that has no use. Because of the specifications of the obj/mtl files you cant't change it into '(invisible)' or 'N/A', so I have to resort to something like 'NA', 'nothing', 'notused', or 'filler'. I haven't decided yet.

It does solve the bounding box problem and that was the most important.
Dodecagon.nl
1300+ 3D models, manuals, and projects
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests