Commit Graph

109 Commits

Author SHA1 Message Date
Roy-043
7a5d8bb3a8 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
bb4f5c7eee 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
Roy-043
292fadfb1c Draft: Fix error in PR10327 (#10329) 2023-08-23 13:32:37 +02:00
Roy-043
bfa8d79afb Draft: Add placement_from_face to geometry.py (#10327)
Changed getPlacementFromFace function in WorkingPlane.py to a compatibility function that calls placement_from_face.
2023-08-23 12:05:34 +02:00
Roy-043
649dde9808 Draft: Add placement_from_points to geometry.py
Changed getPlacementFromPoints function in WorkingPlane.py to a compatibility function that calls placement_from_points.
2023-08-23 11:17:17 +02:00
Roy-043
e008a3afe8 Draft: Auto workingplane ignored rotation around axis (#9955) 2023-07-20 18:46:10 +02:00
luzpaz
38a01939e0 Migrate domain name from freecadweb to freecad (#9352)
* Migrate domain name from freecadweb to freecad
* Migrate src/Mod/Material files
* Migrate Stylesheet related files
* Migrate *.svg files
* Migrate miscellaneous files
* Migrate some build files
* Migrate recently added TD AR_IRAM template files

Closes #6415
2023-04-24 15:19:20 -05:00
Jolbas
bd627a469f Draft: fix error in PR #8698 (#9160)
fix for mistake in pr https://github.com/FreeCAD/FreeCAD/pull/8698
see comment 9983207ab8 (r1155160709)
2023-04-02 11:23:59 +02:00
Jolbas
202a6ca6b8 return pure rotation from getPlaneRotation() 2023-02-28 01:07:56 +01:00
Roy-043
6cd35b86fe Draft: Fix workingplane auto alignment to Front view 2022-09-01 09:54:09 +02:00
Roy-043
28ea41cb32 Draft: Improve alignToFace in WorkingPlane.py 2022-07-24 18:52:41 +02:00
marioalexis
8baaa1028e Draft: Fix orientWP method used by in Draft_Line command 2022-04-20 14:12:26 -03:00
marioalexis
a18b00bc7e Draft: Fix WorkingPlane setup in automatic mode - fixes #6060 2022-04-10 16:17:16 +02:00
marioalexis
727d21499f Draft: Fix projectPoint method 2022-01-08 23:16:15 -03:00
luzpaz
95a0c9c008 Add requested revision by @chennes
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2021-10-30 15:20:28 -04:00
luzpaz
005a5d8cd7 Add requested revision by @chennes
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2021-10-30 15:20:28 -04:00
luz paz
8aab47fb06 Draft: Fix superfluous whitespace in translations + misc. typos 2021-10-30 15:20:28 -04:00
Roy-043
d1fca44fb6 Draft: Fix Draft_SelectPlane ignores nesting 2021-10-20 10:15:12 +02:00
Yorik van Havre
fe7f1ba1c3 Draft: Fixed working plane set on non-coin view 2021-06-22 16:12:59 +02:00
marioalexis
6f101761bb Draft: Improve alignToSelection method on WorkingPlane 2021-06-06 21:30:20 -03:00
Yorik van Havre
1cce61670c Draft: better checks for no active document 2020-11-16 13:25:12 +01:00
carlopav
aff02d706a Draft: possibility to set the working plane to an App::Part placement 2020-07-07 10:13:23 +02:00
Yorik van Havre
2175eb0939 Draft: Added convenience methods to the Draft Working Plane to set top, front and side positions 2020-04-09 16:59:01 +02:00
vocx-fc
106cd631e0 Draft: WorkingPlane.py clean up imports and docstrings
Small spacing fixes like imports in separate lines
for more clarity, and the position of the license.

Cleaned up the class docstring, so it is in only one place
below the class definition. Also small fixes
in the docstrings of the class methods.

The class is now in upper case `Plane` to conform with Python
guidelines. An alias in lowercase `plane` is still provided
for compatibility purposes; this will be deprecated
in the future.
2020-04-07 18:12:06 +02:00
luz.paz
8cfa85cf18 Draft: [skip ci] Fix header uniformity
This PR fixes header uniformity across all Draft files
2019-12-27 00:16:12 +01:00
Yorik van Havre
91ca523f54 Draft: Moved SelectPlane stuff from DraftGui to its own ui file 2019-09-02 22:15:58 -03:00
luz.paz
020a66cddf Fix misc. typos
Found via `codespell -q 3 -I ../fc-word-whitelist.txt -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller -L od,orign,orginx,orginy`
2019-08-14 14:36:53 -03:00
vocx-fc
813338d62e Draft: WorkingPlane, improved Pythonic style, line length < 79 characters; shorter variables
to save space and have line lengths < 79 characters; added whitespace to comments
and used the self.__repr__() method to shorten the impression to the terminal;
broke the line inside parentheses to make the line shorter; inside alignToSelection() test for faces first
to use alignToFace(), which actually works; leave alignToCurve() for later,
as it doesn't actually do anything at the moment; improved docstrings in isOrtho(),
the orthogonality is tested for u, v, and axis, on the global axis +Y only;
removed wrongly placed comment in restore() method;
improved file docstring at the top.
2019-08-14 14:31:56 -03:00
vocx-fc
b7ad13b34f Draft: WorkingPlane, Pythonic style, improved the docstrings, use a shape of type Part.Face 2019-08-09 16:54:50 -03:00
vocx-fc
3eda73fae9 Draft: WorkingPlane, Pythonic style, improved the docstrings; moved the description of the points within the parameter section 2019-08-09 16:54:50 -03:00
vocx-fc
817f076e2e Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
8aa3f38a7b Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
abf3139563 Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
fbc3abc0de Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
41300ee257 Draft: WorkingPlane, Pythonic style, improved the docstrings; added the other getLocalRot() and getGlobalRot() related functions to the 'See also' sections; need to verify their operation as some of these methods seem to just return the original point 2019-08-09 16:54:50 -03:00
vocx-fc
3f84f43564 Draft: WorkingPlane, Pythonic style, improved the docstrings; added a graphic to explain the type of point that the functions return; maybe getLocalCoords() should be named getRelativeCoords(), as the return value is a relative vector referred to the plane. 2019-08-09 16:54:50 -03:00
vocx-fc
212640b3ce Draft: WorkingPlane, Pythonic style, improved the docstring; why does the projection invert the direction of the component, that is, -x instead of x, if the angle between the vectors x and u is larger than 1 radian? Why specifically 1 radian? 2019-08-09 16:54:50 -03:00
vocx-fc
a5451e6234 Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
b430036a8b Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
8b6a3222b6 Draft: WorkingPlane, Pythonic style, improved the docstring 2019-08-09 16:54:50 -03:00
vocx-fc
8004f89e20 Draft: WorkingPlane, Pythonic style, improved the docstring 2019-08-09 16:54:50 -03:00
vocx-fc
6a87b6fe57 Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
f0eafbc25f Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
a7d70a7aa3 Draft: WorkingPlane, Pythonic style, improved the docstring 2019-08-09 16:54:50 -03:00
vocx-fc
a569bed31b Draft: WorkingPlane, Pythonic style, improved the docstring; these methods only work when 'FreeCAD.GuiUp' is True; it should print a message to the console indicating that. 2019-08-09 16:54:50 -03:00
vocx-fc
15b186bbfe Draft: WorkingPlane, Pythonic style, improved the docstring; setup() only works when 'FreeCAD.GuiUp' is True, otherwise it fails silently. This should be change to print a message to the console. 2019-08-09 16:54:50 -03:00
vocx-fc
e7aaf4b771 Draft: WorkingPlane, Pythonic style, improved the docstrings; alignToSelection() only works when 'FreeCADGui.Selection' is available, that is, when the graphical interface is loaded. 2019-08-09 16:54:50 -03:00
vocx-fc
8ade7083d6 Draft: WorkingPlane, Pythonic style, improved the docstrings; alignToSelection() only really works with Faces because it calls alignToFace(); it doesn't work with Edges nor Wires because alignToCurve() isn't fully implemented. 2019-08-09 16:54:50 -03:00
vocx-fc
0ec668a057 Draft: WorkingPlane, Pythonic style, improved the docstrings 2019-08-09 16:54:50 -03:00
vocx-fc
df54c400a0 Draft: WorkingPlane, Pythonic style, improved the docstring, although alignToCurve is not yet implemented so it doesn't do anything 2019-08-09 16:54:50 -03:00