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

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 »

:D
Attachments
cyclone8.obj
(20.03 KiB) Downloaded 99 times
wmayer
Founder
Posts: 20303
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: export to obj with groups and same mesh

Post by wmayer »

git commit 361951e now offers a GUI method to define the groups. As discussed before you have to define colors per faces and then use the Standard mesher and set the option to create the segments.
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 »

- open attached file cyclone--colors
- change to Mesh Design workbench
- select the object Fusion in Tree View
- Menue Meshes --> create mesh from shape
- change to standard mesher
- activate checkbox "Define segements by face colors"
- use a Surface deviatiation of 0.1 mm or any other which would you like to have
- click on "OK"
- I only get one mesh ?! Shouldn't there be three meshes according to the colors or are these segments inside the new mesh. If they are inside how to make them visible?!
- If I export the mesh to object and reimport I still have one mesh after reimport.

OS: Debian GNU/Linux 8.5 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.8383 (Git)
Build type: Unknown
Branch: master
Hash: eac69724aab11e0dc872c6bc2508ad12f5047234
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.0.0
Attachments
cyclone--colors.fcstd
(10.65 KiB) Downloaded 96 times
wmayer
Founder
Posts: 20303
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: export to obj with groups and same mesh

Post by wmayer »

- I only get one mesh ?! Shouldn't there be three meshes according to the colors or are these segments inside the new mesh. If they are inside how to make them visible?!
Not yet at this time. Here it internally just creates the segments and when exporting it as obj they are used to achieve the grouping.

When running this snippet after creating the mesh it reports "3":

Code: Select all

App.ActiveDocument.ActiveObject.Mesh.countSegments()
At this point you can create the sub-meshes with:

Code: Select all

mesh=App.ActiveDocument.ActiveObject.Mesh
for i in range(mesh.countSegments()):
    Mesh.show(mesh.meshFromSegment(mesh.getSegment(i)))
- If I export the mesh to object and reimport I still have one mesh after reimport.
This is supposed to work. Since the segments are created I guess there must be a bug that they are not used for the obj export. I will have a look...
wmayer
Founder
Posts: 20303
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: export to obj with groups and same mesh

Post by wmayer »

For the moment you have to use the export function from the Mesh menu. The general export doesn't support this at the moment.
wmayer
Founder
Posts: 20303
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: export to obj with groups and same mesh

Post by wmayer »

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 »

@werner: :D

For others:
- open attached file cyclone--colors
- change to Mesh Design workbench
- select the object Fusion in Tree View
- Menue Meshes --> create mesh from shape
- change to standard mesher
- activate checkbox "Define segements by face colors"
- use a Surface deviatiation of 0.1 mm or any other which would you like to have
- click on "OK"
- select the new Mesh in TreeView --> Menu File Export --> export to object format

- reimport into FreeCAD will create 3 meshes which fit together at the vertices
Attachments
cyclone--colors.fcstd
(10.65 KiB) Downloaded 106 times
cyclone9.obj
(9.68 KiB) Downloaded 102 times
cfdfoundation
Posts: 4
Joined: Sat Jan 10, 2015 4:12 pm

Re: export to obj with groups and same mesh

Post by cfdfoundation »

This does split the boundary regions into separate sets of grouped faces, but each group is named "Group". Is it possible to assign an index within the group name, ideally for our usual naming convention of "patch", it would be: patch0, patch1, ... patchN

Thanks, Chris
wmayer
Founder
Posts: 20303
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: export to obj with groups and same mesh

Post by wmayer »

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 »

cyclone10.obj
(9.69 KiB) Downloaded 110 times
Post Reply