Tools: geometry creation & editing
Five FreeCAD-backed tools for creating and editing geometry. All take the standard operation envelope; parameters go in operation.parameters. Tools that write files save under the server’s output directory and return the path as output_file.
create_2d_geometry
Section titled “create_2d_geometry”Create 2D geometry using FreeCAD’s Draft workbench: lines, arcs, circles, polygons, rectangles, and text.
| Parameter | Description |
|---|---|
type |
line (default), circle, arc, rectangle, polygon, text |
| geometry params | per type: start/end (line), center/radius (circle, polygon), start_angle/end_angle (arc), width/height (rectangle), position/text/height (text), sides (polygon) |
save |
bool, default false — export the result |
output_format |
dxf (default) or step |
output_name |
filename stem, default draft_<type> |
Returns success, document name, the created_objects list (label + type + type-specific fields), and output_file when saved.
Example — a circle saved to DXF:
{ "operation": { "operation": "create_2d", "parameters": { "type": "circle", "center": [5, 5, 0], "radius": 3.0, "save": true, "output_format": "dxf" } }}create_3d_geometry
Section titled “create_3d_geometry”Create 3D primitives using FreeCAD’s Part workbench, optionally combining the first two with a boolean operation.
| Parameter | Description |
|---|---|
type |
box (default), cylinder, sphere, cone |
| geometry params | width/height/depth (box), radius/height (cylinder), radius (sphere), radius1/radius2/height (cone), position for all |
boolean_operation |
union, difference, or intersection between the first two objects |
save, output_format, output_name |
export; step (default) or stl |
Returns created objects with computed volumes where applicable, plus the boolean result object when requested.
create_parametric_sketch
Section titled “create_parametric_sketch”Create a parametric sketch with constraints using the Sketcher workbench — the foundation of parametric modeling workflows.
| Parameter | Description |
|---|---|
geometry |
list of elements: {"type": "line", "start": [x,y], "end": [x,y]}, {"type": "circle", "center": [x,y], "radius": r}, {"type": "arc", "center", "radius", "start_angle", "end_angle"} |
constraints |
list of {"type": ..., "geometry1": i, "geometry2": j, "point1": p, "point2": q, "value": v} — types: distance, coincident, horizontal, vertical, parallel |
save, output_name |
save as .FCStd, default stem parametric_sketch |
Returns the sketch name, geometry and constraint counts, the created geometry list (with indices you can reference in later constraints), and human-readable descriptions of each applied constraint.
perform_boolean_operations
Section titled “perform_boolean_operations”Advanced boolean operations on existing solids in a file: union, intersection, difference, and split — with validation and error recovery.
| Parameter | Description |
|---|---|
operation |
union (default), intersection, difference, split |
object_indices |
which solids to combine (default: all); at least 2 required |
export, output_format, output_name |
export result; step (default) or stl |
Returns per-operation results: result object name, validity check, volume, surface area, bounds, and the input object labels. Difference subtracts all other selected objects from the first; split uses boolean fragments to partition.
Errors: fewer than 2 solids in the file, fewer than 2 indices, unsupported operation, invalid shape result.
modify_geometry
Section titled “modify_geometry”Advanced modification of existing geometry: fillet, chamfer, shell, draft, mirror, and scale.
| Parameter | Description |
|---|---|
operation |
fillet (default), chamfer, shell, draft, mirror, scale |
target_object |
index into the file’s shape-bearing objects (default 0) |
| per-operation | radius + edge_indices (fillet), distance + edge_indices (chamfer), thickness + face_indices (shell), angle + direction + neutral_plane_z (draft), mirror_plane (XY/XZ/YZ) + mirror_point (mirror), scale_factor + scale_center (scale) |
export, output_format, output_name |
export result; step (default) or stl |
Returns the applied modifications with a per-result analysis block: volume, surface area, shape validity, and bounds. Empty edge_indices on fillet/chamfer applies to all edges.