Print at Dec 16, 2025, 7:04:39 PM

Posted by Keet at Feb 10, 2024, 4:41:20 PM
Re: How to define multi-level hinge and rail of 3D model
With just the separate objects is's difficult to determine what their relation in the deformaton should be. I did see some mistakes.

If you use a rail/hinge AND use the _and_ part for opening you use the rail/hinge first and put the opening part after the _and_.
There is just one _and_ needed: the deformations are chained which means that if you have a part that deformes on a hinge and that hinge+part moves on a rail you should have something like this:

The rail: sweethome3d_rail_1_...
Other parts that move along the rail: sweethome3d_opening_on_rail_1_...
The hinge that should move along the rail: sweethome3d_hinge_1_myhinge_and_sweethome3d_opening_on_rail_1_...
The part that rotates on the hinge: sweethome3d_opening_on_hinge_1_...

Since the part on the hinge is connected to the hinge it will also move along the rail because the hinge itself moves along the rail: the object deformations are chained.

If you dont't need to see the hinge and/or rail use a box that you stretch to get a direction. Make all sides invisible except the one side that should be a rail or hinge. A very thin elongated top of the box works fine. Export it and edit in the deformation string in the obj file. The advantage of just a single side of a box is that you only have one group (g) that gets the hinge or rail definition.
You can even make the rail invisible by adding a line with d 0.0 to the material of the rail in the mtl file.

Here's a zip with a project and the objects that deform like I think you want:
https://dodecagon.nl/upload/tmp/TestDeformations.zip
The myBoxOnARailWithRotatingFlag object is the complete object with chained deformations.
The flag rotates around the pole. The box+pole+flag move along the rail.
When you look in the obj file you will see that there is no double _and_ used.
The rail is just a single g group, i.e. only the top of a box. Exported and imported so it's just a singel flat surface.
The pole is a cylinder where the cylinder groups is the hinge that moves along the rail. The top and bottom of the cylinder just move along the rail like the box.
The flag only moves (opening) on the hinge and has no direct connection to the rail. That connection is established through the hinge to which the flag is connected.
----------------------------------------
Dodecagon.nl
1300+ 3D models, manuals, and projects