Commit Graph

63 Commits

Author SHA1 Message Date
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
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
835f4b424f Draft: clean up code, PEP8, and docstrings in PathArray
Test the inputs to the `make_path_array` function
and return `None` if there is a problem.

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.

Add the new parameters to the make function, `align_mode`,
`tan_vector`, `force_vertical`, and `vertical_vector`.
These properties were added to the proxy object in ff323ebdb5.

Add  message deprecating the older call `makePathArray`.

Adjust the GuiCommand accordingly. Now it uses the commit
mechanism of the parent `Modifier` class so that the executed
functions are recorded in the Python console.

Clean up the `PathArray` class as well.
2020-06-05 13:14:46 +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
e9baea434e Draft: update snake_case for unit tests
Also fix the name of certain functions.

Do not import `DraftFillet` any more as it's just kept
for compatibility purposes.

Do not test OCA nor AirfoilDAT as it's very improbable
that these formats will gain more support any time soon.
2020-05-15 14:44:48 +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
e39c45d8ed Draft: update description of drafttests package 2020-05-06 12:46:24 +02:00
vocx-fc
8141096344 Draft: circulararray, clean up imports, docstrings, and checks 2020-04-08 11:08:29 +02:00
vocx-fc
26864d9633 Draft: moved some unit tests to TestDraftGui
Those unit tests that are registered in `Init.py` will always run,
while those that are registerd in `InitGui.py` will only run
when the graphical interface is available.

This allows us to more clearly distinguish functions that
should be able to run always, from those that may run only
when the interfce is available.
2020-04-08 11:07:51 +02:00
vocx-fc
5147ffd496 Draft: Coin (Pivy) tests only when the graphical interface is up 2020-04-08 11:07:51 +02:00
vocx-fc
d1c0f2f2f0 Draft: docstrings for the submodules 2020-04-07 18:12:06 +02:00
vocx-fc
a45738c629 Draft: update unit test for gui_edit 2020-04-06 12:51:55 +02:00
vocx-fc
6f028e0395 Draft: update unit test for gui_selectplane 2020-03-31 12:00:38 +02:00