If snapping was off, and after clicking the first point of a new line (for example), the cursor would be a default arrow instead of the intended cross-shaped cursor.
Note that the arrow cursor is still displayed for a fraction of a second after this fix.
May also fix#16559.
* Allow to align the working plane on selected edge + face of a same object, which aligns the plane with the face, but positions it on the edge (the WP is positioned on the edge's first vertex, the WP's X axis is aligned with the edge, and the face's center point provides the third point to define the plane)
* Added a "Recenter" in-command shortcut. This moves the WP to be centered on the current snap position (the WorkingPlane snap button is taken into account, so one can only move the WP in the same plane or not).
Fixes: #19553.
Additionally:
* Removed 2 unused attributes (`self.lastSnappedObject` and `self.active`).
* Improved the readability of `snapToObject` a little bit.
* Made the return value of that function consistent (vector or None).
Fixes#15017.
Currently Near snap overrides all other 'on-object' snaps such as Midpoint snap and Endpoint snap. With this PR Near snap no longer 'wins' if a different snap point is within snapRange of the cursor.
This fixes a regression introduced in V0.19 (!) when the type of linear dimensions was changed from "Dimension" to "LinearDimension".
Forum topic:
https://forum.freecad.org/viewtopic.php?t=90292
* Draft: Fix cursor scaling
The get_cursor_with_tail function was rewritten to match the Sketcher cursor code. Hopefully this fixes the scaling issue.
Related issue:
#13696
Related forum topic:
https://forum.freecad.org/viewtopic.php?t=89494
@maxwxyz
Can you check if this code fixes the issue? Apart from the size the 'hot' pixel should be checked. If you approach a vertical line from the left or right it should get highlighted at the same distance.
This PR replaces the showSnapBar and hideSnapBar preferences with a single new preference: SnapBarShowOnlyDuringCommands.
Additonally:
Improved some param observer callbacks.
This PR improves the behavior of the Draft grid:
* Options in the preferences: "Always show the grid" and "Show the grid during commands".
* The parameters are used for new views. In existing views the grid can be toggled either during a command or when no command is active.
* When switching to a different workbench all grids are hidden unless GridHideInOtherWorkbenches is set to `False`. This can be a Fine-tuning parameter IMO.
Notes:
* The defaultCameraHeight parameter becomes obsolete. It was only used in very specific circumstances.
* The code of PR #8818 becomes obsolete. It makes more sense to use `App.activeDraftCommand` instead of adding a `tool` argument to some functions. Will do some related cleanup later.
* Improved alignment for the related preference ui. The checkbox interaction has been fixed as well.
Related issue:
#5603.
For gui_snapper.py and gui_trackers.py an intermediate solution has been adopted. They still rely on App.DraftWorkingPlane, but now use a small function to retreive it.
Simply switching to the PlaneGui class is problematic for the trackers as this results in an endless recursion (wp->grid->wp->...). Using the old App.DraftWorkingPlane (which is kept up-to-date by PlaneGui) solves this for now. I will try to return to this later (which may be after the next release though).
- If grid is on and auto grid on: Grid always appears
- If grid is on and auto grid off: Grid off at start, on when using a tool, off afterwards
- If grid is off: Grid never appears
1. Draft_Snap_Parallel only worked beyond the endpoints of the edge.
2. It was very hard to select an edge for Draft_Snap_Parallel if no other snaps were active.
3. Only two snap objects were stored.
ref. https://forum.freecadweb.org/viewtopic.php?f=23&t=62274&sid=4c9d07255e4f0db219b661c345768319
If the cursor is over a Face and no SnapCenter is active, the snapToObject method returns the current cursor point instead of None. Doing so the snap() method does not check for extension and grid snaps.
It seems this is a bug since the snap() already contains the deleted code.
One note: the no snaps case was moved before the lastObj setting, since if no snap point was found, it's not right to set it to a non snapped object.
The code would only find a center snap on the face with index=0 of solids.
In V0.19 Part.getShape was introduced (line 399). But not all consequences were not fully implemented.
In the '# we are snapping to an edge' section (line 411) the code could be cleaned up. There is no need to check if the index of the edge is correct for the parent object since we are no longer dealing with a parent object. That portion was effectively dead code.
The '# we are snapping to a face' section (line 429 in the revised code) has been modified accordingly, which fixes the bug.
Forum discussion:
https://forum.freecadweb.org/viewtopic.php?f=23&t=54747