Open florianfesti opened 7 years ago
Hi! Well done with the project. Your presentation has a "Box2.py with bedbolts". I could not find such a file in the repo. So can I produce files for a box with bedbolts, or do I have to wait for this issue to close?
Box2 got renamed to UniversalBox - which already has a settings page like a cockpit of a 747. So that's probably not the right place to start with this feature.
If you want to toy around with bed bolts you can remove the following line from boxes/generators/closedbox.py:
d2 = d3 = None
The issue with this ticket is that I only use ply wood for my boxes which works just fine without bed bolts. And I really don't know what settings one would want/need to make them useful. If you are able to provide some input adding the code may be not that difficult.
I did comment out that line in boxes/generators/closedbox.py
and in boxes/generators/universalbox.py
, but see no bedbolts in the output. I call
scripts/boxes [closedbox | universalbox] --thickness=5 --output=test.svg --format=svg --x=254 --y=300 --h=100
Is this the right call?
You should at least see some bed bolt slots. I "fixed" the closed box to have them at all the right places - not just somewhere random.
Mmm, I have these lines in boxes/generators/closedbox.py
:
d2 = edges.Bolts(2)
d3 = edges.Bolts(5)
#d2 = d3 = None
And I see no bed bolts, as in this image where Inkscape emphasizes the anchor points of the path for one of the sides:
Do you get bed bolts when you comment out line 45?
Yes.
I think I have the wrong setup. If I rename closedbox.py
to closedbox2.py
or add a false assertion in the class:
class ClosedBox(Boxes):
"""Fully closed box"""
assert False, "Does the script hit this line?"
then the call
scripts/boxes closedbox --thickness=5 --output=test.svg --format=svg --x=254 --y=300 --h=100
still produces a file, instead of an error. @florianfesti can you tell me your setup?
You need to rename the class as the generators are presented by class name not by file name. Otoh I am kinda surprised it won't trigger the line as I'd expect that the class would at least be parsed...
oh, may be delete the .pyc and or .pyo files. If they have messed up (aka future) dates they can prevent the .py files from being read.
I renamed the class as well:
class ClosedBox2(Boxes):
"""Fully closed box"""
assert False, "Does the script hit this line?"
and I get the same result. I only have one .pyc
file in the directory and no .pyo
:
> find . -name *.pyc
./boxes/__pycache__/__init__.cpython-37.pyc
> find . -name *.pyo
>
Deleting that file made no difference.
I tried the same modifications in the sub-directory build
, with a similar command and the same result:
> build/scripts-3.7/boxes closedbox --thickness=5 --output=test.svg --format=svg --x=254 --y=300 --h=100
>
Hmm, looks like it imports the files from somewhere else. May be you installation in the the main Python instance. You can do import boxes.generators.closedbox in the Python shell and then print(boxes.generators.closedbox.__file__)
I was unable to do import boxes.generators.closedbox
but able to do import boxes
. I removed the installation and print(boxes.__file__)
was pointing to the Trash. I cleared the trash and installed boxes
again, and now I see
>>> import boxes.generators.closedbox
>>> print(boxes.generators.closedbox.__file__)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/boxes-0.1-py3.7.egg/boxes/generators/closedbox.py
So I modify that file, now it works and I can see the bed bolts! Is this handling of the installation specific to macOS?
Thanks for your help Florian!
No. This is probably a coincident that I have not run into this problem. I added
try:
import boxes
except ImportError:
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/..')
import boxes
to make sure the sources are found even when not being installed. But I always call scripts/boxesserver
from the repository main dir. As the current dir is first in the path for Python that always leads to be getting the code from the repo. You can either do the same thing or adjust your Python path.
I'll make another suggestion: to verify that the installed module boxes
has a __file__
not None
. I tried multiple times and uninstalled the module as in this thread. Uninstalling removed the files but left a directory structure /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/boxes-0.1-py3.7.egg/
with no files, and Python succeeded in importing an empty installed module boxes
. I uninstalled it cleanly and now both scripts/boxes
and scripts/boxesserver
work and load the source files, which I can modify with the first suggestion of commenting out d2 = d3 = None
.
I was able to adapt the closedbox
generator with counter bed bolts, as I mentioned in #73. Thanks a lot for your help with this debugging!
While the library supports "bed bolts" (slots for nuts and screws holding walls together at joints) the generators don't.