Commit Graph

3262 Commits

Author SHA1 Message Date
Roy-043
ec50beebf4 Draft: Updates related to the PlaneGui class (step 3)
Related issue:
#5603.
2023-10-27 11:55:24 +02:00
Roy-043
3b1c590b53 Merge pull request #11117 from Roy-043/Draft-Updates-related-to-the-PlaneGui-class-(step-2)
Draft: Updates related to the PlaneGui class (step 2)
2023-10-27 10:49:56 +02:00
Roy-043
bccba05d20 Draft: PlaneGui: update wp._view earlier
Update wp._view before call to set_to_default, set_to_auto requires a 3D view.
2023-10-27 10:33:07 +02:00
Roy-043
85ace1ca33 Draft: Make Facebinders link-aware (2nd error fix)
Previous PRs: #11081 and #11156.
2023-10-25 18:16:43 +02:00
Roy-043
f12c3604d6 Draft: Draft_SelectPlane was not correctly finished in case of a pre-selection
Fixes #11157.
2023-10-24 10:44:46 +02:00
Roy-043
d6b402c59c Fix error in make_dimension.py 2023-10-23 20:24:30 +02:00
Roy-043
28e450ebda Draft: Make Facebinders link-aware (fix errors in previous PR)
Previous PR: #11081.
2023-10-23 20:08:59 +02:00
Roy-043
c558ae7484 Fix syntax error in wires.py 2023-10-23 19:33:06 +02:00
Vincenzo Calligaro
50725bf253 [Feature Request] [Draft] [UI/UX] new Draft_Hyperlink command (#10878)
* 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>
2023-10-23 17:42:47 +02:00
Roy-043
ca06e87a38 Draft: Updates related to the PlaneGui class (step 2)
Related issue:
#5603.

Additionally:
Fixed the issue where the texts of Arch_Space objects were not exported to DXF.
2023-10-23 16:25:12 +02:00
Roy-043
28593e4658 Draft: PlaneGui: some minor fixes
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`.
2023-10-22 19:48:31 +02:00
Roy-043
5110c80385 Draft: importSVG: handle viewBox in mm (PR10929 fix was not correct) 2023-10-22 17:51:14 +02:00
Roy-043
35ab4a28c9 Draft: Fix Gui.doCommand issue in gui_planeproxy caused by PR11080 (#11134)
The previous code resulted in a syntax error.
2023-10-22 11:15:00 +02:00
Roy-043
345df4b399 Draft: PlaneGui: minor fixes (#11115)
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.
2023-10-20 12:28:00 +02:00
Roy-043
7eda70c737 Draft: importDXF: fix off layer bug (#11090)
* Draft: importDXF fix off layer bug

Fixes #10254.

* Typo

* Typo 2
2023-10-19 09:57:48 +02:00
Roy-043
f0db4e8ef5 Draft: Updates related to the PlaneGui class
Related issue:
#5603.
2023-10-18 09:50:50 +02:00
Roy-043
0c4dd64f1d Draft: Make Facebinders link-aware
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.
2023-10-18 09:50:18 +02:00
Roy-043
cf9b342cd4 Draft: Update gui_selectplane.py
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.
2023-10-17 15:05:28 +02:00
Roy-043
fd609b4e37 Draft: Fix angular dimension issue caused by #10556
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.
2023-10-17 15:05:12 +02:00
Victor Predko
f76f842302 File formats: Uppercase file types when importing a file. (#10977)
* 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
2023-10-16 14:40:46 -03:00
Roy-043
a1b8a2ec70 Draft: Change get_3d_view to only return the active 3D view (#11050)
Related issue:
#10634

Also needed to avoid warnings from the PlaneGui class.
2023-10-15 14:28:32 +02:00
Roy-043
8ad5c6ca94 Draft: PlaneGui: minor fix (#11049)
* Draft: PlaneGui: minor fix

Related issue:
#5603.

* Typo
2023-10-15 14:28:02 +02:00
Roy-043
b4186745c4 Draft: PlaneGui: some updates and fixes. (#11040)
Related issue:
#5603.
2023-10-14 21:50:14 +02:00
Roy-043
a0af13ad2c Draft: Introduction of the PlaneGui class
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.
2023-10-12 13:11:57 +02:00
Roy-043
a8864ae28b Draft: Import DXF: handle arc angles larger than 360 degrees
See #10985.
2023-10-12 10:52:30 +02:00
Yorik van Havre
55292e9041 Import: Support DXF text rotation (#11001)
* 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>
2023-10-11 17:05:31 +02:00
Roy-043
c01c0a2e45 Draft: Use DXF OCS when importing circles and arcs to Part shapes
See #10985.
2023-10-11 10:08:58 +02:00
Roy-043
80f97a588a Draft: Fix cursor scaling issue
Fixes #6793
2023-10-09 14:01:21 +02:00
Roy-043
3c14a56eed Draft: fix multiline offset for rotated SVG texts
Forum topic:
https://forum.freecad.org/viewtopic.php?p=711184#p711184
2023-10-09 13:27:54 +02:00
Roy-043
c2484914f2 Draft: Update the Plane class (step 2)
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.
2023-10-04 14:40:33 +02:00
Roy-043
919f6e78e0 Draft: importSVG: handle viewBox in mm
Forum topic:
https://forum.freecad.org/viewtopic.php?t=81696
2023-10-04 11:03:36 +02:00
Chris Hennes
6d37ef6609 Merge pull request #10844 from ppphp/remove_redundant_definition
[cmake] some definitions do not matter now
2023-10-02 14:20:49 -05:00
Yorik van Havre
97173e0280 Merge pull request #10838 from Roy-043/Draft-Update-the-Plane-class-(step-1)
Draft: Update the Plane class (step 1)
2023-10-02 11:36:38 +02:00
liukaiwen
18af697795 Merge remote-tracking branch 'origin/master' into remove_redundant_definition 2023-10-02 01:42:37 +08:00
Chris Hennes
5dfd4d5190 Update translations 2023-09-29 22:57:37 -05:00
Yorik van Havre
a0e2d70ade Merge pull request #10856 from Roy-043/Draft-get_movable_children-prevent-endless-loop
Draft: get_movable_children: prevent endless loop
2023-09-29 11:27:34 +02:00
Roy-043
3847db56d5 Draft: get_movable_children: prevent endless loop
Forum topic:
https://forum.freecad.org/viewtopic.php?t=81547
2023-09-28 15:19:25 +02:00
ppphp
82ba7ae5ca Merge branch 'master' into remove_redundant_definition 2023-09-28 01:38:38 +08:00
Roy-043
1efa0ee09d Draft: ImportDXF: CURRENTDXFLIB is not obsolete and should be kept 2023-09-27 15:41:40 +02:00
liukaiwen
4f8fe8fd4a [cmake] some definitions do not matter build now 2023-09-27 18:17:14 +08:00
Roy-043
92c6a36925 Draft: Update the Plane class (step 1)
After this PR the `Plane` class inherits from the `PlaneBase` class.

Related issue:
#5603.

Previous PR:
#10766

The following functions have been updated:

`__init__`
* `u` argument can be a WP now.
* Input vectors are copied.
* Added the `weak` argument.
* the `doc` attribute was not used and has been removed.

`__repr__`
* Inherited.
* The `position` is now also shown.

`copy`
* Uses `match` from the parent class which uses the local `_get_prop_list` function. Again vectors are copied.

`offsetToPoint`
* I could not find evidence that this function is used anywhere.
* The `direction` argument did not make a lot of sense (only worked in 2D). It is now ignored.
* Removed the overly long docstring.
* The function now uses an external function: `DraftGeomUtils.distance_to_plane`.

`projectPoint`
* The function calls `super().project_point` which in turn calls `DraftGeomUtils.project_point_on_plane`.
* `from sys import float_info` is no longer required.

`projectPointOld`
* Obsolete and removed.

`align*`
* All align* functions now have an `offset` argument.
* All align* functions return `True` or `False`.

`alignToPointAndAxis`
* The function ignored `upvec` if `axis` was parallel to the global X axis. This meant that the "Set WP" button of the Draft_Wire command did not work properly if the WP was aligned with the Right or Left view.
* The function calls `align_to_point_and_axis` which determines the rotation with `FreeCAD.Rotation(Vector(), upvec, axis, "ZYX")`.

`alignToPointAndAxis_SVG`
* The function calls `super().align_to_point_and_axis_svg` which contains the code from the old function.

`alignToCurve`
* Was not implemented.

`alignToEdges`
* Original code required two parallel edges (for example from an axis system), else the `u` and `v` vectors would not be perpendicular.
* The function calls `super().align_to_edges_vertexes` now.

`alignToFace`
* The function now uses an external function: `DraftGeomUtils.placement_from_face`. The rotation algorithm for the `u` and `v` vectors has been moved there.

`alignTo3Points`
* Basically unchanged. `Part` is already imported at the top of the file.

`alignToSelection`
* Basically unchanged. Will be replaced in the `PlaneGui` class.
2023-09-27 11:25:04 +02:00
Roy-043
56d3d3d5b1 Draft: ShapeString: improve ObliqueAngle (#10811)
Calculation of the justification required the use of `optimalBoundingBox` and should happen after applying the oblique angle.
2023-09-26 12:53:53 +02:00
Yorik van Havre
be84810aa9 Merge pull request #10783 from Roy-043/Draft-ShapeString-add-ObliqueAngle-property
Draft: ShapeString: add ObliqueAngle property
2023-09-25 10:54:53 +02:00
Yorik van Havre
f883a77ca0 Merge pull request #10766 from Roy-043/Draft-Introduction-of-the-PlaneBase-class
Draft: Introduction of the PlaneBase class
2023-09-25 10:09:48 +02:00
Roy-043
432ba3adde Draft: ShapeString: add ObliqueAngle property (improvement) 2023-09-24 19:04:32 +02:00
wmayer
83d4080fe8 App: fixes #10460: App::PropertyPythonObject is not saving data
Since Py3.11 the methods names __setstate__ and __getstate__ conflict with the method names added to the object class.
Thus rename them to 'loads' and 'dumps'
2023-09-24 10:56:35 -05:00
Roy-043
4ef4819872 Draft: ShapeString add ObliqueAngle property
Fixes #5656.
2023-09-23 11:39:27 +02:00
Roy-043
26418c07e7 Draft: ShapeString: add font file filter (#10777)
Forum topic:
https://forum.freecad.org/viewtopic.php?t=81280
2023-09-22 21:23:56 +02:00
Roy-043
ca7b329c43 Draft: use Gui::FileChooser::Directory where applicable (#10780) 2023-09-22 21:23:23 +02:00
Roy-043
6528eef858 Draft: Introduction of the PlaneBase class
This PR introduces the new PlaneBase class.

Most of its functions are rewritten versions of the functions in the original Plane class, with the exception of align_to_point_and_axis_svg.

Note that after this PR the original Plane class does not yet inherit from PlaneBase. This will be done in several following PRs. I will then also explain the reasons behind some of the revised functions in PlaneBase.

The introduction of the PlaneGui class will follow after that.

Issue: #5603.
2023-09-21 15:20:48 +02:00