Commit Graph

82 Commits

Author SHA1 Message Date
Kevin Martin
44bb16cae7 Enable Python Draft import tests
A failing test was added to Draft tests to ensure CI catches it
2025-11-05 08:28:17 -05:00
marcuspollio
50e4864efb Add Draft workbench to .pre-commit-config (#24664)
* Add Draft workbench to .pre-commit-config

* [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>
2025-10-15 11:21:09 +02:00
Roy-043
1d38352607 Draft: Update Draft example file (#23284)
* Draft: Update Draft example file

Fixes #23198

I have added osifont-lgpl3fe.ttf to the example folder. The ShapeString in draft_test_objects.FCStd references it using a
relative path. I am not sure if including the font here is allowed though.

Additionally: The example file showed up an error in view_wire.py. It is also used for fillets (which do not have a Points property).

* Updated

* Also use a relative path for the PAT file.
* Subfolder for the PAT and TTF files.

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt
2025-09-25 14:21:12 +02:00
Pascal de Bruijn
3e6eacbf76 TechDraw: reorganize Templates (#23719) 2025-09-23 13:40:13 -05:00
Vincenzo Calligaro
b3e11ecd11 [Feature Request] [Draft] [UI/UX] Allow to turn dimension arrows on/off individually (#11941)
* Update additional files

* The LineColor and LineWidth properties are removed from Text objects.
* Arrow properties are added by the ViewProviderDraftAnnotation class only. This avoids code duplication.

* gui_annotationstyleeditor.py fix except

* view_draft_annotation.py fix except

---------

Co-authored-by: Roy-043 <info@b-k-g.nl>
Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2025-08-14 10:44:49 +02:00
Roy-043
8786cac938 Draft: project point in split operation and copy original wire (#22452)
* Roy 043 patch 1 (#6)

* Update split.py

* Update gui_split.py

* Add recompute to update wire in split test

* Avoid circular import: init_draft_statusbar -> params -> init_draft_statusbar

* Remove accidentally added "ui/preferences-webgl.ui"
2025-08-05 14:41:03 -05:00
Roy-043
b451193a49 Draft: aux.fake_function should not overwrite functions
The `aux.fake_function` is used in the Draft unit tests as a substitute for functions that, in most cases, do not yet exist. But in test_modification.py it would overwrite Draft.extrude leading to issues with BIM unit tests.

See:
https://github.com/FreeCAD/FreeCAD/pull/21134#issuecomment-2869178563
2025-05-12 10:45:45 -05:00
Roy-043
074807c378 Draft: change 'Filled' to 'Make face' in UI
Fixes #19715.

The related parameter has been renamed as well and other references to 'fill mode' have been updated.
2025-02-24 17:10:13 +00:00
Roy-043
d587e6a91a 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
2b35ad2281 Draft: Minor cosmetic changes to test files 2025-01-03 22:11:05 +01:00
Roy-043
28d177a725 Add another missing import 2025-01-03 20:32:17 +01:00
Roy-043
4ba16cebb7 Add missing import 2025-01-03 20:10:47 +01:00
Roy-043
0bc9737ca6 Draft: Introduce base classes for Draft tests
To avoid code duplication.
2025-01-03 16:51:42 +01:00
Roy-043
c7630ac065 Draft: Make test_modification tests independent of fillmode
Fixes #18315.

In the issue discussion the more obvious solution (change the MakeFace property of the Draft_Wires) was missed.
2025-01-03 11:38:51 +01:00
Chris Mayo
7183de92a4 Draft: Make startup and tests independent of BIM (#17390) 2024-11-16 17:43:46 +01:00
Roy-043
3bae98c2e5 Updated 2 file paths to make the code work with AppImage
As advised in this forum post:
https://forum.freecad.org/viewtopic.php?p=788556#p788556
2024-10-24 14:08:17 +02:00
Roy-043
d26ed298c4 Draft: fix errors in draft_test_objects.py
* Label property TextSize should be FontSize.
* Added missing recomputes.
2024-10-24 14:08:17 +02:00
wmayer
8fcaaed275 Draft: refactor TestDraftGeomUtils 2024-05-13 09:15:35 +02:00
Josh Coalson
a8ae56e06a Part: Rename AttachExtension::Support property to AttachmentSupport, to avoid name conflict with base features. Fixes #7052 2024-03-04 18:22:43 +01:00
Roy-043
5b98a762d1 Draft: Improve layer functions
The current make_layer function has a `None` default for the shape color and the line color. With that value the current preference is used. This, and how the function is called, results in some confusing behaviors:
* Newly created layers will only use 2 values from the preferences when they might use 5. The latter makes more sense for the end-user IMO.
* Layers created during DXF import (for example) will have a different shape color depending on the current preferences.
* The make_layer function may reapply colors that have already been set by the view provider.

To solve this all view property related function parameter have been changed to a not None value. If a None value is supplied the view property as set by the view provider is not changed. The Layer Manager has been updated accordingly.
I realize that calling a function with 6 None values is not very convenient, but think it is the solution that is least likely to break other exiting code.

Additionally:
* Removed the makeLayer function. Layers were introduced in V0.19 when the naming scheme was changed to "make_*". Maybe it was created by mistake, or before the actual renaming operation started, but it is safe to remove it now.
* Removed overly verbose messages.
* gui_layers.py had a missing import (result of a previous V0.22 PR): `from draftutils import utils`.
2024-01-22 11:29:13 -06:00
wmayer
736248e408 Draft: add unit test for issue #9912 2023-07-24 13:55:28 +02:00
Roy-043
52b41fee06 Draft: fix props_changed_placement_only for attached clones and similar (#9623)
For an attached object whose Shape depends on one or more source objects props_changed_placement_only should always return False.
2023-05-21 16:15:55 +02:00
luzpaz
129d5882a7 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
7352512f6c [Draft] fix Draft_Clone DiffuseColor delay issue during unit test (#8386) 2023-02-07 22:40:29 +01:00
Roy-043
f09d038ff5 Draft: add delay in the Draft_Clone unit test (#8363) 2023-02-05 21:59:39 +01:00
Roy-043
0a8ea55509 Draft: Update test_modification.py (#8273) 2023-01-27 14:21:55 +01:00
Roy-043
4c4972339f Draft: V0.18 VisGroups were not handled (#8234) 2023-01-23 11:27:52 +01:00
luzpaz
5fa4482504 Draft: fix trailing whitespace 2023-01-22 20:26:40 +01:00
Roy-043
6fe9bafb03 Draft: test_creation.py add 3 tests 2022-11-23 11:35:39 +01:00
Roy-043
3cdaf8b8bc Update test_modification.py
Added check if view is in page.OutList.
2022-11-20 22:09:04 +01:00
Roy-043
193d284c42 Draft: unit tests: replace test_draft_to_drawing with test_draft_to_techdraw 2022-11-20 11:47:43 +01:00
Roy-043
fc21d597a9 Draft: test_modification.py: modified test and added test (#7741)
The old test_offset_closed function was renamed to test_offset_rectangle_with_face.
It is now also a regression test for: #7670

The added test_offset_closed_with_reversed_edge function is a regression test for: #5496
2022-11-09 13:31:23 +01:00
wmayer
175ecbc50f Draft: handle the absence of the Drawing module in the unit tests 2022-06-26 12:07:48 +02:00
wmayer
02bc430fac Draft: handle the absence of the Drawing module in the unit tests 2022-06-25 18:05:23 +02:00
Roy
5bbf59141e Draft: Housekeeping: call 'make' functions with new name, continued 2022-02-12 19:34:57 +01:00
Roy-043
0d1488d661 Update draft_test_objects.py 2021-10-09 10:37:05 +02:00
Roy-043
09c0e03ec3 Update draft_test_objects.py 2021-10-09 10:32:50 +02:00
Yorik van Havre
49c71cb0b3 Merge branch 'master' into alafr-arch-structure 2021-03-26 11:08:01 +01:00
Benjamin Nauck
d32631cc54 [Draft] Add better error message in get_svg for direction
An AttributeError is raised when `direction=Vector(0,0,0)` and obj is
an Arch::Space on line: bead9bb938/src/Mod/Draft/draftfunctions/svg.py (L799)

This patch checks if early on if the direction vector and raises a
ValueError with a description of what has gone wrong.

A caveat with this solution is that this new behaviour might break old
code which depends on that invalid directions can be used.
2021-01-31 20:24:59 +01:00
marioalexis
c9d1d0c462 Draft: Improve makeWires in upgrade function 2020-12-09 15:21:33 -03:00
alafr
942b4748fc DraftGeomUtils: Doctstring formatting
Adress vocx-fc's review
2020-10-31 14:17:07 +01:00
alafr
5aa68ea294 Draft: test for DraftGeomUtils.get_extended_wire 2020-10-31 14:17:05 +01:00
Roy-043
2cf9f395c1 Draft: Again revised the 5 scale unit tests. No longer relying on the math module.
Also avoided the use of a Boolean 'result' variable.
2020-09-16 13:07:50 +02:00
Roy-043
30fd275089 Draft: Revised the 5 Draft.scale unit tests. No longer using scale_vector_from_center.
The old Draft.scale unit tests uses the scale_vector_from_center function from Draft.scale. This obviously didn't make sense.
2020-09-16 13:07:50 +02:00
Roy-043
687461cf15 Draft: added 5 scale unit tests to test_modifications
The added functions are test_scale_part_feature_arcs, test_scale_part_feature_lines, test_scale_rectangle, test_scale_spline and test_scale_wire.
When comparing vectors and floats a tolerance of 1e-8 is used, but only for the midpoints of the arcs in test_scale_part_feature_arcs is this tolerance required. Scaling a part feature is not possible with the Draft_Scale command, but Draft.scale does support it.
2020-09-16 13:07:50 +02:00
vocx-fc
7627d0b81a Draft: move getSVG to draftfunctions submodule
Small fixes where the `get_svg` function is used, for example,
in the (obsolete) `DrawingView` class and `Arch_SectionPlane`.

Also update the unit tests accordingly.
2020-09-09 12:53:54 +02:00
vocx-fc
d106be0b9b Draft: add Draft Layer unit tests
Also create a test `Layer` in the `draft_test_objects` script.
2020-07-20 14:21:15 +02:00
vocx-fc
f9d92f3f93 Draft: add modules of drafttests to the proper Doxygen group
This includes `auxiliary`, `draft_test_objects`, `test_airfoildat`,
`test_creation`, `test_dwg`, `test_dxf`, `test_import`,
`test_import_gui`, `test_import_tools`, `test_modification`,
`test_oca`, `test_pivy`, `test_svg`.

These are added to the `drafttests` 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
91a23e4a40 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
2877870318 Draft: new make_radial_dimension function for more precision
A single `make_dimension` handles three types of dimensions,
(1) simple linear, (2) linear linked to an object, and (3) linked
to a circular edge.

So, we provide a new function, `make_radial_dimension_obj`,
to handle the third case. In this way we can check the input
parameters much better.

We adjust the `Draft_Dimension` Gui Command accordingly.
2020-06-17 12:53:29 +02:00