Macro Spreadsheet Dependency Inspector

Macro Spreadsheet Dependency Inspector

Description
The macro displays all dependencies between spreadsheet cells, object properties and sketch constraints, and helps you find and diagnose errors in the document.

Macro version: 01.05
Last modified: 2026/11/27
FreeCAD version: All
Download: ToolBar Icon
Author: 2cv001
Author
2cv001
Download
ToolBar Icon
Links
Macro Version
01.05
Date last modified
2026/11/27
FreeCAD Version(s)
All
Default shortcut
None
See also
None

Description

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro


# This code is copied instead of the original macro code
# to guide the user to the online download page.
# Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki
# or if the RAW code URL is somewhere else in the wiki.

from PySide import QtGui, QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,
    "Information",
    "This macro must be downloaded from this link\n"
    "\n"
    "https://raw.githubusercontent.com/2cv001/SpreadsheetDependencyInspector.FCMacro/main/SpreadsheetDependencyInspector.FCMacro" + "\n"
    "\n"
    "Quit this window to access the download page")

diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()

import webbrowser 
webbrowser.open("https://raw.githubusercontent.com/2cv001/SpreadsheetDependencyInspector.FCMacro/main/SpreadsheetDependencyInspector.FCMacro")

The macro Spreadsheet Dependency Inspector shows, as an expandable tree, the dependencies between spreadsheet cells, object properties and sketch constraints: what each item uses, and what uses it. It also shows the items in error, and where the error comes from.

The macro is multilingual, currently supporting English and French. The language used is the one you selected in your FreeCAD preferences.


Cell selection as starting point

Object selection as starting point


As a complement to this macro you may also want to check Macro Sketch Constraint From Spreadsheet.

Examples of use

Installation

Download the macro (see Download) and install it as described in How to install macros. You can also add it to a toolbar with its icon (see Customize Toolbars).

Usage

Select the starting point of the analysis, then run the macro. This starting point can be:

The refresh button re-runs the analysis, for example after you modify a cell. It starts again from what you selected last (cells, properties, constraints, objects or document).

The expand/collapse buttons and the level counter expand or collapse the whole tree. You can also do it branch by branch by clicking on the ▶ or ▼ symbols. Checking or unchecking a box keeps the level shown.

Lines shown

In the Lines panel, check boxes let you choose the lines shown in the tree:

Columns

In the Columns panel, check boxes let you show or hide the Label/alias, Expression, Result and constraint Type columns.

Double-click

In the Double-click panel, the Zoom on constraint box sets what a double-click on a constraint does. When checked, the 3D view is also framed on the constraint: the elements it links and its dimension take about 1/3 of the window, to see around. When unchecked, the view does not move (useful when you have set your zoom precisely).

In the tree

Error detection in the FreeCAD document

In the tree, the colour of a line shows its state:

The tooltip of each line explains its state.

Using the macro to understand the errors of the project

When a recompute fails (object marked with an exclamation mark, a Pad that no longer builds, a sketch that no longer solves), the macro helps you go back to the cause:

  1. List the errors: select the document at the top of the FreeCAD tree, run the macro, then keep only Errors checked in the Lines panel. Only the lines in error and their causes remain.
  2. Find where the error starts: a bold red line is the origin of an error: it is the one FreeCAD reports. A red line without bold only inherits it, and its tooltip says from which line. Start with the bold lines: one origin often explains all the others. For example, a Pad in error because its sketch no longer solves says in its tooltip that the error comes from the sketch.
  3. Read the cause: the tooltip of the line in error gives the message (cell error, expression that fails, value refused by FreeCAD, constraint refused by the solver as conflicting, redundant or malformed...). In its Uses branch, some lines may appear in orange (the value that causes the error) or in orange italic (all the values used, to check one by one, when the macro does not know which one is involved).
  4. Go to the source: double-click the orange or bold red line to open the cell in its spreadsheet, the property, or the constraint in its sketch. If Zoom on constraint is checked, the view frames the constraint in its surroundings. Double-clicking the expression of a line selects what it uses.
  5. Fix: in FreeCAD as usual (spreadsheet, property view, sketch), or directly in the tree of the macro (Expression column). If you make the change in the tree of the macro and it results in a FreeCAD error, the macro warns you and offers to cancel the change.
  6. Check: click the refresh button. When no line is red any more, the errors are solved.

Forum discussions

In English: https://forum.freecad.org/viewtopic.php?t=105015

In French: https://forum.freecad.org/viewtopic.php?t=104883

Credits

Thanks to L'ami René for tests, ideas, the icon and the example project!

Thanks to flachyjoe for the insightful comments on the ergonomics.

Download

The source code and the README are also on GitHub: https://github.com/2cv001/SpreadsheetDependencyInspector.FCMacro