FreeCAD / FreeCAD/FreeCAD

Sketcher: Error when creating redundant dimensions

Open
#32,264 0 comments 0 reactions 0 assignees View on GitHub
Mod: Sketcher Status: Confirmed Topic: GCS Topic: User Interface
Dominant language
C++
Stars
33.6k
Forks
6k
Avg merge
3d 15h
Merged PRs (30d)
196

Description

### Problem description

This problem exists regardless of if the setting to auto-remove redundant constraints is enabled or not.

When creating a redundant dimension in sketcher, the programs throws an error. The problem can happen when a dimension is redundant with a constraint, but only if the dimension is created last.

### Workbench affected?

Sketcher

### Steps to reproduce

Case 1:

1. Create an arc (half circle) from sketch origin, with the two vertex constrained to the horizontal or vertical axis
2. Create a radius constraint
3. Create a constrain distance between the center and one of the vertex

Case 2:

1. Create two lines sharing a vertex
2. Create a perpendicular constraint between the lines
3. Create an angle dimension between the lines

Case 3:

1. Create two lines sharing a vertex
2. Create a 90° angle dimension between the lines
3. Create a perpendicular constraint between the lines

### Expected behavior

If the auto-remove redundant constraints option is enabled, then the last constraint is removed without any error.

If the auto-remove redundant constraints option is disabled, then the last constraint is kept, the sketch turns orange, and there is no error.

### Actual behavior

https://github.com/user-attachments/assets/b9a63aa7-bb0c-4d05-bc28-2ee6fbfb7b90

Case 1: same result regardless of auto-remove redundant option status

```
14:40:23 pyException: Traceback (most recent call last):
File "", line 1, in
: Datum 33,831 mm for the constraint with index 4 is invalid
14:40:23 Unnamed#Sketch: App.getDocument('Unnamed').getObject('Sketch').setDatum(4,App.Units.Quantity('33.831 mm'))
```

Case 2: same result regardless of auto-remove redundant option status

```
14:44:00 pyException: Traceback (most recent call last):
File "", line 1, in
: Datum 90,000° for the constraint with index 6 is invalid
14:44:00 Unnamed#Sketch: App.getDocument('Unnamed').getObject('Sketch').setDatum(6,App.Units.Quantity('90 deg'))
```

Case 3:

* if the option is enabled: perpendicular constraint is instantly removed as expected, no error
* if the option is enabled: the perpendicular is created, sketch turns orange as expected, no error

### Development version About Info (in Safe Mode)

```shell
OS: Ubuntu 24.04.4 LTS (KDE/plasma/xcb)
Architecture: x86_64
Version: 26.3.0dev.20260825 (Git shallow) AppImage
Build date: 2026/08/25 17:50:34
Build type: Release
Branch: (HEAD detached at 964fce2ed)
Hash: 964fce2edc9a7e1905c2fd3fcd6e7be90afc8375
Python 3.11.14, Qt 6.8.3, Coin 4.0.10 (bundled), Pivy 0.6.11 (bundled), Vtk 9.3.1, boost 1_86, Eigen3 3.4.0, PySide 6.8.3
shiboken 6.8.3, xerces-c 3.3.0, Clipper2 , IfcOpenShell 0.8.0, OCC 7.8.1
Locale: French/France (fr_FR)
Stylesheet/Theme/QtStyle: FreeCAD.qss/FreeCAD Light/
QPA/File dialog/Color dialog: xcb/via Qt/via Qt
Navigation Style/Orbit Style/Rotation Mode: CAD/Rounded Arcball/Drag at cursor
Logical DPI/Physical DPI/Pixel Ratio: 96/117.596/1
OpenGL version/vendor/renderer: 4.6 (Compatibility Profile) Mesa 25.2.8-0ubuntu0.24.04.2/Intel/Mesa Intel(R) Iris(R) Xe Graphics (TGL GT2)
Installed mods:
* Cables Workbench 0.3.6
* Curved Shapes 1.0.15
* Curves workbench 0.6.73
* DFM 0.1.16
* Fasteners Workbench 0.5.64
* SheetMetal Workbench 0.8.21
```

### Last known good version (optional)

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start in the Sketcher constraint-creation flow and follow the setDatum calls shown in the error output, reproducing the three cases with auto-remove redundant constraints both enabled and disabled. Done means redundant dimensions no longer raise a ValueError: the last constraint is removed when enabled, or retained with an orange sketch when disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
computer-graphics, design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.