Print at Nov 15, 2019 2:08:37 AM

Posted by Puybaret at Jul 5, 2018 11:12:03 PM
Re: Sweet Home 3D 6.0
Here's version 6.0 Beta 2 (I removed offline running and file associations to avoid conflicts with installed versions).

ndorigatti, you're going to be happy, I continued the programmation of 3D models deformation and succeeded to extend it for rotations around hinges and translations along rails. This was quite tough to manage wide opened doors and windows, but I finally managed to make it work too smile

So, it's now possible to open windows, doors, cabinets and other objects when their modification pane displays a button named Modify openings or Modify posture for mannequins. This is now the case for 32 models in the updated default catalog. I added the default tag (défaut in French) to the 100 models of this catalog to let you find these models more quickly if you installed more libraries.



When you click on the Modify openings button, a dialog box appears to let you rotate or slide some parts.



I added a Reset shape button to reset openings or mannequin to their initial position (i.e. the one in their 3D model file) and three buttons to let you quickly change the point of view on the edited model.
There's no limitations on the angles or translations, and you'll have to visually check if the 3D model will remain consistant or not. You can open sashes at a larger width than window's one and the drawing of the sashes in the plan will keep their size and location correctly. The selection rectangle in the plan will match the total width and depth of the 3D model like until now, even if this may lead to strange rectangles like in the following screenshot.



As soon as an object is deformed, its size can be changed only proportionally, otherwise this could lead to strange shapes. If ever you need a wider or deeper or higher object, first reset its shape, change the dimensions you want, and deform again its shape.

This new feature works thanks to naming conventions in the 3D model files where are described the various parts of the mannequin, the hinges and their openings, as well as the rails and their sliding parts. Remember the ability to declare a shape as a mirror thanks to sweethome3d_window_mirror prefix? Here, it's the same thing, but with more prefixes:
- Hinge parts are prefixed by sweethome3d_hinge_ followed by the order number of the hinge axis they describe, starting from 1 (for example, sweethome3d_hinge_1, sweethome3d_hinge_2,...). A given axis can be defined with more than one part, for example with 2 shapes named sweethome3d_hinge_1_top and sweethome3d_hinge_1_bottom.
- The parts of an opening able to turn around the hinge numbered x should be prefixed by sweethome3d_opening_on_hinge_ followed by the same number x. For example, sweethome3d_opening_on_hinge_1_door and sweethome3d_opening_on_hinge_1_handle will rotate around the axis defined by sweethome3d_hinge_1, or defined by sweethome3d_hinge_1_top and sweethome3d_hinge_1_bottom. If you want to define transparent panes directly without a transparent material, you can also use the prefix sweethome3d_window_pane_on_hinge_ followed by the hinge number.
The axis direction of the hinge x is guessed from the largest dimension of the global bounding box of the hinge parts. Thus, if the largest dimension of a hinge is its height, the axis will be vertical, if its largest dimension is its depth the axis will be horizontal in Y direction and if its largest dimension is its width the axis will be also horizontal but in X direction. Axes can only be parallel to X, Y or Z axes at the moment, but this looks largely enough. The axis may be defined with some dummy parts that are not visible (like in the kitchen cabinet).

- Straight rail parts are prefixed by sweethome3d_rail_ followed by the order number of the rail axis they describe, starting from 1 (for example, sweethome3d_rail_1, sweethome3d_rail_2,...). A given axis can be defined with more than one part too. If a 3D model has multiple openings translating along a unique rail, you may also use the prefix sweethome3d_unique_rail instead.
- The parts of an opening able to move along the rail numbered x should be prefixed by sweethome3d_opening_on_rail_ followed by the same number x. For example, sweethome3d_opening_on_rail_1_door and sweethome3d_opening_on_rail_1_handle will translate along the direction of the axis defined by sweethome3d_rail_1. If you want to define transparent panes directly without a transparent material, you can also use the prefix sweethome3d_window_pane_on_rail_ followed by the rail number. If a unique rail is used, you still have to number each opening to be able to distinguish the different openings that can be moved.
Similarly to hinges, the axis direction of the rail x is guessed from the largest dimension of the global bounding box of the rail parts. Thus, if the largest dimension of a rail is its height, the axis will be vertical, if its largest dimension is its depth the axis will be horizontal in Y direction and if its largest dimension is its width the axis will be in X direction. Axes can only be parallel to X, Y or Z axes at the moment.

- The different parts of a mannequin are prefixed by:
sweethome3d_mannequin_abdomen,
sweethome3d_mannequin_chest,
sweethome3d_mannequin_pelvis,
sweethome3d_mannequin_neck,
sweethome3d_mannequin_head,
sweethome3d_mannequin_left_shoulder,
sweethome3d_mannequin_left_arm,
sweethome3d_mannequin_left_elbow,
sweethome3d_mannequin_left_forearm,
sweethome3d_mannequin_left_wrist,
sweethome3d_mannequin_left_hand,
sweethome3d_mannequin_left_hip,
sweethome3d_mannequin_left_thigh,
sweethome3d_mannequin_left_knee,
sweethome3d_mannequin_left_leg,
sweethome3d_mannequin_left_ankle,
sweethome3d_mannequin_left_foot,
sweethome3d_mannequin_right_shoulder,
sweethome3d_mannequin_right_arm,
sweethome3d_mannequin_right_elbow,
sweethome3d_mannequin_right_forearm,
sweethome3d_mannequin_right_wrist,
sweethome3d_mannequin_right_hand,
sweethome3d_mannequin_right_hip,
sweethome3d_mannequin_right_thigh,
sweethome3d_mannequin_right_knee,
sweethome3d_mannequin_right_leg,
sweethome3d_mannequin_right_ankle,
sweethome3d_mannequin_right_foot
and all these prefixes must be found in a 3D model file, otherwise Sweet Home 3D won't accept to handle it as an articulated mannequin.

How to use these prefixes in your own 3D model files?
In a file at OBJ format, it's quite easy because the parts of a 3D model are defined by lines starting by g or o, so you just have to look for these lines and add the good prefixes to make it work. If you want to visually identify these parts, you can import your 3D model in Blender, click and rename the different parts, and reexport them at OBJ format.



It's the way I used to rename (and improve) the hinges, rails and openings of the 32 following 3D models of the default catalog:
chest.obj
clothesWasher.obj
cooker.obj
desk.obj
dishwasher.obj
door.obj
doubleFrenchWindow126x200.obj
doubleHungWindow80x122.obj
doubleOutwardOpeningWindow.obj
doubleWindow126x123.obj
doubleWindow126x163.obj
dresser.obj
frenchWindow85x200.obj
fridge.obj
fridgeFreezer.obj
frontDoor.obj
glassDoorCabinet.obj
kitchenCabinet.obj
kitchenUpperCabinet.obj
laptop.obj
mannequin.obj
openDoor.obj
oven.obj
piano.obj
roundedDoor.obj
sink.obj
sliderWindow126x200.obj
slidingDoors.obj
wardrobe.obj
washbasinWithCabinet.obj
window85x123.obj
window85x163.obj
Keep in mind to use the previous links to view some real examples using these prefixes.
I'll try to update also 3D models found in other libraries.

If you want to quickly test these features on existing homes, simply open the demos available in Sweet Home 3D, and play with the openings available in them.




okh, I tried a few times to deform the head of the mannequin, but it gave only weird results. The problem is that if you start to give it a more human look, you probably have to change all the limbs and not only one part. Feel free to try yourself by moving vertices (or adding some) on the existing model in Blender, but it's a very time-consuming task. I'll try to define some texture coordinates on the head to check if it can give interesting results.
About changing limb colors, I plan to improve the Material modification dialog box by allowing multiple selection in the materials list.
Finally, I also changed the frame.obj file to use a separated MTL file with clear material names. This kind of object with a double use is already weird enough, not to make it more complicated for beginners!
I tend to use predefined colors in the default catalog to simplify code organization, but sometimes I wonder if I shouldn't forget this old habit.

Thanks all for your feedback smile
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer