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

Re: export to obj with groups and same mesh

Postby bernd » Fri Aug 05, 2016 5:02 am

:D
Attachments
cyclone8.obj
(20.03 KiB) Downloaded 38 times
wmayer
Site Admin
Posts: 14283
Joined: Thu Feb 19, 2009 10:32 am

Re: export to obj with groups and same mesh

Postby wmayer » Wed Sep 07, 2016 5:22 pm

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
Posts: 7745
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 08, 2016 5:21 am

- 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 27 times
wmayer
Site Admin
Posts: 14283
Joined: Thu Feb 19, 2009 10:32 am

Re: export to obj with groups and same mesh

Postby wmayer » Thu Sep 08, 2016 8:29 am

- 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
Site Admin
Posts: 14283
Joined: Thu Feb 19, 2009 10:32 am

Re: export to obj with groups and same mesh

Postby wmayer » Thu Sep 08, 2016 10:01 am

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
Site Admin
Posts: 14283
Joined: Thu Feb 19, 2009 10:32 am

Re: export to obj with groups and same mesh

Postby wmayer » Thu Sep 08, 2016 11:34 am

User avatar
bernd
Posts: 7745
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 08, 2016 3:44 pm

@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 35 times
cyclone9.obj
(9.68 KiB) Downloaded 33 times
cfdfoundation
Posts: 4
Joined: Sat Jan 10, 2015 4:12 pm

Re: export to obj with groups and same mesh

Postby cfdfoundation » Tue Sep 13, 2016 1:47 pm

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
Site Admin
Posts: 14283
Joined: Thu Feb 19, 2009 10:32 am

Re: export to obj with groups and same mesh

Postby wmayer » Wed Sep 14, 2016 7:09 pm

User avatar
bernd
Posts: 7745
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 4:23 am

cyclone10.obj
(9.69 KiB) Downloaded 35 times