Print at Dec 18, 2025, 1:41:55 PM View all posts in this thread on one page
Posted by Keet at Aug 15, 2023, 5:19:13 PM
Export using the name in the plan
This one might be relatively easy to implement (I hope):
When exporting a selection of objects name the g groups as named in the plan instead of the original object name. Preferably optional but set as the default.

For example a box when exported has 6 g lines like top_1, left_2, etc. Since the mtl reference (usemtl line) already identifies each side the g name is useless. What IS useful is naming the 6 sides using the name in the plan. Without changing a new box that would result in 6 lines like box_1, box_2, etc, each followed by the usemtl line for that side. Using this type of naming would allow a group of multiple boxes to be identified individually in the OBJ file by their g lines according to the names you assigned to each box. Currently 3 boxes in an export generates lines with top_, left_, etc. in triple no matter what names the boxes have in the plan. This can make it very difficult to distinguish one from the other when editing a large obj file. By using the name in the plan you can decide yourself if you want identical names or not.
----------------------------------------
Dodecagon.nl
1300+ 3D models, manuals, and projects

Posted by Puybaret at Aug 16, 2023, 4:28:51 PM
Re: Export using the name in the plan
Unfortunately, there's no notion of group in the 3D view, the reason why there is no information about them in the OBJ exported file. And even if this information was added, then there would be some problems to handle groups containing subgroups, because the OBJ format proposes the g tag but there's no end tag for a group.
By the way, I looked at the patch proposed by sjb007, but the changes he proposes are really too specific to his needs.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by Keet at Aug 16, 2023, 5:46:19 PM
Re: Export using the name in the plan
I don't understand what export has to do with the 3D view.

I select one or more objects in the 2D pane and export these to an OBJ file. I can't verify it but I assume that the exporter receives an array containing the selected objects. The exporter iterates over the array and each object is written to the obj file. For a box that results in six 'g blocks', each starting with the g line. The g lines get the names bottom_?, left_?, etc. An exported shape has no names at all on the g lines, only numbers. The names 'bottom', 'left', etc. must come from somewhere. The only reference I can think of is the material names. If those are available then the name of the object itself should be available too (i.e 'Box' for a box).

From what I read about the ObjWriter class it writes 'Java 3D nodes'. Since I'm not familiar with Java I have no idea what exactly is a Java 3D node (I didn't get any wiser from the Java documentation), but to be able to write the selected object that object must be available, maybe as a property of the node instance?

What am I missing or what do I not understand?


Edit-To-Add:
After some further investigation I think I found where the g name comes from: the node name. Unfortunately I can't find where the node name is set so I can only guess if at that point the object name is available and can be set as the node name.
----------------------------------------
Dodecagon.nl
1300+ 3D models, manuals, and projects