1. Products
  2.   3D
  3.   C++
  4.   Lib3MF  

Lib3MF  

 
 

C++ Library for 3D Manufacturing File Formats

Open Source C++ APIs for reading, writing and converting 3MFs to STL file formats.

Lib3MF is an open source C++ library that enables software developers to read, write and convert 3MF file formats. Lib3mf is an open source project supported by the 3MF Consortium. 3MF consortium is the Joint Development Foundation Project for creating the new file standard of 3D Printing. It works to promote, distribute, and maintain the open source 3D printing format 3MF. They have put great efforts to keep their platform-independent as far as possible.

One of the key strengths of Lib3MF is its simplicity. With a clean and intuitive API, software developers can quickly get up to speed and start leveraging its capabilities. Whether you're reading a 3MF file, modifying its contents, or generating new models from scratch, Lib3MF makes the process straightforward and efficient. Perhaps most importantly, Lib3MF is built with interoperability in mind. Thanks to its open design and extensive documentation, Lib3MF can seamlessly integrate with a wide range of software and hardware platforms.

it’s recommended to adopt the 3MF file format as it going to be a universal 3D printing standard. Lib3MF API helps users in adoption by providing easy access and keeping integration costs at a minimum. You can use lib3mf API on Windows, Linux, and macOS with very few external dependencies. What sets Lib3MF apart is its comprehensive feature set and seamless integration into existing workflows. Whether you're creating prototypes, customizing designs, or pushing the boundaries of additive manufacturing, Lib3MF has the tools you need to bring your ideas to life.

Previous Next

Getting Started with Lib3MF

First of all, you need to have the pre-compiled binary SDK of lib3mf. You can download the compiled shared library as part of a minimal SDK from the official releases, or github repository.

This SDK package contains several examples. Once you download and extract the SDK, you can work on the examples. From there, you should be able to include lib3mf in your host application or service.

C++ Library to Read & Write 3D Manufacturing File Format

Lib3MF has provided a set of features that enables software developers to read as well as write 3MF files. 3MF file format is an XML-based data format that comes as a single package same like a zip file containing information about mesh, texture colors, and other information. Lib3MF enables developers to retrieve and modify all the important information about the model elements, thumbnail images, meshes, metadata, and other details. You can also create an empty 3MF document and add custom geometry to it. Here's is an example that shows how software developers can use Lib3MF library to load and save 3MF models inside C++ applications.

How to Load, Modify and Save 3MF Models inside C++ Apps?

#include 
#include 

using namespace Lib3MF;

// Load 3MF model
PModel model = CModel::LoadFromModel("example.3mf");

// Modify model...

// Save modified model
model->SaveToFile("modified.3mf");

 

Convert 3MFs to STL File Format using C++ Library

Lib3MF enables software developers to convert 3D Manufacturing (3MF) files to other supported formats such as STL, PNG, JPG, etc. inside their own C++ applications. To convert 3MFs to STL File Formats, first you need to import a 3D model from a 3MF file, then creates a new file name and export the model to STL file format. Some 3MFs conversion examples are also part of SDK. The following example shows how developers can convert a 3MF File to the STL File Format inside C++ applications.

How to Convert a 3MF File to the STL File Format via C++ API?

#include 
#include 
#include 

int main() {
    // Create a model instance
    Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary();
    Lib3MF::PModel model = wrapper->CreateModel();

    // Load the 3MF file
    model->ReadFromFile("input.3mf");

    // Create the writer instance
    Lib3MF::PWriter writer = model->QueryWriter("stl");

    // Set the export path and write the STL file
    writer->WriteToFile("output.stl");

    // Clean up resources
    writer->Release();
    model->Release();

    return 0;
}
 
 English