Skip to content

Commit 7c684ae

Browse files
committed
[BoxCreator] Create a new document if necessary
- Create a new document if necessary. - Make some functions "private". - Fix some whitespace. - Deduce the document from argument `box` in `create_compartment`.
1 parent baab6df commit 7c684ae

File tree

2 files changed

+155
-111
lines changed

2 files changed

+155
-111
lines changed

ObjectCreation/BoxCreator.FCMacro

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
__Name__ = 'BoxCreator'
44
__Comment__ = 'Creates a box with interlocked notches'
55
__Author__ = 'christi'
6-
__Version__ = '1.3.2'
7-
__Date__ = '2020-02-08'
6+
__Version__ = '1.3.3'
7+
__Date__ = '2020-03-10'
88
__License__ = 'LGPL-3.0-or-later'
9-
__Web__ = 'https://github.com/chbergmann/boxcreator'
9+
__Web__ = 'https://forum.freecadweb.org/viewtopic.php?t=31795'
1010
__Wiki__ = ''
1111
__Icon__ = ''
1212
__Help__ = 'Try it out and play with it. It should be self explanatory'
@@ -20,7 +20,7 @@ import os
2020

2121
import FreeCAD as app
2222
import FreeCADGui as gui
23-
from PySide import QtGui
23+
from PySide import QtGui # Special FreeCAD's PySide.
2424
from FreeCAD import Vector
2525

2626
from boxcreator import boxcreator
@@ -73,6 +73,8 @@ class BoxcreatorDialog():
7373
gui.Selection.clearSelection()
7474
gui.Selection.addSelection(box)
7575
gui.SendMsgToActiveView('ViewFit')
76+
del self.widget
77+
del self.form
7678

7779
def compartmentX(self):
7880
self.createCompartment(Vector(1,0,0))
@@ -95,7 +97,7 @@ class BoxcreatorDialog():
9597
self.form.checkBoxBack.isChecked()]
9698
offset = self.form.compartmentOffset.value()
9799
boxsize = Vector(self.form.doubleSpinBoxWidth.value(), self.form.doubleSpinBoxLength.value(), self.form.doubleSpinBoxHeight.value())
98-
compartment = boxcreator.create_compartment(box, direction, offset, materialWidth, notchWidth, drawSides, boxsize, app.activeDocument())
100+
compartment = boxcreator.create_compartment(box, direction, offset, materialWidth, notchWidth, drawSides, boxsize)
99101
if compartment:
100102
gui.Selection.clearSelection()
101103
gui.Selection.addSelection(compartment)

0 commit comments

Comments
 (0)