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

Post by cfdfoundation »

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
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: export to obj with groups and same mesh

Post by wmayer »

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
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: export to obj with groups and same mesh

Post by bernd »

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
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: export to obj with groups and same mesh

Post by wmayer »

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
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: export to obj with groups and same mesh

Post by bernd »

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
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: export to obj with groups and same mesh

Post by wmayer »

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
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: export to obj with groups and same mesh

Post by Kunda1 »

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?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: export to obj with groups and same mesh

Post by bernd »

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

Post by pupoSDC »

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
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: export to obj with groups and same mesh

Post by Jee-Bee »

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
Post Reply