obj export / meshing

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
lgrobe
Posts: 4
Joined: Thu Dec 30, 2010 4:26 pm

obj export / meshing

Post by lgrobe »

Hi all,

I have tried to get a small model built using FreeCAD, working around some bugs one may expect when using a SVN snapshot (e.g. frequent crashes when duplicating objects). The next steps would be to export my model into obj, whish is a well-supported format for the simulation software I want to use the model with.

Now I am facing two problems with obj export (after I found out that I need to select objects before I can export them):

1) The obj file contains only geometry, no information on group- or object-names is assigned to faces. In my case, this makes it difficult to e.g. assign materials to geometry later unless I want to go through selecting, exporting, importing each object.

2) All faces get triangulated. This may be fine with non-planar faces, but is not needed with planar faces. The model I get from modeling just a room with walls and a window opening, all perfectly orthogonal, is quite a mess of triangles. I can do postprocessing to find coplanar triangles and merge them, but this would be a really great functionality of the export itself.

Is there any recommended way to work around these problems that I am not aware of? I am able to use my model, but it is really a lot of work at the current stage as it involves post-processing and manual user intervention a lot.

Have a nice new year 2011!

Cheers, Lars.
lgrobe
Posts: 4
Joined: Thu Dec 30, 2010 4:26 pm

Re: obj export / meshing

Post by lgrobe »

I attach an image illustrating the triangulation problem. For some reason I cannot upload PNG images here...
Meshing results by obj export. Left: Screenshot of the model. All faces are planar, model is built by box objects only. The ceiling is switched off not to block the view inside the room. Right: Model after obj export. Wireframe generated using Radiance's obj2rad, objline, psmeta. Note that the planar faces all got triangulated.
Meshing results by obj export. Left: Screenshot of the model. All faces are planar, model is built by box objects only. The ceiling is switched off not to block the view inside the room. Right: Model after obj export. Wireframe generated using Radiance's obj2rad, objline, psmeta. Note that the planar faces all got triangulated.
office.gif (70.75 KiB) Viewed 7384 times
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: obj export / meshing

Post by jriegel »

If you dont want planar (inside) faces you have to fuse the shapes before. Otherwise they are distinct entities and get fully triangulated....
Stop whining - start coding!
lgrobe
Posts: 4
Joined: Thu Dec 30, 2010 4:26 pm

Re: obj export / meshing

Post by lgrobe »

Hi,

first, thank you for the quick reply!

The point is that, for obj, there is no need to triangulate any planar faces. If I have e.g. a cube in Freecad, I want to get six square faces, not 12 triangles in my obj file. The triangulation is not necessary for a flat face (and it doubles the number of faces in the exported file).

Cheers, Lars.
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: obj export / meshing

Post by wmayer »

I have tried to get a small model built using FreeCAD, working around some bugs one may expect when using a SVN snapshot (e.g. frequent crashes when duplicating objects).
Which bugs and crashes?
The next steps would be to export my model into obj, which is a well-supported format for the simulation software I want to use the model with.
We use OBJ file format only for our mesh data structure which is a triangular mesh, i.e. we only use a very small range of the OBJ format specification. That's why even planar faces are described by triangles.
Is there any recommended way to work around these problems that I am not aware of? I am able to use my model, but it is really a lot of work at the current stage as it involves post-processing and manual user intervention a lot.
The solution would be not to go over meshes (which is done automatically when selecting shapes but using a mesh format as output format) but implementing a separate OBJ importer/exported that directly works on CAD shapes.
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: obj export / meshing

Post by yorik »

wmayer wrote: The solution would be not to go over meshes (which is done automatically when selecting shapes but using a mesh format as output format) but implementing a separate OBJ importer/exported that directly works on CAD shapes.
That would indeed be a good addition. I think exporting an obj file is not too hard, separating things by objects/groups neither, we must check how obj format treats faces with a lot of vertices too, the annoying part will be that obj uses vertices indexes, and freecad not, we'll need to build some vertices tables...
The only real problem will be when exporting faces that contains curved border or even curved surfaces, since they will need to be tesselated.
Maybe it's just a matter of testing first and passing all "non-straight" faces through standard freecad tesselation...
I'll add this to my todo list, since I'll most certainly need it too in the future.
click'n'tilt_newbie

another .obj problem

Post by click'n'tilt_newbie »

Hi there

If you wanted to create so called sculpted prims for second life, some buddies created a online service to transform data- that is now gloriously commercialized.
Free 3d creation programs are scanty, and for Linux even more so. There is Truespace, but it's for winlows, and in my case it's not working with Wine.
What I would like to have, is the opportunity, to produce 3d objects for Opensim-worlds and also in a industry standard (like .iges ). I tried to use a extern-created .igs file as original model, then transform it to a .obj file. Freecad seemed to perform this successfully (export& type the extension), but other programs couln't display the file. Second step is, to make textured maps of the wavefront-obj. For this, I could not get Blender with Primstar, or Wings with Sculptie under Ubuntu to work. Last option, obj2scult, that may also run on Wine since it is not complex. With a .obj file fished from the internet it succeeded. The failure with the other file was accompenied by the quote: no UVs found. This was also the case for a simple structure created inside Freecad itself. My guess was, the .igs is the more complex standard, so nothing would be missed in downgrading it- wrong? So I've tried several systems and programs, still searching for a preferred noncommercial workflow solution. Any hints? Please don't tell me brl-cad is it.

no pasaran
Christian
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: obj export / meshing

Post by yorik »

I really think you are better with blender:

FreeCAD has a very different logic: it is made to produce accurate, exact models, independent of the complexity. That's why it uses higher-level object types such as brep, where you can use very precise curves and don't need to care about the complexity of your shapes. Mesh-based geometry, specially used in realtime apps such as second life, follow the inverse concept: you must control precisely the amount of complexity you put into your objects, and be able to locate exactly each vertex.

Basically I'm afraid modelling second life stuff in freecad will give you big headache at the time of conversion into mesh formats. You'll probably get very high polygon count, and have no tools to manage or control that polygon count. Also don't forget freecad cannot do UV mapping. I myself use blender everyday (under linux) and I believe it's probably the best app in the world when the subject is mesh modeling. It's a bit steep to learn at first, but believe me it's worth every drop of sweat. Making your second life plugin work in blender/linux might also require some work, but I'm sure it is possible...

In the future freecad should behave better with importing/exporting simple mesh models (like discussed above in this thread), but that might take a bit of time too.
Fim
Posts: 2
Joined: Thu Jun 29, 2017 8:25 pm
Location: Frankfurt
Contact:

Re: another .obj problem

Post by Fim »

Hi Christian.
I am using FreeCAD to design Objects which i am 3D Printing (RepRap Enthusiast). Beside that - i am a virtual world developer utilizing OpenSimulator. I am curious about your engagement in/use of OpenSimulator - did you get to merge FreeCAD and OpenSim in some way?

Sincerely,
Marcus/Fim
click'n'tilt_newbie wrote: Mon Jan 17, 2011 3:32 pm ...
Free 3d creation programs are scanty, and for Linux even more so. There is Truespace, but it's for winlows, and in my case it's not working with Wine.
What I would like to have, is the opportunity, to produce 3d objects for Opensim-worlds and also in a industry standard (like .iges ). I tried to use a extern-created .igs file as original model, then transform it to a .obj file. Freecad seemed to perform this successfully (export& type the extension), but other programs couln't display the file....
--
Fim Fischer was here.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: obj export / meshing

Post by NormandC »

Hello Fim,

Welcome to the forum.

Way to resurrect a dead topic! :D I don't know if you're aware, but Christian (click'n'tilt_newbie) is not a registered forum member. Back in 2011 it was not necessary to create an account to be able to post. So he won't receive an email notification of this topic's activity. I would be very surprised if he still lurked on the forum after all these years.
Post Reply