Related issue:
#5603.
The view observer starts/stops when the Draft workbench is activated/deactivated.
Additionally:
* Minor improvements to _update_grid and _update_gui.
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).
* Draft: added the new Draft_Hyperlink command
Signed-off-by: CalligaroV <vincenzo.calligaro@gmail.com>
* Draft: added the new Draft_Hyperlink command
* Updated regex condition for more Windows file paths and network resources
* Added check for file existence
* Modified syntax for Win32/CygWin case
* Declared ret variable outside if statement
Signed-off-by: CalligaroV <vincenzo.calligaro@gmail.com>
* Draft: added the new Draft_Hyperlink command
* Replaced os.startfile and subprocess.call with QDesktopServices.openUrl
* Removed unused Python dependencies
Signed-off-by: CalligaroV <vincenzo.calligaro@gmail.com>
---------
Signed-off-by: CalligaroV <vincenzo.calligaro@gmail.com>
Related issue:
#5603.
* The history idx value was not handled properly.
* Part.getShape() ignores the Placement of a selected BuildingPart. Have to use `place * obj.Placement`.
Related issue:
#5603.
* An 'auto' WP should not be added to the history if the previous WP in the history is also 'auto'.
* The `get_working_plane` function should only call `set_to_default` if the GUI is up. The axis of the returned WP should match global +Z if the GUI is not up.
Forum topic:
https://forum.freecad.org/viewtopic.php?t=81997
Additionally:
* Fixed offset and extrusion for non-planar faces.
* Improved the addSubobjects function,
* Cleaned up the code a little bit.
Related issue:
#5603
Previous PR:
#11010
* This PR implements the new PlaneGui class for the Draft_SelectPlane command.
* As mentioned in the previous PR, almost all working plane related code has been removed from gui_selectplane.py.
* The task panel has a new button "Next" to switch to the next working plane in the history.
* Both the "Previous" and "Next" buttons are only enabled if there is a corresponding step in the history.
* PlaneGui stores a working plane per 3D view, but the other commands have to be updated before that system is fully functional.
* Code to update the toolbar when switching to a different view will be added later.
Forum topic:
https://forum.freecad.org/viewtopic.php?t=81956
This PR basically reverts PR #10556.
The angular offset required for the Draft_Arc command is handled in the gui_arc.py file instead. Also removed the unused `urotated` variable from that file.
* Added uppercase extensions for supported formats
In the file App\Application.cpp
* Added file types in upper case
* Adds uppercase file types to the file import filter.
Fixes#10879
* Added filter for *.fcmacro *.fcscript
Related issue:
#5603.
Previous PRs:
#10766#10838#10931
Short explanation:
* The PlaneGui class handles several GUI related aspects of the WP including a WP history.
* The `get_working_plane` function should be used to get a WP.
* Some of the code was taken from gui_selectplane.py. The intention is to remove almost all WP related code from that file. The icon, tooltip and label for the draftToolBar are also handled by PlaneGui.
* The tooltip shows extended information about the WP (position and axes vectors). An asteriks is appended to the label if the origin does not match the global origin.
* The `_update_all` function still updates FreeCAD.DraftWorkingPlane for compatibility.
* Some confusing names from the Plane class have been changed: `weak` -> `auto`, `reset` -> `set_to_auto`, `setup` -> `auto_align`.
Next step:
Implementing PlaneGui in Draft and Arch. The gui_selectplane.py file will be updated first.
* Import: Support DXF text rotation - fixes#10882
- Reads and supports text rotation in builtin DXF import
- Makes the builtin DXF import produce Draft texts instead of App::Annotations
- Extends the arguments of Draft make_text()
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Related issue:
#5603.
Previous PRs:
#10766#10838
The remaining Plane class functions have been processed (some are unchanged):
`setup`
* Updated to use new functions.
* The `direction` etc. arguments are never used AFAICT.
* Added `from draftutils import gui_utils`.
`reset`
* Unchanged.
`setTop`
* Calls `super().set_to_top()`. That function does not use `align_to_point_and_axis` but specifies exact vectors for improved accuracy.
* `import FreeCADGui` already happens at the top of the file.
* The code block after `if FreeCAD.GuiUp:` was kept for now.
`setFront`
* Idem.
`setSide`
* This function sets the WP to the left side position, and not to the right side postion as in the Draft_SelectPlane command.
* Idem.
`getRotation`
* Revised.
* The function has an akward name as it returns a Placement.
* The special code for Arch active container is obsolete (was already commented out in other functions).
`getPlacement`
* The `rotated argument` is ignored now. It was only used in the context of the old `placement_from_face` algorithm. See `DraftGeomUtils.placement_from_face` for the new implementation.
* Calls `super().get_placement()`.
`getNormal`
* Basically unchanged.
`setFromPlacement`
* Revised to call `super()` functions.
`inverse`
* Unchanged.
`save`
* Unchanged.
`restore`
* More compact code, but basically unchanged.
`getLocalCoords`
* Calls `super().get_local_coords()` which does not rely on Draft code, but creates a matrix and returns `mtx.inverse().multVec(point)`.
`getGlobalCoords`
* Calls `super().get_global_coords()` which creates a matrix and returns `mtx.multVec(point)`.
`getLocalRot`
* Calls `super().get_local_coords()`.
`getGlobalRot`
* Calls `super().get_global_coords()`.
`getClosestAxis`
* Calls `super().get_closest_axis(vec)` which translates the vector to the WP coordinate system and then finds the closest axis by comparing the absolute coordinates of the vector.
`isGlobal`
* Not used anywhere AFAICT.
* Calls `super().is_global()` which also checks the `position` attribute.
* As before the function works without any tolerance.
`isOrtho`
* Not used anywhere AFAICT.
* The original algorithm did not work properly (there was a comment). All angles were measured relative to the global Y axis. If the WP was randomly rotated around that axis the function would still return `True`. The new algorithm, `super().is_ortho()`, uses rounded Yaw, Pitch and Roll angles to check for orthogonality.
`getDeviation`
* Not used anywhere AFAICT.
* Unchanged.
`getParameters`
* Calls `super().get_parameters()` which uses the local `_get_prop_list` function.
`setFromParameters`
* Calls `super().set_parameters()` which uses the local `_get_prop_list` function.
`_get_prop_list`
* Function used internally. Returns a list of attribute.