Blender file format import library?

I develop a small CAD-style application in C++ and want to offer my users the possibility to import Blender-files for further processing. All I would need are the geometry information (meshes), additional things like textures, normals, lighting and so on are not required and therefore can be dropped durign import.

As I would guess I’m not the first one which is interested in this kind of application: is there a library available which gives the possibility to import blender files and provides the imported geometries to the caller in some defined, intermediate format? C/C++ is prefererred as it would be very complicated to integrate Python-stuff in my application.

I know the sources of Blender are available but I don’t see a chance for me to extract just the file-loading part, that’s why I’m asking for a library which is specialised in this.

I believe the historic answer is “don’t use the blend file format”- the devs have been protective over their freedom to change and modify blender’s internal file format without having to worry about downstream changes. This obviously doesn’t stop people from doing it, but it probably means the chances of finding an import library for the native blend format slim at best.

for reference: .blend file errors

Another vote for “Don’t do it” things will get messy “quick” even if you go, “i just need mesh data it’ll be allright” what if there’s modifiers on the meshes? (subdiv perhaps?) if you just read the raw mesh data users will still not get what they are expecting.

If you’re determined to get blender data into your application, I’d probably just ask where blender is installed and shell out to it in background mode with a script to export all mesh data in a format designed for interchange (.gltf or .obj perhaps) and read that.


Afaik Open Asset Import Library (assimp) support .blend files and it is c++ library

but i dont know the state of that .blend support

Safe way would be like eg. Unity does and @LazyDodo said.
Just use Blender and blender’s own exporters to get intermediate format like gltf/fbx.
Even if You implement .blend file You would have to update it every blender release.

Thanks for all the feedback. For me assimp seems to be the best tip, I’ll try that! :slight_smile:

A little bit off-topic but may be somebody knows an answer: libassimp provides support for DXF but it seems it only loads 3D-meshes, no flat, 2D DXF vector files. Does anybody know an import library which can deal with DXF files properly? Means with flat, 2D models?

Thanks :slight_smile:

I wrote some experimental code to parse .blend files here. It also includes an updated version of the “Mystery Of The Blend” file-format document which is included in the Blender source tree, but which is woefully obsolete.