From fa3277e6a0cdcbe85670a86b566433e82ff107be Mon Sep 17 00:00:00 2001 From: Marcus Boyd Date: Sun, 19 Jan 2020 08:41:43 +1030 Subject: [PATCH] Renamed getTagged to _getTagged --- cadquery/cq.py | 8 ++++---- tests/test_cadquery.py | 26 +------------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/cadquery/cq.py b/cadquery/cq.py index aa2225d3..818c7734 100644 --- a/cadquery/cq.py +++ b/cadquery/cq.py @@ -279,7 +279,7 @@ class CQ(object): """ return self.objects[0] - def getTagged(self, name): + def _getTagged(self, name): """ Search the parent chain for a an object with tag == name. @@ -293,7 +293,7 @@ class CQ(object): if self.parent is None: raise ValueError("No CQ object named {} in chain".format(name)) else: - return self.parent.getTagged(name) + return self.parent._getTagged(name) def toOCC(self): """ @@ -480,7 +480,7 @@ class CQ(object): :type name: string :returns: a CQ object with name's workplane """ - tagged = self.getTagged(name) + tagged = self._getTagged(name) out = self.copyWorkplane(tagged) return out @@ -590,7 +590,7 @@ class CQ(object): solids,shells, and other similar selector methods. It is a useful extension point for plugin developers to make other selector methods. """ - cq_obj = self.getTagged(tag) if tag else self + cq_obj = self._getTagged(tag) if tag else self # A single list of all faces from all objects on the stack toReturn = cq_obj._collectProperty(objType) diff --git a/tests/test_cadquery.py b/tests/test_cadquery.py index 0520fb41..64e8e36a 100644 --- a/tests/test_cadquery.py +++ b/tests/test_cadquery.py @@ -2751,33 +2751,9 @@ class TestCadQuery(BaseTest): .box(1, 1, 1, combine=False).tag("2 solids") .union(Workplane("XY").box(6, 1, 1))) self.assertEqual(len(result.objects), 1) - result = result.getTagged("2 solids") + result = result._getTagged("2 solids") self.assertEqual(len(result.objects), 2) - # tags can be used to create geometry for construction - part = ( # create a base solid - Workplane("XY").box(1, 1, 1).tag("base") - # do some stuff "for construction" - .faces(">Y").workplane().box(1, 3, 1) - .faces(">Z").workplane().box(2, 1, 1) - .faces(">X").workplane() - # create an edge, which CadQuery adds to the modelling context - .circle(0.5) - # go back to base object, but modelling context is preserved - .getTagged("base") - .faces(">Z").workplane().circle(0.5) - # loft between the top of the base object and the wire at the end of the "for construction" code - .loft() - ) - # assert face is made at the end of the construction geometry - self.assertTupleAlmostEquals(part.faces(">X").val().Center().toTuple(), - (1.0, 0.5, 1.5), - 9) - # assert face points in the x-direction, like the construction geometry - self.assertTupleAlmostEquals(part.faces(">X").val().normalAt().toTuple(), - (1.0, 0, 0), - 9) - def testCopyWorkplane(self): obj0 = Workplane("XY").box(1, 1, 10).faces(">Z").workplane()