ref. Forum discussion: Draft_OrthoArray: Crash when using active Std_Part. https://forum.freecadweb.org/viewtopic.php?f=23&t=59155&p=508132#p508132
Autogroup try to add new created Draft Objects into the active Part, but if the Part is used as a Base for the new object this could create a cyclic reference.
This behaviour is prevented by adding a check for " obj in active_part.InListRecursive"
This caused the original object to be moved when using the Draft move
tool to move a link object, when the original object has MoveWithHost
set (e.g. a Window). There was already a similar exception for clones,
so it makes sense to extend this for links too.
Note that there seem to be more problems with the "MoveWithHost"
mechanism and fixing them might completely refactor this code, but until
then, this is a simple and targeted fix that at least makes moving
links to windows work as expected.
See https://forum.freecadweb.org/viewtopic.php?f=23&t=57223 for
discussion of this bug, its fix and the additional problems mentioned.
From time to time when switching to other workbenches snap_widget changes
orientation to vertical. Make sure it stays horizontal.
Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>
This commit does the following things:
* Remove python2 support
* Using a bytearray instead of chr list to build up the binary data.
this also removes the need of using char encoding.
Normally the bounding box is taken from `Shape.BoundBox`.
Certain objects don't have a `Shape`, like `App::FeaturePythons`,
so the bounding box is calculated from `ViewObject.RootNode`.
As suggested by @Vanuan. and already implemented in new experimental BIM Wall: 1084a4b0a9
Draft: updated Draft Edit
thanks to the suggestions by @Vanuan
Draft: further bugfixing and improvements in Draft_Edit
Draft: moved Draft_Edit preview code into respective GuiTools
This includes `gui_utils`, `init_draft_statusbar`, `init_tools`,
`messages`, `todo`, `translate`, `utils`.
These are added to the `draftutils` Doxygen group
so that the functions contained in each module are listed
appropriately in the automatically generated documentation.
These functions were previously in `draftutils.utils`,
and are related to grouping objects and finding objects
inside groups. These include `get_group_names`, `ungroup`,
`get_windows`, `get_group_contents`, `get_movable_children`.
These are imported in the main `Draft.py` module, so compatibility
is retained.
Modules which use these functions are updated; these include
Gui Commands like `Move`, `Rotate`, `Scale`, `AddToGroup`,
as well as objects like `DrawingView` and `Shape2DView`,
and `ViewProviderClone`.
The code inside the `importDXF` module is also updated.
The Arch Workbench uses many of these functions
but it does so from the `Draft` namespace, so these edits
don't change the situation for these commands.
The old `convertDraftTexts` function was moved from the `Draft.py`
module to the `draftutils.utils` module; however, here it is
not possible to use because the `makeText` function
is not accessible. Therefore, the function is moved to
`draftmake.make_text`.
The functions `getDefaultUnit`, `makeFormatSpec`, `displayExternal`
are used to get the default unit schema for lengths and angles,
and display a string with a particular format.
They aren't used in `DraftGui.py`, but are used by the
viewprovider of the Dimension objects. Therefore, they are moved
into a separate module, so that they can be imported without
using the entire `DraftGui` module.
Various improvements in style, PEP8, spacing, docstrings.
Improve the methods to update the text, the arrow, and the frame
of the label.
Options to handle `Justification` and `LineSpacing` are added.
These can be handled just like with the `ViewProviderText` object,
as the internal text node is the same, a `SoAsciiText`.
Nevertheless, currently the leader line and the frame that are
drawn for the label don't consider the correction in position
for the `Justification` or `Linespacing` so the graphics
may be overlapped in certain situations.
Various improvements in style, PEP8, spacing, docstrings.
The list of strings is set to empty before being assigned again.
This solves a problem of the text not being updated correctly.
In the past some `try-except` blocks were there to catch and
ignore certain exceptions that apparently were caused by a
race condition, where certain properties are not assigned
to the object before they are used. These errors
don't seem to occur in v0.19, so we removed the exception
handling. We leave comments mentioning the issue
in case it re-appears.
The `DisplayMode` is swapped, so now `'2D text'` means that the
text always faces the camera, and `'3D text'` means that the
text can be positioned in different orientations in the 3D space.
This is consistent with the `Draft Label` behavior.
A function `draftutils.gui_utils.migrate_text_display_mode`
is provided to help migrate older objects of type `Text`
or `DraftText` to the new display mode.
These style properties are used by `ViewProviderDraftAnnotation`
and by the Gui Command `Draft_AnnotationStyleEditor`.
Therefore, they are moved from `draftguitools.gui_annotationstyleeditor`
module to the `draftutils.utils` module, so that they
are in a central location where they won't cause circular
dependencies.
This function, `draftutils.gui_utils.format_object`,
takes the value defined in the `DrafToolBar`, and uses it
to specify the `FontSize` for `Text` objects.
Now it specifies the `TextSize` for `Label` elements as well.
Also add `find_doc` to be able to test the existence of an
active document before searching for the object.
These can be used in the make functions of most modifier commands.
Started a general refactor to handle all the conversion between global and object coordinate system inside the main methods and just use object coordinates inside object functions.
Draft: Edit reordering 2
Fixed Editing of Part objects according to the new refactor
Draft: fix in autogroup function for dimensions
Draft: fixed Polygon editing when inscribed or circumscribed
Draft: Edit support for Ellipse object
.
Draft: Edit docstrings
Draft: Edit reordering 3
Draft: Fixed Edit for structure object
And also refactor Edit methods that control special object display during editing.
Draft: Fixed edit for arch wall object
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`.
In this moment the old fillet tool is `Draft_Fillet`
and the new tool is `Draft_Fillet_new`. They are imported both,
so they can both be tested from the interface.
The error is both sent to the log file and to the console
instead of only the log.
This is helpful to troubleshoot problems with the delayed
execution of commands, such as when testing a relatively
broken version like d7a9f2ebf9.