From 0ee35488d5fcd259507b7ac9e0b794a24aacec07 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Thu, 16 Jun 2016 20:19:07 +0200 Subject: Fix autolayout not correct for different sized sides Because Placement is based on midpoints, we have to space out the objects by half of the previous object + half of the current object. --- Boxer.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Boxer.py b/Boxer.py index 95e4704..b465746 100644 --- a/Boxer.py +++ b/Boxer.py @@ -442,22 +442,22 @@ def make(doc, cfg): pos = Vector(0, 0, 0) r = Rotation(Vector(0, 0, 1), 0) # print('pos: ' + str(pos.x)) + previous = None for sideType in SideType: try: view = views[sideType] -# print('view.Shape.BoundBox: ' + str(view.Shape.BoundBox) + ', .XLength: ' + str(view.Shape.BoundBox.XLength) + ', .Center: ' + str(view.Shape.BoundBox.Center)) + if previous: + pos.x += previous.Shape.BoundBox.XLength/2 -# if pos.x == 0: -# pos.x += -view.Shape.BoundBox.XMin -# print('first: pos: ' + str(pos.x)) + pos.x += view.Shape.BoundBox.XLength/2 + pos.x += 10 # spacing between each side + view.Placement = Placement(Vector(pos), r) - view.Placement = Placement(pos, r) -# print('Placement: ' + str(view.Placement.Base) + ', BoundBox: ' + str(view.Shape.BoundBox)) - pos.x += view.Shape.BoundBox.XLength - pos.x += 10 # 10mm spacing between each side + #print('Placement: ', view.Placement.Base) viewsGroup.addObject(view) - except KeyError: - pass + previous = view + except KeyError, e: + print('error finding view', e) viewsGroup.ViewObject.Visibility = False -- cgit v1.2.3