An AttributeError is raised when `direction=Vector(0,0,0)` and obj is
an Arch::Space on line: a3fb3cc804/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.
The name of the argument, `projection`, in the old function
is incorrect; it should be `direction`, which was the original
argument's name when this method was split into its own module
(6c00fcf).
If it's not a circle nor ellipse nor straight line
convert the curve to BSpline. Move into a subfunction.
Improve a few varible names to be more verbose, like `vertex`
and `edge`.
The angle between the curve and plane is tested for being coplanar,
0 or 180 degrees. The negative test is done earlier so that the
return is done earlier, and the rest of the code is not indented.
For the try-except blocks we should trap a specific `Exception`,
not just any type. It seems string handling was an issue
with Python 2, so the string needed UTF8 decoding.
When the software no longer supports Python 2, these
blocks can be removed.
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.
This includes `array`, `cut`, `downgrade`, `draftiffy`, `extrude`,
`fuse`, `heal`, `join`, `mirror`, `move`, `offset`, `rotate`,
`scale`, `split` and `upgrade`.
These are added to the `draftfunction` 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.
Also make various improvements in style, PEP8, return value
is now a tuple of lists instead of a list of lists.
Delay the import of other modules like `Part` and `DraftGeomUtils`
using the `LazyLoader` class.
Update the Gui Command as well.