Find Open Contours and Duplicate Lines in FreeCAD
When creating 3D features like pads or pockets in FreeCAD, sketches must usually consist of closed, non-intersecting profiles without redundant geometry. This guide explains how to quickly identify and fix open contours, unconstrained gaps, and duplicate overlapping lines in FreeCAD using the built-in Sketcher validation tool and manual inspection techniques.
Use the Validate Sketch Tool
FreeCAD includes a dedicated diagnostic utility to detect broken geometry, missing coincidences, and open vertices.
- Close the active sketch editor if it is currently open.
- Select the problematic sketch in the Tree view.
- In the top menu, go to Sketch and select Validate sketch... (in the Part Design or Sketcher workbench).
- A dialog box will appear with several diagnostic checks:
- Missing coincidences: Detects endpoints that are
close to each other but not constrained with a coincidence constraint.
Set a tolerance value (e.g.,
0.01 mm) and click Find. If gaps exist, click Fix to automatically merge the endpoints. - Highlight open vertices: Check this option to turn all unclosed endpoints magenta/yellow in the 3D view, showing you precisely where a loop remains open.
- Invalid constraints: Identifies conflicting or redundant constraints that may be breaking the contour. Click Verify to scan and resolve them.
- Reversed external geometry: Fixes issues where referenced external edges conflict with sketch orientation.
- Missing coincidences: Detects endpoints that are
close to each other but not constrained with a coincidence constraint.
Set a tolerance value (e.g.,
Check for Duplicate and Overlapping Lines
Duplicate lines occur when a segment is inadvertently drawn directly on top of an existing one. Because they overlap perfectly, the standard coincidence validator may not always register them as open gaps.
1. Check the Degrees of Freedom (DOF)
Open the sketch and look at the Solver messages panel in the Combo View. If your sketch appears visually complete and constrained, but FreeCAD reports extra degrees of freedom, an extra hidden line segment is often the cause.
2. Box-Select Suspected Segments
- Click and drag a selection box around a single line segment.
- Look at the Elements list in the Task panel.
- If more than one line (e.g.,
Line1andLine2) is selected from what appears to be a single edge, an overlapping duplicate exists. - Select the duplicate entry directly in the list and press Delete.
3. Drag Endpoints
Click and drag an endpoint or a line segment in the 3D viewport. If an underlying line remains in place while the dragged line moves away, you have exposed an overlapping duplicate. Press Ctrl + Z to undo the movement, select the unwanted duplicate, and delete it.
4. Review the Elements List
In the Elements list within the Sketcher task panel, click through each line or arc sequentially. FreeCAD will highlight the corresponding geometry in green in the viewport. If the highlight does not move when advancing to the next element, you have located a duplicate.