| Description |
|---|
| Макрос FreeCAD для экспорта плавных 3MF файлов с сохранением всех настроек печати для слайсера и автоматическим рабочим процессом для вашего любимого слайсера. 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 |
| Download |
| Toolbar icon
Macro 3D_Printer_3mf_Workflow 3D_Printer_3mf_Workflow_ConfigIni.FCMacro |
| Links |
| Macros recipes How to install macros |
| Macro Version |
| 00.02 |
| Date last modified |
| 2026-02-14 |
| FreeCAD Version(s) |
| All |
| Default shortcut |
| None |
| See also |
| None |
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/refs/heads/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/refs/heads/main/3D_Printer_3mf_Workflow.FCMacro")
Макрос FreeCAD для экспорта плавных 3MF файлов с сохранением всех настроек печати в слайсере и автоматическим рабочим процессом для вашего любимого слайсера.
Более подробное описание:
https://github.com/2cv001/3D_printer_3mf_workflow/blob/main/README.md
Этот макрос автоматизирует и улучшает процесс 3D-печати от FreeCAD до вашего слайсера, позволяя:
С видимыми гранями
Без видимых граней
Макрос экспортирует выбранные объекты в файл 3MF с использованием указанных параметров тесселяции (LinearDeflection и AngularDeflection). Он создаёт временные сеточные объекты для процесса экспорта и автоматически удаляет их после этого.
Install the macro with the Addon Manager of FreeCAD, then select the objects to print in the tree.
Run the macro from FreeCAD. The slicer path is set directly in the macro’s main dialog, using the dedicated input field.
On first launch, enter your print settings in the slicer and save the .3mf file (generally, except in Cura, this is just Ctrl+S or “Save” in the menu).
On next launches, enjoy automatic reuse of your settings.
Макрос позволяет вам задавать собственные команды, которые будут выполняться автоматически после создания файла 3MF. Эта функция опциональная и может использоваться для автоматизации дополнительных шагов в вашем рабочем процессе, таких как:
The options window lists your commands, each with a checkbox: check the ones to run this time. Commands run before the export are marked "(before the export)".
Предоставлен специальный макрос-помощник, чтобы упростить настройку. Ваши команды сохраняются в .ini файле, который используется в рабочем процессе.
Кнопка ⚙️ в окне опций позволяет как установить, так и открыть макрос конфигурации (3D_Printer_3mf_Workflow_ConfigIni.FCMacro).
Configuration window: the selected command has a mistake (C:/… instead of C:\…), the check points it out before you run it.
Each row of the table is a command:
| Column | Meaning |
|---|---|
| Command | The program and its parameters |
| Label | The name shown in the options window |
| Delay (s) | Time to wait before running the command |
| Enabled by default | Checked in the options window when the macro starts |
| Before the export | Run the command before the export instead of after it |
Hover your mouse over a column title to display help tooltips.
<PLUG_IP>, is selected: just type. Requests made with curl use --fail, so that an error answered by the device is reported as an error.%EXPORT%.3mf, %PROJECTDIR%… (see below), with the quotes and the space when needed. The menu shows the real value of each variable for the current export.copy without cmd /c, part of a template left to replace, unclosed quote, single quotes, > or |, unknown variable, %EXPORT% used before the export;%PROJECT% placed after a folder (use %PROJECTNAME%), a C:/… path given to cmd (write C:\…), a folder that does not exist.curl, the usual errors are explained (device not found, not reachable, error answered, no answer in time).Rules to know:
"%EXPORT%.3mf").copy, del, echo…) need cmd /c in front of them, and >, | or && do not work.%EXPORT% in these commands.Example: a "before" command turns on the Shelly plug, a second "before" command with a 10 s delay sends the preheating to Klipper once the printer has started, then the export begins.
The "before" commands are stored separately in the .ini file (EXTRA_COMMANDS_BEFORE): an older version of the macro ignores them.
Когда вы задаёте собственные команды постобработки в рабочем процессе, то можете использовать три специальных заполнителя. Эти заполнители автоматически заменяются значениями, полученными из вашего проекта FreeCAD.
Заполнители и их значения:
To build a path in another folder, use the names: "C:\Backup\%EXPORTNAME%.3mf", not "C:\Backup\%EXPORT%.3mf".
These examples are also available with Add from a template. Replace the parts between < > with your own values.
Скопируй сгенерированный файл 3MF рядом с проектом:
copy "%PROJECT%.3mf" "%PROJECTDIR%/backup/%PROJECTNAME%.3mf"
On Linux / macOS:
cp "%EXPORT%.3mf" "%PROJECTDIR%/backup/%EXPORTNAME%.3mf"
Запусти скрипт, который хранится в папке проекта:
python "%PROJECTDIR%/scripts/postprocess.py" "%PROJECT%.3mf"
Open the project folder (Windows):
explorer "%PROJECTDIR%"
Отправьте HTTP-запрос, используя имя проекта:
Включи умную розетку Shelly Gen 1
Gen 1 with a password (restricted login):
curl --fail -u <USER>:<PASSWORD> "http://<PLUG_IP>/relay/0?turn=on"
Gen2
Или если на вашем устройстве есть пароль:
curl -u admin:yourpassword "http://192.168.xxx.xx/rpc/Switch.Set?id=0&on=true"
Through the Shelly cloud (server address and authorization key in the Shelly app: User settings → Authorization cloud key; device ID in the device settings):
curl --fail -X POST "https://<CLOUD_SERVER>/device/relay/control" -d "channel=0&turn=on&id=<DEVICE_ID>&auth_key=<API_KEY>"
Home Assistant (long-lived access token created in your Home Assistant profile):
curl --fail -X POST -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" -d "{\"entity_id\":\"switch.<PLUG_NAME>\"}" "http://<HOME_ASSISTANT_ADDRESS>:8123/api/services/switch/turn_on"
Jeedom (API key in Settings → System → Configuration → API; command ID shown in the advanced configuration of the command):
curl --fail "http://<JEEDOM_ADDRESS>/core/api/jeeApi.php?apikey=<API_KEY>&type=cmd&id=<COMMAND_ID>"
Preheat the bed of a Klipper printer to 60 °C (Moonraker):
curl --fail -X POST "http://<PRINTER_IP>:7125/printer/gcode/script?script=M140%20S60"
Keep your keys and passwords for yourself: they are stored in clear text in the .ini file.
Select one or more objects (Ctrl+click in the tree) and run the macro. All the selected objects go into a single 3MF, each one as a separate object in the slicer, with its own print settings.
The top right corner of the options window shows a small isometric image of the selected objects, with their colors (for a PartDesign Body, the color of its visible feature), so you can check what will be exported. It is drawn by the macro from a very coarse mesh, without OpenGL, in a few hundredths of a second; the document and the 3D view are not touched.
The 3MF file for print parameters list chooses the 3MF whose print settings and objects are reused:
Each 3MF of the list shows its thumbnail: the preview image saved in the file by the slicer (plate image for QIDIStudio / Bambu / Orca, thumbnail for Cura / SuperSlicer / FreeCAD). It is only read from the file, so it costs nothing; a 3MF without a preview image simply has no thumbnail.
Below the list, the macro shows the name the 3MF will be saved as and explains what the chosen base will do: for which objects the existing settings are kept, which objects are new (they get the general settings), and whether the base has no slicer settings at all. The text turns orange when object settings may not be reused (no object of the base has a selected name, or "No base" while the 3MF of the selection exists). The base file itself is never modified; if the 3MF of the selection already exists and another base is chosen, it is backed up first (.old file).
From the base, the macro always keeps the general settings: printer, filament (type, temperatures, cooling… and all the filaments of a multi-color printer) and print profile (layer height, speeds, walls, default infill and supports…). The settings of an object (its own infill, walls, layer height, supports, filament, modifiers…) are kept only for the objects matched by name. Objects of the base that match no selected object are removed; new objects get the general settings and the first filament.
Some print settings are attached to specific faces of an object: enforced or blocked supports, seams, colors (and other per-face data). They, as well as modifiers and extra parts, are tied to the old geometry and cannot be kept when it changes. If some would be lost, the macro tells you which objects are concerned and asks you to Continue or Cancel (the 3MF is then left unchanged).
Objects whose geometry has not changed in FreeCAD since the last export are left exactly as they are in the slicer: their settings applied to faces, modifiers, copies and position are all kept, and the warning only lists the objects that really changed. For example, with Housing_Lid.3mf, modifying only the Housing keeps the enforced supports of the Lid. (Changing the precision or the angular tolerance changes the mesh, so all objects are then replaced. With Do not recover slicer position/rotation checked, all objects are replaced and placed as in FreeCAD.)
Very small values make the mesh huge, and FreeCAD is frozen while it is computed. Before meshing, the macro quickly estimates the number of triangles and the time needed (from a few coarse test meshes, in less than a second). If the mesh would take more than about 30 seconds or have more than a million triangles, it asks first: Continue or Back to options to choose coarser values.
The Mesh fineness panel of the options window holds the Precision (LinearDeflection, in mm) and the Angular tolerance (AngularDeflection, in degrees); their tooltips explain them. On the right, Export time shows the estimated time for the selected objects, with the number of triangles and the 3MF size below. It is computed when the window opens and updated live while you change the values; it turns orange above the warning limits.
Optimize fineness chooses the finest precision and angular tolerance whose estimated export fits in the Target export time (remembered between sessions), keeping the ratio between the two values. It never goes below 0.01 mm and 2°: below that, the printed part does not change (0.4 mm nozzle, 0.1 to 0.2 mm layers), only the file and the time grow. You can still type finer values yourself.
The time estimate adjusts itself to your computer: after each export, the real meshing time is compared with the estimate and a correction factor is kept in the .ini file.
The 3MF is named after the selected objects' visible names (their Label in the FreeCAD tree), sorted alphabetically and joined with _, in the same directory as the saved FreeCAD document. For example, selecting Housing creates Housing.3mf and, if enabled, Housing.stl; selecting Lid and Housing (in any order) creates Housing_Lid.3mf. Very long names are shortened and get a unique suffix. Each set of objects has its own 3MF print settings and backups.
For a PartDesign Body, selecting a face or edge in the 3D view, or a feature such as a Pad or Pocket in the tree, exports the whole Body using the Body's Label. Selecting several features of the same Body still counts as one object. Objects outside a Body retain their own labels and geometry.
Filename-incompatible characters are replaced with underscores. Names that collide within the document (including after sanitizing or ignoring letter case) receive the object's internal name as a suffix. Workflow backup/temporary suffixes and Windows device names are also adjusted to avoid conflicts. Use distinct, stable labels: renaming an object changes its export filename. Objects from different documents in the same folder should also have distinct labels.
Existing exports named after the project are not renamed automatically. To reuse their print settings, choose the old .3mf in the 3MF file for print parameters list (or with Browse…) on the first export of a part. Save subsequent slicer changes in that part's new .3mf file.
Each selected object becomes one object in the slicer; the macro does not split individual contours of a sketch or solids inside a single selected object (use "Split to objects" in the slicer if needed).
The slicer path must be the slicer program itself (on Windows, its .exe file): a part file such as a .3mf or .stl is refused. On Windows, the Browse… button of the slicer line only lists programs, so that it is not confused with the Browse… button of the base 3MF.
Этот макрос является преемником macro 3d_printer_workflow.
Макрос 3D_Printer_Workflow уже мог создавать плавные экспорты без граней. Его главным ограничением было то, что он работал только с файлами STL, которые не могут хранить параметры слайсера или печати.
Этот макрос использует файлы .3mf, что позволяет сохранять все настройки печати и повторно их использовать.
Чтобы сохранить основную функциональность предыдущего макроса, эта версия также предлагает экспорт в STL с настраиваемыми параметрами тесселяции, позволяя создавать гладкую сетку так же, как раньше.
Больше деталей по ссылке https://github.com/2cv001/3D_printer_3mf_workflow
Английский : https://forum.freecad.org/viewtopic.php?t=102503
Французский : https://forum.freecad.org/viewtopic.php?t=103419
ver 00.07 2026/11/26 by 2cv001 3D_Printer_3mf_Workflow.FCMacro