Macro MeshResetOrigin

Macro MeshResetOrigin

Description
Consolidates Mesh transformations by resetting each selected mesh's origin to the document (world) origin, without moving the geometry. Ideal after using an alignment tool (e.g. Mesh Alignment), to bake the alignment into the vertex coordinates instead of relying on a Placement offset or a parent container.

Macro version: 0.2
Last modified: 2026-06-09
FreeCAD version: 1.1.1 (<1.0 should work but not tested)
Download: ToolBar icon
Author: de-seingalt
Author
de-seingalt
Download
ToolBar icon
Links
Macro Version
0.2
Date last modified
2026-06-09
FreeCAD Version(s)
1.1.1 (<1.0 should work but not tested)
Default shortcut
None
See also
None

Description

Macro MeshResetOrigin is a macro that consolidates Mesh transformations by resetting each selected mesh's origin to the document (world) origin, without moving the geometry. It is meant to be used after an alignment operation (e.g. Edit → Align To… on Mesh objects), to bake the resulting alignment into the mesh coordinates rather than keeping it as a Placement offset or relying on a parent container.

Each selected Mesh::Feature is processed as follows:

  1. Read its current Placement (the transform that positions it in the world).
  2. Apply that placement matrix to a copy of the mesh, so every vertex moves into the position it currently occupies in world space.
  3. Reassign the transformed mesh and reset the Placement property to identity (0,0,0 / 0°).

The mesh does not move on screen; only its origin now coincides with the world origin, since the transform lives in the mesh geometry instead of in the Placement property. The whole operation is wrapped in a single undo transaction, so one Undo reverts everything.

Objects that are not meshes, and meshes that live inside a parent container (e.g. App::Part), are skipped with a warning printed to the Report View. Meshes already at the origin are left untouched.

Location

Mesh workbench (external/optional macro).

Usage

  1. Select one or more Mesh objects in the tree view or the 3D view.
  2. Run the macro.
  3. Each mesh's origin is reset to the world origin; the geometry does not move.
  4. Check the Report view for a per-mesh summary (reset / already at origin / skipped).

If a mesh is inside an App::Part, drag it out of the container first, then run the macro.

Example

A typical workflow is aligning a 3D scan mesh to the world axes to make it easier to work with:

  1. Import a 3D scan mesh.
  2. Create (or reuse) a reference geometry to align the mesh on, for example a plane.
  3. Select both the reference object and the mesh, then go to Edit → Align To….
  4. Pick at least 3 points on the face of the mesh to flatten, then at least 3 points on the reference face to align with, then click Align.
  5. The mesh is now aligned, but the Placement/transform is no longer trivial to work with.
  6. Run MeshResetOrigin on the mesh: it does not move, but its origin is now aligned with the world.
  7. Iterate as needed to refine the alignment — particularly useful when working with 3D-scan meshes or 3D-printer STL files.

A step-by-step illustrated walkthrough is available on the GitHub repository.

Notes

License

Licensed under LGPL v2.

Download


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/de-seingalt/MeshResetOrigin/main/MeshResetOrigin.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/de-seingalt/MeshResetOrigin/main/MeshResetOrigin.FCMacro")