aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Nordby <jononor@gmail.com>2016-06-16 20:19:07 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-06-16 20:40:55 +0200
commit0ee35488d5fcd259507b7ac9e0b794a24aacec07 (patch)
tree416d1f3f81cb6c1d215f499a680c426818f855c6
parent92dfe4037ed64796289e0053b8cd88e94df1d861 (diff)
downloadfreecad-boxer-0ee35488d5fcd259507b7ac9e0b794a24aacec07.tar.gz
freecad-boxer-0ee35488d5fcd259507b7ac9e0b794a24aacec07.tar.bz2
freecad-boxer-0ee35488d5fcd259507b7ac9e0b794a24aacec07.tar.xz
freecad-boxer-0ee35488d5fcd259507b7ac9e0b794a24aacec07.zip
Fix autolayout not correct for different sized sidesHEADmaster
Because Placement is based on midpoints, we have to space out the objects by half of the previous object + half of the current object.
-rw-r--r--Boxer.py20
1 files 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