Milling know-how
Recreate a part from photos or an STL: AI to a parametric STEP file
In short: put the part on graph paper, photograph it straight from above and from two or three more angles, measure the dimensions that matter with calipers, and give photos and measurements to an AI agent (such as Claude or ChatGPT) that drives a CAD program like FreeCAD, Autodesk Fusion or SolidCraft over an MCP server. It builds the part with named parameters – you get a STEP file and a model you can change with a sentence ("hole 8 instead of 6 mm").
For many replacement and utility parts this is faster than 3D scanning: brackets, adapters, covers, plates with holes and pockets. Instead of a triangle mesh that is hard to change, you get a real CAD model with a feature tree. And because step2gcode has its own MCP server, the same agent can then turn the part straight into finished G-code for the mill.
Two starting points, one goal: if all you have is the part itself – say a broken spare part with no file at all – go via photos. If you have an STL or 3MF file instead (from 3D printing, Printables or an old export), the agent can measure the mesh directly: slice it at several heights, recognise circles and planes and derive sketches, extrusions and holes from them. Both routes end in the same parametric model.
Connect the step2gcode MCP server to your agent: to the setup →
From photo to milled part in six steps
- Lay the part flat on graph paper and photograph it straight from above – from a distance with some zoom rather than up close, so perspective does not distort the dimensions.
- Take two or three more photos: from the side (for heights and steps) and at an angle (so the agent recognises pockets, chamfers and cut-outs).
- Measure the dimensions that matter – hole diameters and spacing, wall thicknesses, fits – and write them down as a list.
- Give photos and the list to an AI agent that drives your CAD program over an MCP server (or a Python script), and ask for a parametric model with named dimensions.
- Check the result: overlay the model on the photo or print a test piece, have deviations corrected with a sentence, then export STEP.
- Upload the STEP file to step2gcode – or let the agent generate the G-code directly through the step2gcode MCP server.
The ready-made prompt to copy
Copy this text into Claude, ChatGPT or another agent and add your photos or STL. It walks you through setting up the CAD program, asks where photos or mesh are not enough (cross-section, holes, threads), has you confirm, and checks the result itself. Tried on the STL route: every mesh vertex of a recreated flange lay on the model, and changing "hole 14 instead of 12 mm" was one value in the parameter table.
You are helping me recreate a part as a parametric CAD model and export it as a STEP file. Work through the following phases and only move on when the previous one is done. Rather ask once too often than guess a dimension. 1. Starting point - Ask what I have: photos of the part (ideally on graph paper), an STL or 3MF file, or both. - Ask what the part is for (replacement part, bracket, fit to something existing), what material it is made of and how it will be made (milling, 3D printing). - Ask which CAD program I use or want to use (FreeCAD, Autodesk Fusion, SolidCraft, Onshape) and my operating system. 2. Set up the tools - Check whether you can drive the CAD program through MCP tools. If so, test the connection with a small cube and delete it again. - If not: look up the current state of the MCP server for my program (project page or the vendor's help) and walk me through installing it and adding it to my AI client step by step – one step per message, and wait for my reply. Remind me to restart the client, then check that the tools are there. - If MCP does not work or my client cannot use MCP servers: continue with scripts (for example a FreeCAD Python macro as a file that I start via Macro › Execute) and have me send you the output. - For an STL, Python with numpy is enough. If you have no execution environment of your own, give me the script and tell me how to run it. 3. Inventory - With photos: determine the scale from the squares. Describe what you recognise – outline with dimensions, heights and steps, holes (diameter, position, through or blind, thread), pockets, chamfers, fillets, symmetries – and state for each dimension how sure you are. - With an STL: read the file and report overall size, likely unit, number of bodies and whether the mesh is closed. Slice it at every height step, fit lines and circles and list holes (diameter, centre, depth), steps, pockets and radii. Keep in mind: the mesh vertices lie on the true surface, the triangles between them inside – a circle fitted through all section points comes out slightly too small. Round to sensible values and say where you rounded. 4. Ask instead of guessing - Make a short measuring list with only what you cannot read reliably or what has to fit: which dimension, where exactly, with what (calipers, depth gauge, radius gauge, thread gauge) – or which additional photo you need (side, underside, angled, with a ruler in frame). - Ask about fits (shaft, bearing, screw), threads and desired clearance. Wait for my answers. 5. Confirm - Summarise the part as a list of basic shapes and dimensions and ask whether it is right. Only model after my yes. 6. Model parametrically - Create every important dimension as a named parameter (spreadsheet or user parameters) and build the part from sketches, extrusions, holes, chamfers and fillets – holes as real hole features. - Work in small steps and check after each step that the solid is valid. 7. Check and export - With an STL: measure the distance from every mesh vertex to the model (maximum and mean) and name any spots above 0.1 mm. The model standing out by the mesh's chord height on curved faces is correct. With photos: compare outline and hole positions with the top-view photo. - Export a STEP file and tell me all parameters with their values and how to change them. 8. Optional: G-code - If I want to mill the part and the step2gcode MCP server is connected (setup: step2gcode.com/en/mcp), generate the milling program with it and show the preview. Remind me to check toolpaths, depths and feeds before running it on the machine. Be honest about accuracy: from photos about ±0.5 mm is realistic – anything that has to fit comes from my measurements.
The agent cannot install an MCP server by itself – you add it to your AI client and restart, it tells you how. Without MCP (say in the browser) it writes macros that you run in FreeCAD.
When it is worth it – and when it is not
Prismatic parts suit it well: plates, angles, brackets, adapters, housing lids, spacers, parts with holes, pockets, chamfers and fillets. They can be described with a few basic shapes, and that is exactly what an agent can reliably turn into sketches, extrusions and holes.
Honest about accuracy: from photos alone, about ±0.5 mm is realistic, depending on camera and perspective. For anything that has to fit – holes for shafts, bearing seats, snap fits – measure with calipers and state the values explicitly. Freeform surfaces (handles, organic shapes) and tolerances below about 0.2 mm are not a case for photos; a 3D scan helps more there.
Photos an agent can work with
The graph paper is the scale: the agent counts squares instead of guessing. Shoot straight down, with even light without hard shadows, and leave paper visible all around. A ruler or calipers in the frame helps too.
Several views instead of one perfect photo: top for the outline, side for heights and steps, angled for the depth of pockets and chamfers. For parts with an underside, turn them over once. Add what you know ("the four holes are M4 clearance, 30 mm apart") – it saves questions.
Which CAD program, which route (as of November 2026)
FreeCAD (free, open source): the most widely used MCP server is "freecad-mcp" by neka-nat (MIT licence). An add-on in FreeCAD starts a local server, and in the Claude Desktop client you add "uvx freecad-mcp". The agent can create documents and objects and run any Python code inside FreeCAD – which opens up the whole Part and PartDesign world. It also works without MCP: the agent writes a FreeCAD Python macro and you run it.
Autodesk Fusion: Autodesk ships its own local MCP server. It is switched on in Fusion under Preferences › General › API › "Fusion MCP Server" and runs while Fusion is open. Claude Desktop has the "Autodesk Fusion" connector for it; other clients connect to the local address given in Autodesk's help.
SolidCraft: a new, free open-source CAD program (MIT/Apache-2.0, written in Rust) getting a lot of attention as a Fusion-like alternative. It runs on Windows, macOS, Linux and in the browser, reads and writes STEP and comes with its own MCP server ("solidcraft-cli mcp", in Claude Code for example with "claude mcp add solidcraft -- solidcraft-cli mcp"). Its developers call it "early but usable for simple parts" – which fits brackets and adapters.
Onshape: PTC offers no official MCP server, but several community projects work through the Onshape API and need API keys. If you already work in Onshape, that gets you there too.
The agent itself: Claude (Desktop, Claude Code) and ChatGPT can read photos; MCP servers are easiest to connect in Claude Desktop or Claude Code. A clear task with measurements matters more than the model.
How to phrase the task
Easiest with the ready-made prompt above: it tells the agent to create dimensions as named parameters, make holes real holes and export a STEP file at the end – and to ask instead of guessing. Only add what you already know: square size of the paper, measured dimensions, purpose of the part.
Have the agent first describe what it recognises in the photos and confirm it – that keeps it from reading a pocket as a cut-out. Then it works in small steps and you correct early.
Only an STL? The agent measures the mesh
An STL file is just a triangle mesh – no dimensions, no holes, no feature tree. But it contains the geometry, and an agent can analyse it with a few lines of Python (for example with the trimesh or numpy-stl libraries, or directly in FreeCAD's Mesh module): it slices the mesh at different heights, recognises and fits lines and circles in each section, reads steps and pocket depths from the horizontal faces, and diameter, position and depth of every hole from the cylinders. From these numbers it rebuilds the part just like with photos – only more precisely, because with a clean CAD export the fitted dimensions are usually accurate to a hundredth of a millimetre.
This is the route when "Mesh to STEP" on step2gcode reaches its limits: the page converts clean meshes straight into surfaces, but for scans and freeform shapes it delivers a faceted body or reports where the reconstruction is not exact. The agent, on the other hand, recognises the intent behind the shape – "this is an M5 clearance hole, that a 3 mm chamfer" – and builds it as a real feature. You end up with a model you can change, not a surface that merely matches.
The ready-made prompt above covers this route too: inventory with sections and fitted circles, rounding to sensible values (5.99 mm becomes 6 mm) and, at the end, the model's deviation from the mesh. That is the most important sentence – it shows whether the agent missed something. The right way to measure is from the mesh vertices to the model: the vertices lie on the true surface, the triangles between them inside, so on curved faces the model stands out by the chord height.
Two notes: meshes from 3D printing are almost always in millimetres, but the unit is not stored – have it confirmed. And for files from the internet, the creator's licence also applies to the rebuild.
Parametric means: change it with a sentence
The real gain over a scan: the model knows its dimensions. "Make the plate 5 mm thicker", "holes to M5", "slot instead of a hole" – the agent changes the parameter and the model rebuilds. A replacement part quickly becomes an improved version.
From the model to the mill
Upload the STEP file to step2gcode: pockets, holes and contours are recognised with their depths, you pick cutter and material and download G-code for GRBL, Mach3, LinuxCNC and other controllers. If you use the agent anyway, also connect the step2gcode MCP server – then the same agent turns the part it just built straight into the milling program, shows the preview and downloads it on request.
And if you already have a mesh (STL or 3MF)? For simple, clean meshes exported from CAD, "Mesh to STEP" on step2gcode converts directly – often that is enough for milling. If you want an editable model, or the page reports a reconstruction that is not exact, have the agent measure the mesh and rebuild the part (see above).
Frequently asked questions
Can an AI turn a photo into a STEP file?
Yes, for prismatic parts: an AI agent like Claude or ChatGPT reads photos on graph paper and, over an MCP server, drives a CAD program like FreeCAD, Autodesk Fusion or SolidCraft that writes the STEP file. Measure important dimensions with calipers and give them to the agent.
How accurate is a part recreated from photos?
From photos alone about ±0.5 mm, depending on camera and perspective. Measure fits such as holes, wall thicknesses and spacing with calipers and give them to the agent – then they are exact.
Which CAD program is suitable?
FreeCAD (free, MCP server "freecad-mcp"), Autodesk Fusion (official local MCP server), SolidCraft (free, open source, own MCP server) or Onshape (community MCP servers). Without a licence, FreeCAD or SolidCraft is the easiest start.
Can an AI turn an STL file into a parametric CAD model?
Yes. An AI agent reads the STL with Python, slices the mesh at several heights, fits circles and planes and so recognises holes, steps and pockets with their dimensions. It then rebuilds the part over an MCP server in FreeCAD, Fusion or SolidCraft as a parametric model and exports a STEP file. With clean CAD exports the dimensions are usually accurate to a hundredth of a millimetre.
Do I need instructions for every CAD program?
No. The ready-made prompt in this article has the agent look up the current state of the MCP server for your program and walk you through the setup step by step. All you do yourself is add it to your AI client and restart; without MCP the agent writes macros that you run.
Do I need a 3D scanner for this?
Not for brackets, adapters, plates and similar parts – photos on graph paper and a few measured dimensions are enough. A scanner pays off for freeform surfaces and very tight tolerances.
Can I change the recreated part afterwards?
Yes, if you ask for a parametric model: every dimension is a named parameter and the agent changes it on request. That is the big difference to an STL mesh.
How do I get from the model to G-code?
Upload the STEP file to step2gcode, pick cutter and material, download the G-code – or connect the step2gcode MCP server in the same agent and have the program generated directly.