Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 23
Posts: 23   Pages: 3   [ 1 2 3 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 2791 times and has 22 replies Next Thread
sjb007
Member




Joined: May 18, 2021
Post Count: 95
Status: Offline
Reply to this Post  Reply with Quote 
Add "o" to OBJWriter output

https://sourceforge.net/p/sweethome3d/feature-requests/1084/

Could we please have a minor (I hope) change to the OBJWriter so we can have much cleaner imports into blender, and maybe other applications.

Simply needs a line at the start of each SH3D object in the export file:
o <name>

And that gives a single object in blender per object in SH3D, instead of the current situation where even a simple section of wall results in 6 seperate objects in blender.
[Jun 17, 2022, 10:38:16 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
sjb007
Member




Joined: May 18, 2021
Post Count: 95
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

Oh, and I just checked the FreeCAD obj import, and that also can import "o" as individual objects.
[Jun 17, 2022, 1:06:59 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Daniels118
Advanced Member
Member's Avatar

Italy
Joined: Nov 17, 2021
Post Count: 215
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

the current situation where even a simple section of wall results in 6 seperate objects in blender.

For real? Which version of SH3D are you using?
I'm using 6.6a and I get no "o" lines in the exported object, so the whole home is seen as a single object when importing into blender. Am I missing something?
[Jun 17, 2022, 2:07:04 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Member



Netherlands
Joined: Apr 8, 2022
Post Count: 63
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

If I'm not mistaking every "g" in the OBJ file is a separate object when importing into Blender. At least that is what I get when importing an object into Blender. SH3D OBJ exports have the g groupings.
According to the OBJ specifications:
Grouping:
g Group name
s Smoothing group
mg Merging group
o Object name

[Jun 17, 2022, 8:35:54 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Member



Netherlands
Joined: Apr 8, 2022
Post Count: 63
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

I did a little test by exporting a single wall. The OBJ file has 6 g groups, as it should, because you want to be able to apply a texture to each "side". A single piece of wall is just like a box.

Adding an o object name changes nothing when importing into Blender, the same 6 object parts remain the same.

The only way to get a single object into Blender would be to merge all g groupings into a single g group. I haven't tested this but I suspect that you loose the separate textures.

From my point of view a single object in Blender is virtually useless, you want things to be as separated as possible because it allows you to manipulate them individually.
[Jun 17, 2022, 9:00:03 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
sjb007
Member




Joined: May 18, 2021
Post Count: 95
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

Allow me to elaborate. Blender (I'm on 3.1) has options when importing obj files. (Gear cog, top right). There is an expander panel named "Geometry". These affect how the data is interpreted. You can select between Split, and Keep Vert Order.

The "Keep Vert Order" option will create a single object. If "Poly Groups" is on it will create vertex groups in the object based on the "v" labels that allow you to select parts of the mesh. This has some specific useful use case I read somewhere, but not very interesting for us SH3D users.

Under "Split" is the bit I/we are interested in.
If you only select "Split by Object", it will create a single blender mesh object per "o" label in the obj file.
The "Split by Group is maybe the default (I lost track as I've edited my blender importer python code.) On it's own you get blender objects based on "v" labels. If you combine it with "Split by Object" you will still get an object per "v" but the naming convention is "<o-label>_<v-label>".

All the above is observable with the example "with o" test file in the linked ticket.

Simply adding the "o <o-label>" will make SH3D and Blender work really nice together.

I'm currently trying to modify the blender import to add the option to have the best of both worlds:
"Split by Object" + new "Group to Vertex Groups" (yeah the name isn't great). The idea is that each "o" in the obj file create a seperate blender object, and each of the sub "v" groups create a blender vertex group under that object. This allows you to easily select or operate on the seperate parts of the mesh. Think of a bed, with the pillows and duvets as seperately selectable vertex groups. I'm kind of stuck at the moment because the vertex group code uses an array of vertices and indexes to reference them. Unfortunately when you "Split by Object" it appears the vertices indices change, so the vertex groups don't work.

I hope that cleared up any misunderstanding.
[Jun 17, 2022, 10:50:00 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
sjb007
Member




Joined: May 18, 2021
Post Count: 95
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

the current situation where even a simple section of wall results in 6 seperate objects in blender.

For real? Which version of SH3D are you using?
I'm using 6.6a and I get no "o" lines in the exported object, so the whole home is seen as a single object when importing into blender. Am I missing something?


In case it wasn't clear I exported an obj file, and manually added the "o" to test the theory, and it works. Theree's an attachment in the linked ticket that has the "with o" test file I've been experimenting with.

If you get a single object, you need to examine the options as I mention in my previous comment. You likely have "Keep Vert Order" selected.
[Jun 17, 2022, 10:53:46 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
sjb007
Member




Joined: May 18, 2021
Post Count: 95
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

A couple of other quick thoughts on possible additions to the blender obj importer to improve SH3D -> Blender:

  • A scale factor to resize the import, because SH3D and Blender use very different units, and I'm bored of resizing objects.
  • This one is really "out there" and I'm not sure I understand Blender well enough to implement... The "o" name could use a name with a "splitter character", and the split parts (except the last) could be used to create a nested collection tree. Then if SH3D set "o" to "<level-label><split-char><object-label>"... You could have objects divided up into levels in Blender.

[Jun 17, 2022, 11:25:00 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Daniels118
Advanced Member
Member's Avatar

Italy
Joined: Nov 17, 2021
Post Count: 215
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

@sjb007
(Gear cog, top right). There is an expander panel named "Geometry"

You're right! I did expand the gear button, but I didn't see the "geometry" accordion... my poor eyes!
Thank you!

I agree with you about having the "o" lines, splitting by geometry produces too many entries (even door handles gets separated), many of which have poor names.

P.S. after importing, all the imported objects are selected by default. Just type "s.01" and press enter to scale down 100 times (centimeters -> meters).
----------------------------------------
[Edit 1 times, last edit by Daniels118 at Jun 18, 2022, 6:15:42 AM]
[Jun 18, 2022, 6:12:45 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
sjb007
Member




Joined: May 18, 2021
Post Count: 95
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output


P.S. after importing, all the imported objects are selected by default. Just type "s.01" and press enter to scale down 100 times (centimeters -> meters).

Oh, I know how to scale. That's five key presses! "Ain't nobody got time for that!"... more seriously, when you are doing the import 50 times trying to figure out how in the hell the importer works, it does get tedious.
[Jun 18, 2022, 1:29:54 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 23   Pages: 3   [ 1 2 3 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2022 eTeks - All rights reserved