< Back to IRCAM Forum

Import - export of OBJ files to-from LUA

Hi there !

I am trying to develop a smooth workflow importing and exporting of OBJ files to-from LUA.
Here’s some concerns. Have look into the (very simple) example patch and OBJ file provided below.

Seem to work when OBJ files are properly formatted. Meaning you can use vertex (v) and face (f) statements in the OBJ file. However once you want to defines a modalys obj from the file read in one must take care that the number of modes requested are not too high. Otherwise you get this error:

*** ERROR: could not obtain modes (Lapack error -302 during finite element computation)

So the question is : how do I know the maximum number of modes possible for a read-from-file object? Is there any way I could extract that information from the OBJ file or the LuaMesh?

See the example file below. Open the Lua script and set the N variable to 24 (too high) or 20 (accepted).
I would like to have N derived automatically.

Looking into the OBJ file format it is clear it is very similar to the modalys.save_mesh format. Would it not be an idea to have an OBJ export function in LUA? It would open up a gateway of creative possibilities if fx setting up an export-import traffic between Modalys Lua and Jitter or blender, where meshes can be reworked more freely.

I volunteer to give a try if such OBJ export function could come into live. It could maybe be an option (flag) in the modalys.save_mesh function?

lua_3d_mesh_from_obj_file.maxpat (6.5 KB)
cube-v2.obj (303 Bytes)

All the best for a happy new year Hans Peter

Thanks, Hans Peter,
Yes save-to-obj for surface finite elements is a good idea!
I’ll see what can be done.