Commit Graph

133 Commits

Author SHA1 Message Date
Roy-043
af96e50eea Draft: improve upgrade and downgrade
Fixes #16333.
Follow-up of #19487.

* The functions have been made nesting-aware. New objects are put in the same container (Group, Part) as the original objects. As a consequence for some operations the original objects must be in the same container as well.
* New objects receive the visual properties of the original objects. This is not always perfect. For example when upgrading to multiple wires there is currently no check to see which edge came from which orginal object. The fact that the `format_object` function is called from the Draft `make*` functions is problematic here. If construction mode is active `make_wire` puts new objects in the construction group and we don't always want that. This has been solved with a workaround (see 'cludge' in the code).
* The 'de-parametrize' downgrade option has also been enabled for features of PartDesign Bodies that have the `Profile` property.
* Before deleting objects there is a check to see if they are in use elsewhere (`InList` check). Base objects of arrays are not deleted if they are visible. If a PartDesign Body, or an object inside a Body is selected, the whole Body is deleted.
* The force options did not work for functions that take a single object.
* The `getShapeFromMesh` function in ArchCommands.py could return a solid that was not closed. A check for that has been added.
2025-02-19 18:06:12 +01:00
Roy-043
1de045ae66 Draft: make arrays explodable
Fixes #13085.

This PR adds the `PlacementList` property to non-link arrays.
2025-02-08 19:20:33 +01:00
Roy-043
da3b9b5960 Draft: fix handling of annotation Links in TD DraftViews
Fixes #19199.
2025-01-28 17:37:29 +01:00
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
Roy-043
a78b7ae66a Draft: Remove unnecessary CamelCase names
The related functions were introduced in V0.19. They should not be also available under CamelCase names.
2024-12-26 12:06:29 +01:00
Yorik van Havre
14585a760e BIM: NativeIFC 2D support - section planes 2024-12-11 10:24:43 +01:00
Roy-043
de137c6efd Draft: Draft_Split: apply original view props to split off object
Fixes #16210.

Note that `Draft.format_object` is called from gui_split.py (in the commit). This is not consistent with other tools where this is handled in the `make_*` functions. In this case the new object is formatted twice. The 1st time by the `make_wire` code which (wrongly) applies the current default props.
2024-11-29 10:56:29 +01:00
Roy-043
8d54fdc0bc Draft: fix handling of Links in TD DraftViews
Forum topic:
https://forum.freecad.org/viewtopic.php?t=92476

For LinkGroups and Links to Std_Groups that do not have a default placement, a temporary hidden document is used to handle the placement of their children. This is a bit of a hack of course.
2024-11-29 10:55:31 +01:00
Yorik van Havre
726999c9ec Draft: Implement unhandled svg text rotation 2024-11-15 12:09:53 -05:00
Roy-043
b665fda4df Draft: Improve layer drag-drop fix.
The fix in #16212 only checks the LayerContainer for layers. Since we do not stop users from moving layers out of that container, we should search the whole document instead.

Fixes: #16201.
2024-10-17 12:29:42 +02:00
Roy-043
673068e6dd Draft: Fix upgrade function: delete argument was ignored in case of draftify
Forum topic:
https://forum.freecad.org/viewtopic.php?t=91357
2024-10-14 08:19:03 -05:00
Roy-043
ae015a18b4 Draft: avoid confusing SVG warning for nested circles and ellipses
Forum topic:
https://forum.freecad.org/viewtopic.php?t=90942
2024-10-07 15:07:51 +02:00
Roy-043
4f7aae94c1 Draft: Fix regression with layer print color
Problem with the same cause as #16212.
2024-09-16 10:07:40 +02:00
Roy-043
152d642b60 Draft: revert Draft WB changes from #13294
Revert the Draft WB related changes of #13294.
2024-04-24 21:27:04 +02:00
David Carter
ba20441935 Material: Material appearance
Uses new material system for appearance

Each feature object now has a property called ShapeMaterial that
describes its physical properties. If it has a shape, it has a
material.

The ShapeColor attribute is replaced by a ShapeAppearance attribute.
This is a material list that describes all appearance properties, not
just diffuse color. As a list in can be used for all elements of a
shape, such as edges and faces.

A new widget is provided to allow the user to select materials in a
consistent fashion. It can also launch the material editor with its
more advanced capabilities.
2024-04-04 07:39:58 -05:00
Roy-043
0beda2c1bd Draft: fix wrong selection after commands (improved)
The previous fix was not correct. Some commands would cause a crash and several files were missed.

Forum topic reporting a crash:
https://forum.freecad.org/viewtopic.php?t=85243
2024-02-16 10:56:10 +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
59753260c9 Draft: implement new get_param functions (step 1)
See #11677
2023-12-11 19:31:34 +01:00
Roy-043
d065f13f67 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
3395b2e2f6 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
CalligaroV
457b676972 [Feature Request] [Draft] [UI/UX] Remove the center arrow on radial dimensions (#10655)
Related to issue #7573

Forum discussion

https://forum.freecadweb.org/viewtopic.php?p=631252#p631252

These modifications don't add the new properties suggested on the issue mentioned above and suggested on the forum discussion but just remove the center arrow

Other info and discussion can be found at https://gitlab.com/calligarov/FreeCAD/-/merge_requests/1
2023-09-13 15:27:51 +02:00
Roy-043
b83e401836 Draft: Avoid dictionary.keys() where possible (#10160) 2023-08-13 11:46:25 +02:00
Roy-043
7d15cee092 Draft: Fix SVG "Edges not ordered" issue (#10116) 2023-08-12 15:30:54 +02:00
luzpaz
a6202bc3ce Fix various typos 2023-08-08 14:25:00 +02:00
Roy-043
dc7b018e75 Draft: Improve downgrading of PD bodies (#9934) 2023-07-18 10:46:10 +02:00
Roy-043
d7923d2f56 Draft: get_svg: loose edges in obj with faces also received a fill (#9695) 2023-05-30 08:13:47 +02:00
Yorik van Havre
8049752bb9 Draft: Better svg linestyle settings - fixes #6733 2023-05-10 10:14:33 +02:00
Yorik van Havre
5f3b77cbd7 Merge pull request #9376 from Roy-043/Draft-Remove-Drawing-WB-related-code-from-DXF-related-files
Draft: Remove Drawing WB related code from DXF related files
2023-04-28 12:48:08 +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
35cca8d2d7 Draft: Remove Drawing WB related code from DXF related files 2023-04-24 16:01:10 +02:00
luzpaz
0e1530be59 Draft: linting bad indentations, superflous markup (#9313) 2023-04-19 09:48:57 +02:00
mosfet80
e9c1a1600a [Draft] Remove obsolete code related to Drawing WB
* [Draft] Remove obsolete code related to Drawing WB




remove unused elif

* [Draft] Remove obsolete code related to the Drawing WB

* Update preferences-draftvisual.ui

Also remove the template label.

* Update utils.py

Remove reference to "template"

* Remove Draft_Drawing.svg from Draft.qrc

---------

Co-authored-by: Roy-043 <info@b-k-g.nl>
Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2023-04-03 16:36:23 +02:00
Roy-043
b5ade2c085 [Draft] Remove obsolete decode code (#9106) 2023-03-28 21:03:33 +02:00
Yorik van Havre
a095085258 Draft: Removed six module 2023-02-24 13:20:58 +01:00
Roy-043
b461e81dc6 [Draft] typo: object name should be capitalized (#8484) 2023-02-14 15:44:26 +01:00
Roy-043
6da0eec51a Draft: subelement mode ignored nesting (#8319) 2023-02-02 11:49:55 +01:00
Roy-043
f9cdaaf3d9 Draft: fix issue with undo (#8267) 2023-01-31 21:38:19 +01:00
luzpaz
a4239ccfcf Draft: fix trailing whitespace 2023-01-22 20:26:40 +01:00
Roy-043
1eddd842f9 Draft: rotate.py: remove Placement.rotate() workaround (#8230) 2023-01-22 16:29:15 +01:00
Roy-043
f7a072b7c7 Draft: Fix and improve Draft_AnnotationStyleEditor (#8207)
* Draft: Fix and improve Draft_AnnotationStyleEditor

* Draft: Fix and improve Draft_AnnotationStyleEditor 2
2023-01-21 10:28:47 +01:00
Yorik van Havre
858abcdd25 Merge pull request #8081 from Roy-043/Draft-Fix-inconsistent-properties-of-Draft-annotations
Draft: Fix inconsistent properties of Draft annotations
2023-01-13 11:47:00 +01:00
jim
9e2856348e Make upgrades of type "draftify" return the new object (like the other
upgrade types do)
2022-12-26 13:32:26 -08:00
Roy-043
d3955711c5 Draft: Fix inconsistent properties of Draft annotations 2022-12-23 16:49:56 +01:00
Roy-043
6f3183f793 Draft: fix move AngularDimension bug (#8047) 2022-12-15 12:04:12 +01:00
Chris Hennes
a4bb55a34e Draft: Remove py2 references 2022-11-09 14:08:54 +01:00
Roy-043
b280f2fb9e Draft: fix rectangle with face offset bug 2022-10-30 12:49:28 +01:00
Roy-043
f62f335906 Draft: Fix alignment of angular dimension arrows in svg.py 2022-10-10 21:07:43 +02:00
Roy-043
02170da098 Update rotate.py
Workaround for `faulty` implementation of Base.Placement.rotate(center, axis, angle).
See: https://forum.freecadweb.org/viewtopic.php?p=613196#p613196
2022-07-28 13:46:26 +02:00
Roy-043
01d4186535 Draft: Fix handling of groups on move-copy and rotate-copy 2022-07-26 11:26:50 +02:00
Uwe
32ab100ed5 Mod: remove some superfluous Boolean checks (#7213)
* Mod: remove some superfluous Python Boolean checks
2022-07-19 01:35:12 +02:00