export to obj with groups and same mesh

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

cfdfoundation
Posts: 4
Joined: Sat Jan 10, 2015 4:12 pm

Re: export to obj with groups and same mesh

Postby cfdfoundation » Thu Sep 15, 2016 12:07 pm

I tested the latest and it worked for me, adding unique names patch0, patch1, etc. The surface is closed, all is fine. Overall this provides a simpler, more robust way of labelling regions of the surface in the obj file than the earlier approaches. It is really great, thanks, it gives us something we can promote in conjunction with meshing in OpenFOAM.

The only possible improvement is if the user can specify their own group names, rather than using defaults patch0, patch1, etc. I guess that would mean somehow "attaching" them to the colour selection. It would be interesting to know if that is unrealistic based on the underlying code.

Again, thanks (wmayer, bernd) for putting this into FreeCAD, it is appreciated.
wmayer
Site Admin
Posts: 13792
Joined: Thu Feb 19, 2009 10:32 am

Re: export to obj with groups and same mesh

Postby wmayer » Thu Sep 15, 2016 12:34 pm

The only possible improvement is if the user can specify their own group names, rather than using defaults patch0, patch1, etc. I guess that would mean somehow "attaching" them to the colour selection. It would be interesting to know if that is unrealistic based on the underlying code.
I would just leave the default names patch0, ... when creating the mesh and then offer a function in the mesh workbench where these names can be changed.
User avatar
bernd
Posts: 7060
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: export to obj with groups and same mesh

Postby bernd » Thu Sep 15, 2016 1:43 pm

wmayer wrote:
The only possible improvement is if the user can specify their own group names, rather than using defaults patch0, patch1, etc. I guess that would mean somehow "attaching" them to the colour selection. It would be interesting to know if that is unrealistic based on the underlying code.
I would just leave the default names patch0, ... when creating the mesh and then offer a function in the mesh workbench where these names can be changed.
Does it mean the segments off the mesh have names in FreeCAD mesh data structure already? I thought the names where given to the segments (groups) during export.
wmayer
Site Admin
Posts: 13792
Joined: Thu Feb 19, 2009 10:32 am

Re: export to obj with groups and same mesh

Postby wmayer » Thu Sep 15, 2016 2:02 pm

Does it mean the segments off the mesh have names in FreeCAD mesh data structure already?
Yes.
I thought the names where given to the segments (groups) during export.
On export a new mesh is created. If the selected mesh feature already has segments then they are copied over to the new mesh. If not then the whole mesh is added as segment and its label is used as group name.
User avatar
bernd
Posts: 7060
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: export to obj with groups and same mesh

Postby bernd » Thu Sep 15, 2016 2:46 pm

wmayer wrote:
Does it mean the segments off the mesh have names in FreeCAD mesh data structure already?
Yes.
But there is no python API to neither read or write the name off a segment. Or at least I could not found a method which returns the name?!
wmayer
Site Admin
Posts: 13792
Joined: Thu Feb 19, 2009 10:32 am

Re: export to obj with groups and same mesh

Postby wmayer » Thu Sep 15, 2016 3:35 pm

But there is no python API to neither read or write the name off a segment. Or at least I could not found a method which returns the name?!
The naming of segments and the flag to mark them for export is something that has been added recently. The Python API hasn't been adjusted.
User avatar
Kunda1
Posts: 3829
Joined: Thu Jan 05, 2017 9:03 pm

Re: export to obj with groups and same mesh

Postby Kunda1 » Thu Dec 14, 2017 10:49 am

bernd wrote:
Thu Sep 15, 2016 2:46 pm
But there is no python API to neither read or write the name off a segment. Or at least I could not found a method which returns the name?!
Shall we open a feature Request in the tracker?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
bernd
Posts: 7060
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: export to obj with groups and same mesh

Postby bernd » Thu Dec 14, 2017 12:19 pm

IMHO: As long as noone explizit ask for it no.
pupoSDC
Posts: 1
Joined: Thu Apr 05, 2018 9:36 am

Re: export to obj with groups and same mesh

Postby pupoSDC » Thu Apr 05, 2018 9:42 am

Hello all,

I'm currently struggling with this issue, and I'm still unable to achieve the single mesh with multiple groups .obj file.

For my particular case, I have a wing.obj file with a single group, that I need to split into 3 different groups. So far I've been able to split the original .obj into 3 different .objs, but if I try to export them all together only one group is created. I've also tried to convert the .obj into a solid object, and using the colour hack, convert it back into a mesh. But this does not work either since the checkbox to "Define segments by face colors" does not show up, and the end result only has 1 group.

I'm running free cad v0.16 on ubunto 17.10.

Any help would be very welcome.
Jee-Bee
Posts: 1619
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: export to obj with groups and same mesh

Postby Jee-Bee » Thu Apr 05, 2018 12:32 pm

pupoSDC wrote:
Thu Apr 05, 2018 9:42 am
I'm running free cad v0.16 on ubunto 17.10.

Any help would be very welcome.
First start with 0.17 and second https://forum.freecadweb.org/viewtopic.php?f=3&t=2264