Commit Graph

54 Commits

Author SHA1 Message Date
Roy-043
2ee620ab42 Draft: make move, rotate and scale commands link-aware (#18795)
* Draft: make move, rotate and scale commands link-aware

Fixes #12836.
Fixes #15681.

These changes are presented as a single ('big') PR because the mentioned commands have several similarities. Working on them seperately would have made less sense.

The commands have been made 'link-aware' meaning they can now handle Links and objects in linked containers.

This required several changes in the following main files. For each command all options are handled by a single function now (the `move`, `rotate` and `scale` functions). This was the only reasonable solution to correctly handle nested placements. As a result there is no longer a need to build very complex 'cmd' strings in the gui_*.py files (which is a good thing IMO).

Main files:

* move.py
* rotate.py
* scale.py
* gui_move.py
* gui_rotate.py
* gui_scale.py
* gui_trackers.py

The following files have also been updated:

* Draft.py: Imports updated.
* DraftGui.py: If `CopyMode` is changed the ghosts have to be updated. The move and rotate commands now also show previews of movable children. But since those are not copied they should be removed from the ghosts if `CopyMode` is changed to `True`.
* utils.py: Some helper functions have been added. An existing helper function (only used internally) has been renamed.
* gui_utils.py: The `select` function has been updated to accept a list of tuples to allow the reselection of nested objects.
* clone.py: A new property `ForceCompound`, necessary for non-uniform scaling, has been added.
* join.py: The `join_wires` function now returns the resultant wire objects.
* task_scale.py: Updated to allow negative scale factors. Support for `SubelementMode` preference added.
* dimension.py: `transform` methods added.
* layer.py: `get_layer` function added.
* svg.py: Updated to use `get_layer`.
* view_text.py: Instead of two added `coin.SoTransform()` nodes the main transform node is used instead. This was done so that ghosts of Draft Texts can be handled properly without requiring dedicated code in gui_trackers.py.

Notes:

* Support for "App::Annotation" is limited. Only their `Position` is handled (by the move and rotate commands).
* Support for "Image::ImagePlane" has been removed from the scale command. The object has its own calibrate feature (see https://wiki.freecad.org/Std_Import).
* Copies and clones are always created in the global space.

* Fix several unit test issues.

* Reset value that was changed while testing

* Rebase and update test_modification.py

* Reintroduce scaling of image planes
2025-01-20 18:23:36 +01:00
Tobias Frost
460da406f8 spelling fixes (#18688)
* Fixes spelling of "Allow to" to "Allow one to"

and those variants:
Allows to -> Allows one to
allow to -> allow one to
allows to -> allows one to

* Fix "Let's -> Lets"

(and lower case variant.)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update src/3rdParty/salomesmesh/inc/MED_Wrapper.hxx

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Update src/Base/PyObjectBase.cpp
Update src/App/ExtensionContainer.h
Update src/App/PropertyContainer.h

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Use gerund in user-facing texts.

* Use gerund for two more user-facing strings.

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* Update src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

---------

Co-authored-by: Tobias Frost <tobi@debian.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-01-13 11:22:20 -06:00
Roy-043
11c33d897a Include other Draft commands 2024-11-30 16:48:41 +01:00
Martin Rodriguez Reboredo
51987dc1ab Fixups with Qt6 enums (#13611)
* Python PySide enums to C++ converter

* Python IntFlags to C++ int in getStandardButtons

* Remove int conversion in mods Python sources
2024-05-06 18:02:18 +02:00
Josh Coalson
fbd8767242 Part: Rename AttachExtension::Support property to AttachmentSupport, to avoid name conflict with base features. Fixes #7052 2024-03-04 18:22:43 +01:00
Kevin Martin
2b9fa18b68 Eliminate many "doing what you told me to" messages
These messages were perhaps originally intended as a debuggin aid but now add clutter to the output panes. Remaining messges are mostly the result of methods to display attributes of an object (which one could call from the Python console) or actually provide some information which would not be obvious from the circumstances
2024-02-02 08:58:45 -05:00
Roy-043
47f6c756e3 Merge pull request #12111 from 3x380V/draft_wb_qt6
Draft: Qt6 fixes
2024-01-31 11:31:38 +01:00
Ladislav Michl
839fb17649 Draft: Use widgets from QtWidgets 2024-01-25 14:27:38 +01:00
Roy-043
d76db39662 Draft: Draft_Scale: make sure scale inputboxes show at least 6 decimals
Fixes #7386.
2024-01-23 18:07:03 +01:00
Roy-043
427e75707e Draft: ShapeString double escape backslash in string
Fixes 12058.
2024-01-22 14:35:34 -03:00
Roy-043
822f2111e3 Draft: implement new get_param functions (step 3)
See #11677
2023-12-12 20:20:03 +01:00
Roy-043
938b25183b Draft: Updates related to the PlaneGui class (step 3)
Related issue:
#5603.
2023-10-27 11:55:24 +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
Roy-043
f9cdaaf3d9 Draft: fix issue with undo (#8267) 2023-01-31 21:38:19 +01:00
Roy-043
20c582da9d Draft: Fix handling of double quote in shapestring 2022-10-05 10:57:48 +02:00
Roy-043
3b85533438 Draft: Restore DontUseNativeDialog after ShapeString edit 2022-04-25 00:48:28 +02:00
marioalexis84
aa2ebb9601 Draft: Make ShapeString editable by double-click - fixes #5885
* Draft: Make ShapeString editable - fixes #5885
2022-04-08 17:47:41 +02:00
marioalexis
79b7bfd5d0 Draft: Remove Python 2 type support 2022-03-28 18:02:23 -03:00
andrea reale
83d3a916c0 remove QT4 references 2022-03-19 23:07:38 +01:00
Roy
1566c00d35 Draft: Housekeeping: call 'make' functions with new name (3) 2022-02-13 11:01:15 +01:00
Roy
c7da560d39 Draft: fix task panel related issues
This PR fixes several task panel related issues for Draft modifier commands.
2022-01-15 18:23:05 +01:00
Mariwan
e63472b10c Draft: change static to non-static declared variables (#5292)
* Draft: change static to non-static declared variables

* Change variable name and add some comment
2022-01-05 16:39:28 +01:00
Chris Hennes
2977cadc41 [Draft] Fix bug in data entry on scale w/ uniform
When entering a scale factor, if uniform scaling is on, the current code
keeps appending zeroes as you type, forcing you to delete them before
entering your next digit. This commit fixes that by ensuring that the
widget that you are currently editing is not updated continuously.

Fixes #0004601
2021-03-23 14:18:19 -05:00
David Osterberg
9dd96ed107 Draft: Fix regressions in Draft array 2021-02-14 01:20:06 +01:00
wmayer
ac6d06dd84 Draft: fix syntax errors 2021-02-13 12:14:12 +01:00
Yorik van Havre
abee35f38a Draft: Fixed broken translations everywhere 2021-02-12 14:44:58 +01:00
JAndersM
bd913d1dd5 Update task_scale.py
The changes solves the Ticket #3691 - Bug in draft scale. Only integers work
2020-12-07 19:51:29 +01:00
vocx-fc
e9b72b5be7 Draft: add modules of drafttaskpanels to the proper Doxygen group
This includes `task_circulararray`, `task_orthoarray`,
`task_polararray`, `task_scale`, `task_selectplane`,
`task_shapestring`.

These are added to the `drafttaskpanels` Doxygen group
so that the functions and classes contained in each module
are listed appropriately in the automatically generated
documentation.
2020-07-17 13:01:45 +02:00
vocx-fc
1c65c7dc92 Draft: add Doxygen strings to the packages' __init__ files
The packages are `draftfunctions`, `draftgeoutils`, `draftguitools`,
`draftmake`, `draftobjects`, `drafttaskpanels`, `drafttests`,
`draftutils`, `draftviewproviders`.
2020-07-17 13:01:45 +02:00
vocx-fc
3e67b469d4 Draft: clean up CircularArray code
Avoid `Draft.py` in the `make_circular_array` function because
it creates a circular dependency.

Use function to find the object in `make_circular_array`.

Now the make function accepts as input a `"String"` which must be
the `Label` of an object in the document, so it is easier to create
arrays interactively from the Python console.

Clean up the GuiCommand and task panel code, and avoid printing
messages to the terminal, as this is already done
by the make function.
2020-06-03 14:46:15 +02:00
vocx-fc
1ad8b16a81 Draft: clean up PolarArray code
Avoid `Draft.py` in the `make_polar_array` function because
it creates a circular dependency.

Use function to find the object in `make_polar_rarray`.

Now the make function accepts as input a `"String"` which must be
the `Label` of an object in the document, so it is easier to create
arrays interactively from the Python console.

Clean up the GuiCommand and task panel code, and avoid printing
messages to the terminal, as this is already done
by the make function.
2020-06-03 14:46:15 +02:00
vocx-fc
604e70fd20 Draft: clean up OrthoArray code
Avoid `Draft.py` in the `make_ortho_array` function because
it creates a circular dependency.

Use internal functions to abstract the orthogonal arrays.
The `_make_ortho_array` is a simple wrapper over the general
`make_array` function.

The result is four variants:
- `make_ortho_array`
- `make_ortho_array2d`, without the Z component
- `make_rect_array`, strictly rectangular components
- `make_rect_array2d`, strictly rectangular without the Z component

Also use functions to perform checking of the inputs,
whether these are vectors, numbers (integer and floats)
or integers.

Now the make function accepts as input a `"String"` which must be
the `Label` of an object in the document, so it is easier to create
arrays quickly from the Python console.

Clean up the GuiCommand and task panel code, and avoid printing
messages to the terminal, as this is already done
by the make function.
2020-06-03 14:46:15 +02:00
vocx-fc
623cd5df35 Draft: activate new array make functions
They are made available in the `Draft` namespace,
and are also used in the unit tests, the test script,
and the GuiCommands.
2020-05-18 12:42:10 +02:00
vocx-fc
3172e82dc1 Draft: move circular, ortho, and polar make functions
Previously they were in `draftobjects`, but since they
don't define new objects, just create objects,
they are moved to `draftmake`.

Also ajust the `CMakeLists.txt` and the corresponding Gui Commands
which use these make functions.

These functions internally use the `Draft.makeArray` function.
We will put comments as reminders so that when this function
is moved to its own module, we can update the derived functions.
2020-05-18 12:42:10 +02:00
vocx-fc
ef7e30c653 Draft: update description of drafttaskpanels package 2020-05-06 12:46:24 +02:00
vocx-fc
6d4ee479c0 Draft: small changes to the taskpanels for arrays 2020-04-24 13:49:13 +02:00
vocx-fc
9574c5698b Draft: parameters to control array options in the task panel
Use the value of the parameters `Draft_array_fuse`
and `Draft_array_Link` to set the default value
of the `Fuse` and `Link array` checkboxes in the task panels.
These default to `False` and `True`, respectively.

Whenever the user toggles a checkbox
the new value of the parameter is stored so that when
the command is used again the last state of the checkbox
is remembered.
2020-04-10 13:19:22 +02:00
vocx-fc
a24f86ef75 Draft: gui_ and task_polararray cleanup 2020-04-10 13:19:22 +02:00
vocx-fc
b43612787d Draft: gui_ and task_orthoarray cleanup 2020-04-10 13:19:22 +02:00
vocx-fc
68e3ab8dd1 Draft: gui_ and task_circulararray cleanup 2020-04-10 13:19:22 +02:00
vocx-fc
824199c9b8 Draft: move SelectPlane task panel to a separate module 2020-04-09 11:41:45 +02:00
vocx-fc
855dc4c989 Draft: docstrings for the submodules 2020-04-07 18:12:06 +02:00
vocx-fc
2cd9a542b5 Draft: task_scale, small style improvements 2020-04-02 16:53:49 +02:00
vocx-fc
2a340bcfd3 Draft: move ScaleTaskPanel to a module
We remove it from `DraftGui.py` to reduce the size of this file.
Then we import it and tie it to its command defined
in `DraftTools.py`.
2020-04-02 16:53:49 +02:00
vocx-fc
b82c9c4db1 Draft: task_shapestring, small style improvements 2020-04-01 13:22:04 +02:00
vocx-fc
46216d6032 Draft: move ShapeStringTaskPanel to a module
We remove it from `DraftGui.py` to reduce the size of this file.
Then we import it and tie it to its command defined
in `DraftTools.py`.
2020-04-01 13:22:04 +02:00
vocx-fc
e836811e3c Draft: improve the README files with links 2020-03-19 12:11:16 -03:00
Syres916
eebb73cfd2 [Draft] Orthoarray Task Panel Fix Z interval 2020-03-06 18:05:14 -03:00
vocx-fc
b25ca7194c Draft: lowercase use_link option for arrays
Inside the class `_DraftLink` the `onDocumentRestored` function
tests for the existence of the old attribute `useLink`. If it is
present, it uses it to define the new variable name `use_link`.
This is done use Python naming conventions.
The old `useLink` is deleted so it is not longer saved
together with the object when the document is saved.
2020-03-04 09:58:56 -03:00
vocx-fc
549ca9205b Draft: new Draft_OrthoArray command
It replaces the older `Draft_Array` command, and provides
a task panel to select the properties, similar to the
`Draft_PolarArray` and `Draft_CircularArray` commands.

It can also create `App::Links` directly from this task
panel, so it also replaces the `Draft_LinkArray`
introduced by the LinkMerge.
2020-03-03 21:27:31 +01:00