to_freecad
Generate an editable parametric FreeCAD macro for a simple part from a mesh, with the macro checked against the source geometry before it is written.
Instructions
Write an editable parametric FreeCAD macro (.FCMacro) for a simple part.
Same parts as to_cadquery: a box/plate base with rectangular pads, holes and bosses along X, Y, or Z (countersink, draft, and chamfer only when the axis is vertical), one radius on the four vertical corners, edge_fillet_r when every edge of the box shares one radius (a through-hole that clears those rounds is cut after the fillet, and a straight boss that clears them is fused after it), fillet_r on every vertical edge of an L-bracket including the inner corner (leg_x, leg_y), through-holes in the foot and the upright of that bracket (base_hole_N_d, leg_hole_N_d), a row, axis-aligned grid, or bolt circle of plain Z through-holes (hole_row_1_n, hole_row_1_pitch, hole_grid_1_nx, hole_circle_1_n, hole_circle_1_r), a straight obround through-slot along Z (slot_1_len, slot_1_w, slot_1_angle), a quarter-torus fillet on a vertical boss or hole (boss_N_fillet, hole_N_rim_r, hole_N_floor_r), a straight extrusion of a 2D outline (straight round bosses on the top face of a Z extrusion are boss_N_d, boss_N_h, boss_N_x, boss_N_y; a vertical countersink on that Z extrusion is hole_N_csk_d and hole_N_csk_angle; vertical corners of that Z extrusion that share one radius are outline_fillet_r), and a small boolean of those extrusions. Parameter names match the CadQuery script (hole_1_d, hole_row_1_n, hole_circle_1_r, slot_1_len, boss_1_h, fillet_r, edge_fillet_r, leg_x, base_hole_1_d, boss_1_fillet, extrude_len, ...). Edit one and run the macro in FreeCAD, or with freecadcmd. Returns the parameters, whether freecadcmd verified the macro against the mesh, and the measured deviation when it did. Without freecadcmd the same deviation and volume check is run with CadQuery, or with OpenSCAD when CadQuery is not installed. The macro is written only when that check passes, and verified is false because FreeCAD did not measure it. Returns an "error" key when the part is outside that vocabulary or the check refuses.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"input_path": "<input_path>"
},
"name": "to_freecad"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tol | No | ||
| input_path | Yes | ||
| output_path | No |