diff --git a/cadquery/cq.py b/cadquery/cq.py index 20b5f3727..b3cec0439 100644 --- a/cadquery/cq.py +++ b/cadquery/cq.py @@ -1413,6 +1413,8 @@ def _findFromPoint(self, useLocalCoords: bool = False) -> Vector: p = obj.endPoint() elif isinstance(obj, Vector): p = obj + elif isinstance(obj, Vertex): + p = obj.Center() else: raise RuntimeError("Cannot convert object type '%s' to vector " % type(obj)) diff --git a/tests/test_cadquery.py b/tests/test_cadquery.py index 86b919190..f3727d3a8 100644 --- a/tests/test_cadquery.py +++ b/tests/test_cadquery.py @@ -5917,3 +5917,11 @@ def test_compound_faces_center(self): ), "Incorrect center of mass of the compound, expected {}, got {}".format( expected_center, compound.Center() ) + + def test_line_from_vertex(self): + + # select one vertex and create an Edge + res = Workplane().rect(1, 1).vertices(">(1,1,0)").line(1, 0) + + # check if an Edge was created + assert isinstance(res.val(), Edge)