Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add settings for Bedbolts #36

Open
florianfesti opened this issue Feb 26, 2017 · 15 comments
Open

Add settings for Bedbolts #36

florianfesti opened this issue Feb 26, 2017 · 15 comments

Comments

@florianfesti
Copy link
Owner

While the library supports "bed bolts" (slots for nuts and screws holding walls together at joints) the generators don't.

@mm3509
Copy link

mm3509 commented Jul 24, 2018

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?

@florianfesti
Copy link
Owner Author

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.

@mm3509
Copy link

mm3509 commented Jul 25, 2018

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?

@florianfesti
Copy link
Owner Author

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.

@mm3509
Copy link

mm3509 commented Jul 25, 2018

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:
no bed bolts in box

Do you get bed bolts when you comment out line 45?

@florianfesti
Copy link
Owner Author

Yes.

@mm3509
Copy link

mm3509 commented Jul 27, 2018

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?

@florianfesti
Copy link
Owner Author

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...

@florianfesti
Copy link
Owner Author

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.

@mm3509
Copy link

mm3509 commented Jul 27, 2018

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
>

@florianfesti
Copy link
Owner Author

florianfesti commented Jul 27, 2018

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__)

@mm3509
Copy link

mm3509 commented Jul 27, 2018

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!

@florianfesti
Copy link
Owner Author

florianfesti commented Jul 27, 2018

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.

@mm3509
Copy link

mm3509 commented Jul 27, 2018

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.

@mm3509
Copy link

mm3509 commented Jul 27, 2018

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants