From 5fecd87f489e0b321c9bd80eee902dca4da3641a Mon Sep 17 00:00:00 2001 From: Jeremy Mack Wright Date: Tue, 24 Nov 2015 16:28:25 -0500 Subject: [PATCH] Added code that uses a user defined label when adding a shape instead of a random ID. --- CadQuery/Helpers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CadQuery/Helpers.py b/CadQuery/Helpers.py index ea66bb2..3801fa4 100644 --- a/CadQuery/Helpers.py +++ b/CadQuery/Helpers.py @@ -10,8 +10,13 @@ def show(cqObject, rgba=(204, 204, 204, 0.0)): ad = FreeCAD.activeDocument() - #Generate a random name for this shape in case we are doing multiple shapes - newName = "Shape" + str(random()) + # If we've got a blank shape name, we have to create a random ID + if not cqObject.val().label: + #Generate a random name for this shape in case we are doing multiple shapes + newName = "Shape" + str(random()) + else: + # We're going to trust the user to keep labels unique between shapes + newName = cqObject.val().label #Set up the feature in the tree so we can manipulate its properties newFeature = ad.addObject("Part::Feature", newName)