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.
This commit is contained in:
vocx-fc
2020-06-09 18:03:10 -05:00
committed by Yorik van Havre
parent e81ca586a2
commit 984de3b3da
5 changed files with 418 additions and 134 deletions

View File

@@ -170,8 +170,8 @@ class DraftCreation(unittest.TestCase):
obj = Draft.make_text(text)
self.assertTrue(obj, "'{}' failed".format(operation))
def test_dimension_linear(self):
"""Create a linear dimension."""
def test_dimension_linear_simple(self):
"""Create a simple linear dimension not linked to an object."""
operation = "Draft Dimension"
_msg(" Test '{}'".format(operation))
_msg(" Occasionally crashes")
@@ -180,7 +180,23 @@ class DraftCreation(unittest.TestCase):
c = Vector(4, -1, 0)
_msg(" a={0}, b={1}".format(a, b))
_msg(" c={}".format(c))
obj = Draft.make_dimension(a, b, c)
obj = Draft.make_linear_dimension(a, b, c)
self.assertTrue(obj, "'{}' failed".format(operation))
def test_dimension_linear_obj(self):
"""Create a linear dimension linked to an object."""
operation = "Draft Dimension"
_msg(" Test '{}'".format(operation))
_msg(" Occasionally crashes")
a = Vector(0, 0, 0)
b = Vector(9, 0, 0)
_msg(" a={0}, b={1}".format(a, b))
line = Draft.make_line(a, b)
self.doc.recompute()
obj = Draft.make_linear_dimension_obj(line,
i1=1, i2=2,
dim_line=Vector(5, 3, 0))
self.assertTrue(obj, "'{}' failed".format(operation))
def test_dimension_radial(self):