#4814 Google Gemini w/FreeCAD
#4814 Google Gemini w/FreeCAD
#4814 Can Google Gemini models work with FreeCAD
Google Gemini models can work with FreeCAD.FreeCAD, Part, Sketcher, Draft), Gemini can interact with it across several workflows.
Common Integration Methods
AI Workbenches & In-App Chat Plugins
freecad-aiWorkbench: An open-source workbench that adds an in-app chat dock inside FreeCAD.It connects directly to Gemini via Google AI API endpoints. You describe what you need in plain text, and it generates and executes the corresponding Python commands directly in your active FreeCAD session. MCP Integrations (
mcp-freecad): FreeCAD addons leveraging the Model Context Protocol (MCP) enable Gemini models to control FreeCAD primitives, inspect documents, and manipulate models over an RPC or local bridge.
Automated Macro & Script Generation
Gemini can generate complete standalone macros (
.FCMacroscripts) or Python console snippets using FreeCAD modules (import FreeCAD as App,import Part).Useful for procedural tasks such as:
Building parametric shapes (flanges, gears, brackets, custom mounting plates).
Automating repetitive operations (batch fillet/chamfer, array patterns, recurring cutouts).
Converting point clouds or CSV coordinates into 3D wireframes or splines.
Multimodal 2D-to-3D Geometry Reconstruction
Using Gemini's visual processing capabilities, you can upload dimensioned 2D engineering drawings (PDF, PNG, or schematics) and prompt the model to extract the spatial dimensions and output the
PartDesignorPartPython script necessary to construct the 3D model.
Headless FreeCAD Automation Pipelines
By pairing the Google GenAI SDK with a headless FreeCAD installation (
FreeCADCmdor embeddingfreecadinside a Python script), Gemini can act as an orchestration agent that parses natural-language design briefs, outputs Python code, executes it headlessly in FreeCAD, and exports standard exchange files like STEP, IGES, or STL.
Minimal Python Macro Example
This snippet can be generated by Gemini and pasted directly into FreeCAD's built-in Python console or Macro Editor to build a parametric mounting plate:
import FreeCAD as App
import Part
doc = App.ActiveDocument or App.newDocument("GeminiPart")
# Define parametric variables
length = 100.0
width = 60.0
thickness = 8.0
hole_radius = 4.0
hole_offset = 10.0
# Base plate primitive
plate = Part.makeBox(length, width, thickness)
# Generate mounting holes
positions = [
(hole_offset, hole_offset),
(length - hole_offset, hole_offset),
(hole_offset, width - hole_offset),
(length - hole_offset, width - hole_offset),
]
for x, y in positions:
hole = Part.makeCylinder(
hole_radius, thickness + 2, App.Vector(x, y, -1), App.Vector(0, 0, 1)
)
plate = plate.cut(hole)
feature = doc.addObject("Part::Feature", "MountingPlate")
feature.Shape = plate
doc.recompute()
Practical Considerations
Topological Naming Problem: If asking Gemini to chain complex boolean cuts and subsequent edge fillets/chamfers in
PartDesign, specify references clearly or use primitive boolean CSG in thePartworkbench to avoid topological naming reference breaks.API Version Shifts: Specify which FreeCAD version you are targeting (e.g., FreeCAD 0.21 vs 1.0+) in your prompt context, as modules like
Sketcherand constraint syntax have evolved.
Provide 25 useful prompts for FreeCAD Workbench in-app chat dock
Parametric Modeling & Primitives
Standard Mounting Plate:
"Create a parametric aluminum mounting plate using the Part workbench: 120 mm length, 80 mm width, 6 mm thickness, with four 5 mm clearance holes inset 10 mm from each corner."Circular Bolt Flange:
"Generate an annular flange with an outer diameter of 150 mm, an inner bore of 75 mm, and a thickness of 12 mm. Add an 8-hole radial bolt pattern on a 115 mm pitch circle diameter with 6.5 mm through-holes."Parametric NEMA 17 Faceplate:
"Model a NEMA 17 stepper motor mounting bracket: 42.3 mm square body, 22 mm center locator cutout, and four M3 clearance holes spaced 31 mm center-to-center."Counterbored Fastener Cutouts:
"Cut four counterbored holes through the top face of the selected solid for standard M4 socket head cap screws (4.5 mm through-hole, 8.0 mm counterbore diameter, 4.4 mm counterbore depth)."Parametric Enclosure Base:
"Build a hollow electronics enclosure base: outer dimensions 100 x 60 x 30 mm with a uniform 2.5 mm wall thickness, filleted outer vertical corners of radius 4 mm, and four internal M3 screw standoffs of 10 mm height in the corners."
Sketcher & PartDesign Operations
Fully Constrained Centered Rectangle:
"Create a new sketch on the XY_Plane attached to the active Body. Draw a centered rectangle constrained symmetrically across both axes with length = 90 mm and width = 50 mm."Hexagonal Bore Sketch:
"Add a sketch on the active body's top planar face. Draw a regular hexagon centered at (0, 0) inscribed in a 24 mm diameter circle, fully constrained with one horizontal edge, and perform a 15 mm pocket cut."Padded Boss with Draft Angle:
"Create a circular sketch with a 30 mm diameter on the active body and extrude a Pad 40 mm high with a 2-degree outward draft angle."Helical Thread / Spring Sweep:
"In PartDesign, create a helical coil spring: wire diameter 3 mm, outer spring diameter 25 mm, pitch 6 mm, and total height 45 mm using a circular sketch swept along a helix."Shaft Keyway Cutout:
"On the cylindrical surface of the selected 20 mm shaft, create a standard parallel keyway cut: width 6 mm, depth 3.5 mm, and length 25 mm ending 5 mm before the shaft face."
Batch Modifications & Edge Treatments
Batch Fillet Selection:
"Find all external vertical edges of the selected object that are parallel to the Z-axis and apply a uniform 3.0 mm fillet to them."Perimeter Chamfering:
"Apply a 45-degree, 1.5 mm chamfer to the top perimeter edges of the active solid without chamfering internal hole features."Linear Array of Slots:
"Create a linear pattern cutting 6 ventilation slots along the X-axis: each slot 40 mm long, 4 mm wide with rounded ends, spaced 8 mm center-to-center through the selected 3 mm sheet."Polar Array Feature:
"Take the pocket feature named 'Pocket001' and create a polar pattern of 6 instances evenly distributed across 360 degrees around the Z-axis."Mirror Symmetry Across Plane:
"Mirror the selected body features across the YZ reference plane to produce a unified, symmetrical solid."
Assembly, Inspection & Metadata
Center of Mass and Inertia Audit:
"Calculate and print the volume, surface area, center of mass coordinates, and moments of inertia for the active solid, assuming an aluminum 6061-T6 density of 2.70 g/cm³."Bounding Box Calculation:
"Determine the minimum axis-aligned bounding box (X, Y, Z extents) of the entire document hierarchy and print the required raw stock billet dimensions with a 3 mm safety margin."Interference & Clearance Check:
"Check for geometric collisions and mutual interference between 'Part_A' and 'Part_B'. If an intersection volume exists, highlight the overlapping region as a temporary visual shape."Standard Hardware Placement:
"Insert an ISO 4014 M6 x 35 mm hex head bolt from the Fasteners workbench and align its shank axis to the selected hole axis on the active plate."Spreadsheet-Driven Parameter Binding:
"Create a FreeCAD Spreadsheet named 'Parameters' with cells for 'Length' (100 mm), 'Width' (50 mm), and 'Thickness' (5 mm), and bind these cells to the dimensions of the active PartDesign sketch and pad."
Export, 2D Drafting & Mesh Processing
Automated Orthographic TechDraw Page:
"Create a new TechDraw page using the standard A4 Landscape ANSI template. Insert an orthographic projection group (Front, Top, Right, and Isometric views) of the active model at a 1:2 scale."TechDraw Basic Dimensioning:
"Add overall width, height, and depth linear dimensions to the primary orthographic view on the existing TechDraw page."Headless STEP and IGES Batch Export:
"Export all visible Part features in the current document as individual AP214 STEP files into a subfolder named 'exports/', formatted as '[ObjectName]_[Timestamp].step'."Fine Mesh Tessellation for 3D Printing:
"Tessellate the active solid into a high-resolution triangle mesh using the Netgen mesher with a maximum surface deviation of 0.05 mm, and export it directly to an ASCII STL file."2D Profile DXF Slice:
"Generate a 2D cross-sectional slice of the active model intersected by the XY plane at Z = 15 mm, convert the wire boundaries to a Draft Shape2DView, and export it as an AutoCAD 2000 DXF."
Comments
Post a Comment