Skip to content

About

FreeCAD macro that consolidate Mesh(es) transformations by resetting origins to the document origin without moving geometry. Ideal after Mesh Alignment to bake changes into coordinates.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

MeshResetOrigin


MeshResetOrigin

A FreeCAD macro that consolidates Mesh transformations by resetting each selected mesh's origin to the document (world) origin without moving the geometry. Ideal after Mesh Alignment, to bake the alignment into the coordinates instead of relying on a Placement offset or a parent container.


How it works

Each selected Mesh::Feature is processed like this:

  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 is moved into the position it currently occupies in world space.
  3. Reassign the transformed mesh and reset Placement to identity (0,0,0) / 0°.

The mesh stays exactly where it was on screen, but its origin now coincides with the world origin — the transform lives in the geometry instead of in the Placement property. The whole run is wrapped in a single undo transaction, so one Undo reverts everything.

Objects that aren't meshes, and meshes that live inside a parent container (e.g. App::Part), are skipped with a warning in the Report view. Meshes already at the origin are left untouched.

Requirements

  • FreeCAD >= 1.1.1

FreeCAD < 1.1.1 is not tested yet.

Installation

  1. Download MeshResetOrigin.FCMacro.
  2. In FreeCAD, open Macro → Macros… and note the User macros location path.
  3. Copy MeshResetOrigin.FCMacro into that folder (or paste the file's contents into a new macro of the same name).
  4. The macro now appears in the Macro → Macros… list.
  5. Optionally put the icon into [User_macros_location]/Icons/ and add this folder to your pesonnal icon directory list, so you can use the nice graphic on you menu.
  6. Create a shortcut for the macro in the Mesh toolbar, which can be done via the Tools → Customize menu.

Usage

  1. Select one or more Mesh objects in the tree or the 3D view.
  2. Run the macro (Macro → Macros… → MeshResetOrigin → Execute, or from the toolbar if you assigned it a button).
  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).

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

Example: common use case

A typical workflow: aligning a 3D scan to the world axes so it's easy to work with.

1. Import a 3D scan mesh.

Import a 3D scan mesh

2. Create (or reuse) a reference geometry to align the mesh on — here a new plane.

Create a reference plane Reference plane in place

3. Select both the reference object and the mesh, then go to Edit → Align….

Edit → Align

4. In the alignment split window, place the points: at least 3 points on the face of the mesh you want flat (1), then at least 3 points on the reference face you want to align with (2). Then left-click → Align.

Pick alignment points on both objects

5. The mesh is now aligned — but the transform handles are in a mess. Normally you'd reach for a container or the global + reposition arrow option in the Transform task to keep adjusting the position. It's awkward.

Mesh aligned but the placement is messy

6. Instead, reset the mesh's origin with MeshResetOrigin (here linked from the Mesh workbench toolbar).

Run MeshResetOrigin from the Mesh toolbar

7. The mesh hasn't moved, but its origin is now aligned with the world — convenient for using the Transform task.

Mesh origin aligned with the world

8. Iterate to precisely align the origin as needed — very useful when working with 3D-scan meshes or 3D-printer STL files.

Iterate to refine the alignment

License

Licensed under LGPL v2.

About

FreeCAD macro that consolidate Mesh(es) transformations by resetting origins to the document origin without moving geometry. Ideal after Mesh Alignment to bake changes into coordinates.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages