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.
This commit is contained in:
vocx-fc
2020-06-09 15:23:23 -05:00
committed by Yorik van Havre
parent 63df9aa7dc
commit 93f1e87bc0
7 changed files with 408 additions and 214 deletions

View File

@@ -39,7 +39,6 @@ Or load it as a module and use the defined function.
# @{
import datetime
import math
import os
import FreeCAD as App
@@ -260,8 +259,8 @@ def _create_objects(doc=None,
_msg("Angular dimension")
Draft.make_line(Vector(10500, 300, 0), Vector(11500, 1000, 0))
Draft.make_line(Vector(10500, 300, 0), Vector(11500, 0, 0))
angle1 = math.radians(40)
angle2 = math.radians(-20)
angle1 = -20
angle2 = 40
dimension_a = Draft.make_angular_dimension(Vector(10500, 300, 0),
[angle1, angle2],
Vector(11500, 300, 0))