Macro 3D Printer 3mf Workflow

Macro_3D_Printer_3mf_Workflow

Description
FreeCAD macro exporting smooth 3MF files and preserving all slicer print settings, with automatic workflow to your preferred slicer.

Macro version: 00.02
Last modified: 2026-02-14
FreeCAD version: All
Download: Toolbar icon

Macro 3D_Printer_3mf_Workflow 3D_Printer_3mf_Workflow_ConfigIni.FCMacro
Author: 2cv001

Author
2cv001
Download
Toolbar icon

Macro 3D_Printer_3mf_Workflow 3D_Printer_3mf_Workflow_ConfigIni.FCMacro

Links
Macro Version
00.02
Date last modified
2026-02-14
FreeCAD Version(s)
All
Default shortcut
None
See also
None

Description

FreeCAD macro exporting smooth 3MF files and preserving all slicer print settings, with automatic workflow to your preferred slicer.

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro


# This code is copied instead of the original macro code
# to guide the user to the online download page.
# Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki
# or if the RAW code URL is somewhere else in the wiki.

from PySide import QtGui, QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,
    "Information",
    "This macro must be downloaded from this link\n"
    "\n"
    "https://raw.githubusercontent.com/2cv001/3D_printer_3mf_workflow/main/3D_Printer_3mf_Workflow.FCMacro" + "\n"
    "\n"
    "Quit this window to access the download page")

diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()

import webbrowser 
webbrowser.open("https://raw.githubusercontent.com/2cv001/3D_printer_3mf_workflow/main/3D_Printer_3mf_Workflow.FCMacro")
<class="rawcodeurl"><a href="https://raw.githubusercontent.com/2cv001/3D_printer_3mf_workflow/main/3D_Printer_3mf_Workflow.FCMacro">raw code</a>


More detailed description:

https://github.com/2cv001/3D_printer_3mf_workflow/blob/main/README.md

Purpose

This macro automates and enhances the 3D printing workflow from FreeCAD to your slicer by:

This macro is the successor to macro 3d_printer_workflow.

The 3D_Printer_Workflow macro was already capable of producing smooth, facet‑free exports. Its main limitation was that it relied on STL files, which cannot store slicer or printing parameters.

This macro uses .3mf files, allowing all print settings to be saved and reused.

To retain the core functionality of the previous macro, this version also provides an STL export option with adjustable tessellation parameters, allowing smooth mesh generation just like before.

Limitation

The current version can export only a single object, but you can work around this by using links — for example, a Simple Group — to combine multiple objects into one.

Principle of smoothing

With visible facets

Without visible facets

The macro exports the selected objects to a 3MF file using the specified tessellation parameters (LinearDeflection and AngularDeflection). It generates temporary mesh objects for the export process and automatically removes them afterward.

Launching other programs or commands

The macro allows you to define custom commands that will be executed automatically after the 3MF file is generated. This feature is optional and can be used to automate additional steps in your workflow, such as:

Principle diagram

Setup

A dedicated helper macro is provided to make configuration easy. Your commands are stored in an .ini file used by the workflow.

The ⚙️ button in the options window allows you to both install and open the configuration macro (3D_Printer_3mf_Workflow_ConfigIni.FCMacro).

Macro_3D_Printer_3mf_workflow capture écrant

Using %PROJECT%, %PROJECTDIR%, and %PROJECTNAME% in user commands

When you define custom post‑processing commands in the workflow, you can use three special placeholders. These placeholders are automatically replaced by values derived from your FreeCAD project file.

Available placeholders

Placeholders and their meaning:

Examples

Copy the generated 3MF file next to the project :

copy "%PROJECT%.3mf" "%PROJECTDIR%/backup/%PROJECTNAME%.3mf"

Run a script stored in the project folder :

python "%PROJECTDIR%/scripts/postprocess.py" "%PROJECT%.3mf"

Send an HTTP request using the project name :

curl "http://myserver/api/start?job=%PROJECTNAME%"

Turn on a Shelly smart plug Gen 1

curl "http://192.168.xxx.xxx/relay/0?turn=on"

Gen2

http://192.168.xxx.xxx/rpc/Switch.Set?id=0&on=true

Or if your device have a password :

curl -u admin:yourpassword "http://192.168.xxx.xx/rpc/Switch.Set?id=0&on=true"

Usage

More details at https://github.com/2cv001/3D_printer_3mf_workflow

Discussion

English : https://forum.freecad.org/viewtopic.php?t=102503

French : https://forum.freecad.org/viewtopic.php?t=103419

Script

ToolBar Icon

Code

ver 00.02 2026/02/14 by 2cv001 3D_Printer_3mf_Workflow.FCMacro

Download