Commit Graph

20 Commits

Author SHA1 Message Date
Roy-043
2b35ad2281 Draft: Minor cosmetic changes to test files 2025-01-03 22:11:05 +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
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
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
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
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
vocx-fc
984de3b3da Draft: new make_linear_dimension functions 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 two new functions, `make_linear_dimension`
and `make_linear_dimension_obj`, to handle the first two cases.
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
vocx-fc
e81ca586a2 Draft: move make_dimension function to its own module
Previously the `make_dimension` and `make_angular_dimension`
functions were in `draftobjects/dimension.py`.
Now they are moved to `draftmake/make_dimension.py`.

The original `makeAngularDimension` function requires angles
in radians which is counterintuitive for most cases. Also
the order is `[big, small]`.

The new function `make_angular_dimension` accepts angles
in degrees, and the order is `[small, big]`. The older
function is retained for compatibility purposes.

Also perform several improvements such as PEP8 cleanup,
writing complete docstrings, type checking the input arguments,
and depreacting the older call.

The `Draft.py` module, Gui Command, unit test, and test script
are updated accordingly.
2020-06-17 12:53:29 +02:00
vocx-fc
c7eab9c65e Draft: move make_label function to its own module
Also perform several improvements such as PEP8 cleanup,
writing complete docstrings, type checking the input arguments,
and deprecating the older call.

Update `Draft.py`, the Gui Command, the unit test, and test script
as well.
2020-06-15 10:01:04 +02:00
vocx-fc
9919849de5 Draft: migrate PointList property to PointObject in PointArray
Use the `onDocumentRestored` method to check for the old
property.

Also modify the position of the base object in the draft test
script.
2020-06-03 14:44:00 +02:00
vocx-fc
a4367d0585 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
021b07b7bc Draft: restructure the draft test script
Add new function `_create_objects`.

Change annotations to use `App::Annotation` instead of `Draft Text`.
2020-05-18 12:41:24 +02:00
vocx-fc
50c2f31f6b Draft: use snake case functions in draft_test_objects script 2020-05-15 14:44:48 +02:00
vocx-fc
cc5d531a59 Draft: small additions to the draft_test_object script
Move the docstring, set the frame as a private function,
and set `MakeFace` to `False`.

Use user's home directory to create the file. Move the order of
the parameters of the function.
2020-05-15 14:44:48 +02:00
vocx-fc
d438aec821 Draft: remove old DraftFillet class, and make it a redirect
Remove the make function that creates the old object,
its corresponding Gui Command, and the old `DraftFillet.Fillet`
proxy class, which now is a redirection to the new `Fillet`
class defined in `draftobjects.fillet`.

Also change the unit test, and the `draft_test_object` script
to run `Draft.make_fillet`.
2020-05-13 11:37:56 +02:00
vocx-fc
de9c9a6be2 Draft: move arc_3points to the make package
Also import it in the `Draft` namespace so that is available
as `Draft.make_arc_3points`.

Use this new function in the unit test `drafttests.test_creation`,
in the GuiCommand `draftguitools.gui_arcs`, and in the
`draft_test_objects` script.
2020-05-12 10:00:41 +02:00
vocx-fc
fb4a992ce0 Draft: add script to produce a test file as example
The test script can be run by the program's executable
or run as a macro.
```
freecad draft_test_objects.py
```

It can also be used as a Python module within the program
to create a test file on demand.
```
import drafttests.draft_test_objects as dt
dt.create_test_file()
```

The produced test file will be added in a different commit
once this commit is merged.
The idea is to have a test file created by a certain
stable version of the master branch. Then as the code
continues to change and grow, this file can be opened
with future versions of the program to test for compatibility
and regressions.
2020-03-12 09:06:11 -03:00