Sketcher: Ability to Auto-assign names at datum constraint creation
- Dominant language
- C++
- Stars
- 33.6k
- Forks
- 6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 196
Description
### Is there an existing request for this?
- [X] I have searched the existing requests
### Forums discussion
https://forum.freecadweb.org/viewtopic.php?p=636963#p636963
### Subproject(s) affected?
Sketcher
### Idea description
This issue is somewhat related to #5965, if but of these issues are solved the constraints usage on expressions would be greatly improved and accessible even to novice users.
Currently sketcher constraints are created without a name unless the user specifies it, this can be problematic when the constraints are referenced in expressions using just the list index as these will change if a constraint with a lower index is removed. My proposed solution to this would be to automatically assign a name to datum constraints when they are created based on constraint type and adding a number, here's my proposed scheme:

The user can of course write whatever name he prefers in the dialog as always, but this gives an usable name from the get go without effort, if #5965 is also implemented this alone makes carbon copy a lot more reliable.
If for some reason somebody dislikes this behavior we could provide a checkbox in preferences to disable autonaming.
As for the process for generating a name, we take the constraint type and use the corresponding string for it, say `HD` for a horizontal distance constraint then we add a number to it, we check if there are other named constraints with the same format `HD#` and we take the highest number we can find +1.
If somebody feels generous we could also add functionality to auto-name old sketches with constraints that don't have names, but just the suggested change here is enough mitigation for this issue IMO.
### Anything else?
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start in the Sketcher constraint-creation flow and review the related request in #5965. Determine how datum constraint types and existing names are represented, then define the naming behavior described here; done means new datum constraints receive unique type-based names while allowing users to override them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100