Close
0%
0%

Boxes.py

Cut out boxes and other stuff with a laser cutter

Similar projects worth following
An (Online) Box Generator for laser cutters.

  • Boxespy is an online box generator
  • Boxespy is an Inkscape plug-in
  • Boxespy is library to write your own
  • Boxespy is free software licensed under GPL v3+
  • Boxespy is written in Python and runs with Python 2 and 3

Boxespy comes with a growing set of ready-to-use, fully parametrized generators. See https://florianfesti.github.io/boxes/html/generators.html for the full list.

Features

Of course the library and the generators allow selecting the "thickness"
of the material used and automatically adjusts lengths and width of
joining fingers and other elements.

The "burn" parameter compensates for the material removed by the laser. This
allows fine tuning the gaps between joins up to the point where plywood
can be press fitted even without any glue.


Finger Joints are the work horse of the library. They allow edges
and T connections. Their size is scaled up with the material
"thickness" to maintain the same appearance. The library also allows
putting holes and slots for screws (bed bolts) into finger joints,
although this is currently not supported for the available generators.

Dovetail joints can be used to join pieces in the same plane.

Flex allows bending and stretching the material in one direction. This
is used for rounded edges and living hinges.

Documentation

https://florianfesti.github.io/boxes/html/index.html

  • More and better Docs

    Florian Festi03/04/2019 at 21:55 0 comments

    I held a workshop at my local hacker space on how to write your own generators. As a side effect I restructured and extended the (API) docs and one participant updated the installation instructions. So now there are several new topics covered:

    The API docs have now more of an top down approach. This makes it easier to understand the concepts and where to start. Also the previously broken module index is fixed and all the methods are referenced in the index.

    There are still a lot of places the docs can be improved but I am trying to stop myself here. Overall it is probably better to crank out a few new features than loosing myself in the documentation. I guess most people are happy not needing to read docs and being able to generate a new box with the press of a single button.

  • Ponoko optimized SVG

    Florian Festi02/26/2019 at 22:26 0 comments

    Different laser cutter software need different formats and also different styles even with in the same file format. Traditionally lines have the width of the actual laser cut. Normal cuts are black and for quite a while now holes are rendered blue. But this is not the right thing to do for all use cases. One such use case was Ponoko - an online manufacturing service that does laser cutting. There the lines need to be thin and also need a different color scheme. wayn3w did not only add a new format - svg_Ponoko - but re-factored a lot of other code.

    There are still several tickets open to optimize the SVG or adjust some details. Unfortunately the graphics library used (cairo) limits the things that can be changed - easily. But if you need different colors or line width settings this is quite doable now. Please speakup either here in the comments or - preferably  - in a GitHub ticket.

  • Box with Sliding Lid

    Florian Festi12/21/2018 at 19:47 0 comments

    I made a new type of box with a sliding lid made of flex:

    This first prototype is a bit stiff as I used coarser settings for the flex of the lid. The hope was the lid would be  a bit more robust. Now the generator uses a setting in between that works just fine if the sliding surfaces are treated with wax. Rubbing a candle on the left and right most part of the lid does the job. I also sanded the front edges of the lid so they don't get caught on ridges along the track.

    The inner corner is not made with flex but multiple straight pieces connected with non orthogonal finger joints.

    This is a bit more robust as is in part the inner bottom of the box.

    I also added another variant in which the lid continues around the second top corner, too. Sorry, no good pictures yet.

  • Anyone using Boxes.py in Inkscape?

    Florian Festi11/27/2018 at 19:08 1 comment

    I have been thinking about adding generators for the basic building blocks like walls, edges, ... That would probably pretty easy to do - although not that exciting. I thought that might be most interesting for the Inkscape plug-in. Then you could build your own, one of project from those primitives without bothering with Python and programming.

    But as we still don't have a way to get Boxes.py running on Windows I wonder how many people actually use the Inkscape plug-in at all. Well, I don't...

    Otoh having those primitives available might be interesting for the web UI, too. Not as convenient as one needs to go through all the Save as, Open, Cut and Paste hoops. But may be some people are doing this anyway but have to look through the generators to find the parts they need.

    So the question to everyone: Are you using the Inkscape plug-in and would you be interested in generators for simple parts? Please comment below!

  • New Generators and Features

    Florian Festi10/31/2018 at 08:21 0 comments

    I promised new generators. Luckily several people sent some in. So there is a pretty long list:

    • PaintStand from Jens Persson is a stackable stand for small paint bottles based in this video from Tested.
    • CardBox also from Jens Persson can house a number of playing card decks and features a nice slide in lid.
    • TwoPiece is simple box with another box as a lid that slides over the first one. While I rewrote large parts of the generator the idea and first implementation was submitted by bobm123 quite a while ago.
    • DisplayCase from Alexander Bulimov is a simple closed box optimized to be cut from acrylic for displaying small objects.
    • RoyalGame of Ur is an ancient board game featured in this video from the British Museum
    • LaserClamp can hold warped plywood down on a knife table. This already kinda works but it will probably still change form to work more conveniently.

    Additionally some old things got improved:

    • Most flex boxes now have a latchsize parameter to allow cutting them much smaller
    • Cabinet hinges can now be mounted on the outside of the box
    • The HingeBox supports a split lid that opens to both sides
    • The move parameter in the parts API now supports "mirror" to make rendering  symmetrical parts easier

    Update:

    I got pictures for at least some of the new boxes / generators:

    PaintStorage (by Blancanegra)

    CardBox

    TwoPiece

    DisplayCase (by)

  • Finally!

    Florian Festi09/24/2018 at 16:07 2 comments

    OK, OK. I know you are actually all waiting for cool new boxes and other generators - or at least new features for the existing ones. But there is even more infrastructure work that need to be done. I do have some new generators in some - not quite finished - branches. So there will be new stuff to cut out. I promise!

    One long standing issue with the project has been the logo. The web site used a gray cube that was added as a place holder in the web UI mock up and just didn't get replaced. I wanted the logo to also be a box generator  and I have a branch that does that. It applies some transformation matrices to render a box with finger joints in an isometric projection. But the result was still closer to a technical drawing that a proper logo. After some encouragement in the GitHub tickets I finally ditched the idea and sketched something in Inkscape. It's not that great but it is a box that's green like a Python (mascot) and has a laser welding it together. There is probably some things that can be improved. The contrast between the greens and the light gray used as a background in many web browsers could be better and and the laser could be nicer, brighter ans shinier. But so far I am happy with what I have achieved - given my artistic talent. If you have some design skills and some improvements feel free to open an pull request.

    PS: The logo is also - finally - used as a favicon. So I can now find all those still open boxes browser tabs.

  • Update for the Web Instance

    Florian Festi09/17/2018 at 15:50 0 comments

    Some may have noted that I recently added a Dockerfile to the repository. Playing around a bit more I moved the public web instance into a more modern docker container. This is not in its final form. Several things still need to be done right. Nevertheless it already solves two long standing and annoying issues:

    For the later I still need to fix the docs with still state those formats or only available for local installations.

    Overall the docker container is considered being in beta test. So if you encounter any issues, please report here or in a GH ticket. But in general I expect things to work.

    Update:

    Turns out this simple setup is not good enough for a public instance. I added uWSGI - a light weight web server - to the container. So now there are multiple processes and threads handling the requests. I also created a systemd service file for the container so it gets started and restarted automatically.

    I did not update the Dockerfile in the repository as I guess most people won't be using it to run their own public instance but would rather use it for development where having one single process with the SimpleHttpServer is just fine. It also contains a few specifics of my setup.

  • More Documentation

    Florian Festi09/14/2018 at 13:30 0 comments

    Updating the API docs has been on the ToDo list for one and a half year. Turns out being on vacation far away from a laser cutter is helping. Not only did I update some doc strings - which are the basis for the Sphinx generated API docs - but I wrote some new documents:

    And I added an Introduction to the Edge classes. The rest of the page probably still needs some work as some Edge types are still missing. The Settings classes and their role in creating the HTML and Inkscape user interfaces and in creating the Edge instances probably also deserves a bit more text.

    What also helped getting it done - probably not getting it done well - was a good amount of medication. It at least prevented me from doing something more complicated - and may be more rewarding - instead. I hope it does not show too much. So if something looks weird or doesn't make sense please open a ticket on GitHub or leave a comment below.

  • Boxes.py goes to Jupyter

    Florian Festi09/10/2018 at 14:19 0 comments

    No, Boxes.py didn't make it to space - yet. But @speendo used a Jupyter notebook to develop a housing for his switch. After a bit of back and forth we now have an example notebook that allows to play around interactively in your web browser - sort of. You still need Boxes.py running on your system - or where ever your Jupyter instance is running. If you do not have Boxes.py installed in your Python path you can uncomment and adjust the sys.path line in the first code cell.

    The example code - a simple, single shelve to screw to the wall - did not yet make it into the regular code. So it is only available in the notebook for now.

  • Reuse your previous Box settings

    Florian Festi08/14/2018 at 10:40 0 comments

    When designing the web interface I was deliberately using URL parameters so the link to the rendered SVG can be used to generate it again and to adjust the values. But so far there was no way to get those values back into the input form. Yes, you *can* edit the URL directly but this got much less convenient when the settings for the edges got added and the URL looks like a database.

    bwente rightly complained about this in #66. So I finally fixed it. Now you can just remove the &render=1  at the end of the URL or turn the 1 into a 0 to open the input form filled with the previously used values.

    The actual issue in #66 - adding the URL as a comment in the SVG file - is still unresolved. So far I could not yet bring myself to re-open and rework the SVG file. But there are several issues open that would require this. So one day eventually...

    In the mean time Rotzbua created a greasemonkey script that adds the comment on the client side.

View all 43 project logs

Enjoy this project?

Share

Discussions

michael wrote 02/10/2019 at 08:40 point

Hi Florian, 

the Boxes.py is awesome! I have found - maybe only on my machine - a bug which I thought is easy solvable (but I was not able) - so I tell you about:

When selecting as Top Edge L Edge for slide on lid - both on the universal box and the Type-Tray there is an error on the server:

Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "./boxesserver", line 399, in serve
    box.render()
  File "./../boxes/generators/universalbox.py", line 60, in render
    t1, t2, t3, t4 = self.topEdges(self.top_edge)
  File "./../boxes/lids.py", line 118, in topEdges
    if t1.char == "t":
AttributeError: 'str' object has no attribute 'char'

All other Top Edges work perfectly. I just did not find the mistake (even if it was mine...) - I think I did not search enough...

And again: GREAT WORK!!!

Thanks

Michi

  Are you sure? yes | no

Florian Festi wrote 02/10/2019 at 18:58 point

Thanks for the bug report! Fixed in https://github.com/florianfesti/boxes/commit/e3ba617f22f6321d662f6ee359e79ffc05f5e871

Will update the web instance the next days.

  Are you sure? yes | no

michael wrote 02/10/2019 at 19:02 point

Many thanks! Works like a charm!

lg

Michi

  Are you sure? yes | no

sven.wagner wrote 01/06/2019 at 22:52 point

Hi Florian. Boxes.py is realy great. Thanks for sharing it! I try to use a gernerated universal-box on my cnc machine, but I the inner edges of the finger joints where generated with a "over routing" of the edges. Example see: https://www.lieblos.de/wp-content/uploads/2019/01/boxfertigung-7-900x675.jpg. I can't find an option to deactivate this "over routing" - is it possible to deactivate it with an option? It would be very great to try more of the boxes.py designs on my cnc router. Regards. Sven.

  Are you sure? yes | no

Florian Festi wrote 01/11/2019 at 22:18 point

Yes, you can set burn to zero. But then you have to do the kerf correction on your own. Probably with some CAM software.

As the kerf correction is done by doing these overruns Boxes.py cannot do kerf corrections without them.

  Are you sure? yes | no

Scott wrote 12/30/2018 at 17:21 point

This tool is wonderful. I am really enjoying it. I do have a question about the TypeTray function. There is an option to make a stackable bottom but it doesn't seem to make the top stackable. Am I missing something. I can fix this in post but I figure there is an easier way.

  Are you sure? yes | no

Florian Festi wrote 01/01/2019 at 21:53 point

There currently isn't. But I am currently working on the type tray generator anyway. So i should be able to add this feature the next few days.

Update: Created a ticket at https://github.com/florianfesti/boxes/issues/107

  Are you sure? yes | no

Florian Festi wrote 01/11/2019 at 22:22 point

This is fixed now. TypeTray can not have the same selection of top edges as UniversalBox - including the stackable edge.

  Are you sure? yes | no

Mohab Fawzy wrote 10/24/2018 at 01:39 point

HI Florian , love your project , and can help you with the visuals or logo if you like , since i'm really dumb when it comes to coding XD
I wanted to ask you about running it in windows , but scrolled down and found that it doesnt have an obvious solution , i messed with it but im dumb XD so i think i'll run it on my linux laptop for now .

  Are you sure? yes | no

Florian Festi wrote 10/24/2018 at 07:30 point

Sure, I am not much of a web or graphics person. So help is welcome in this area.

 Yeah, Boxes.py on Windows is still a sad story. There is still the bounty up for working installation instructions.

  Are you sure? yes | no

Mohab Fawzy wrote 10/24/2018 at 16:09 point

cool , see what i can help with and i'm up for it =)

  Are you sure? yes | no

Andrew Bills wrote 10/18/2018 at 05:00 point

FYI - Took me a little bit to figure out what I was doing wrong, but if you generate a flexbox4 too small (i tried 25x25x40) the sold curve wall part doesn't get added to the model. Took me a bit to realise (after I broke the pieces trying different things to make it go together)

  Are you sure? yes | no

Florian Festi wrote 10/19/2018 at 09:40 point

There are two issues here. The generator reduces the radius of the flex if there is not enough space. But there is a bug where this reduced radius is not used for the length of the flex.

The second issue is that there is just not enough room for the flex in this dimensions. One could make the latch configurable to allow making more space or just some heuristics for small values.

On the larger picture there is the question of using unsuitable parameters. So far I have avoided to add checks for the most part and left the checking to the user. This has obviously fail here - to some extend due to the bug above.

I hope I can get the bug fixed today or tomorrow. But this may still not make the box work with this small dimensions.

  Are you sure? yes | no

Florian Festi wrote 10/24/2018 at 07:49 point

Ok, so the issue with FlexBox4 not calculating the length of flex correctly is fixed. I also added a latchsize param to FlexBox, FlexBox2 and FlexBox4 and updated the code of the flex boxes to a more recent code style.

Try https://festi.info/boxes.py/FlexBox4?FingerJoint_angle=90.0&FingerJoint_surroundingspaces=2.0&FingerJoint_edge_width=1.0&FingerJoint_finger=2.0&FingerJoint_play=0.0&FingerJoint_space=2.0&FingerJoint_width=1.0&Flex_stretch=1.05&Flex_connection=1.0&Flex_distance=0.5&Flex_width=5.0&x=25&y=25&h=40&outside=0&radius=15&latchsize=2&thickness=3.0&format=svg&tabs=0.0&debug=0&reference=100&burn=0.1&render=1

Remove the &render=1 at the end of the URL to get to the parameter form.

  Are you sure? yes | no

megajas wrote 10/17/2018 at 03:45 point

Hi Florian, first of all, stumbling onto your project is really an eye-opener for me and I'm sure for many others! Great job!

I've only played around with the online box generator for a few minutes and I will spend much more time later. Is there a way to set the number of 'fingers' and have them evenly spaced along an edge of a wall?

  Are you sure? yes | no

Florian Festi wrote 10/19/2018 at 10:17 point

You can adjust the style of the fingers in the Settings for Finger Joint section that can be opened on most generators. Right now there is no way to evenly space them as the fingers have a fixed size. But you can change the size of the fingers and the amount of space required towards the corners. 

  Are you sure? yes | no

Thomas Pearce wrote 08/14/2018 at 15:46 point

What would be the feasibility of adding a grayscale based dovetail joint to this generator? I made them a while ago, but it didn't go anywhere because it was too tedious to make the joints. This is an awesome project, I'll have to play with it when I get the chance. the old link to the dovetails, I probably should rewrite it and move it somewhere better at some point. https://www.thingiverse.com/thing:1300977

  Are you sure? yes | no

Florian Festi wrote 09/11/2018 at 21:18 point

It should be possible to add something like this to Boxes.py. The question is what parameters are needed, to make things fit. One would also need some test piece to read the parameters from.

  Are you sure? yes | no

ornery shard wrote 08/06/2018 at 14:44 point

This tool is really great.

@Florian Festi Do you have pics and/or instructions how to  assemble the "rotary attachment for a laser cutter"

What kind of raw materials would I need for this?

  Are you sure? yes | no

Florian Festi wrote 08/07/2018 at 12:28 point

I don't. I am currently travelling so it may take a while until I can take pictures. The rotary attachment consist of two parts that slide on a metal bar. One side houses a NEMA 23 stepper that drives two rollers. The other part is a scissor lift with two free rollers.

You will need to adjust the bottom hole for the metal bar you are using.

Overall I am not 100% satisfied with the rotary attachment. The scissor lift is not as smooth and rigid as I'd want. But IIRC I made it from 5 or 6mm poppler. You want to use birch ply for that. I am still thinking about making a version without scissor lift that can be tilted as a whole.

You need a stepper motor that is electrically compatible with your Y axis of your laser cutter. Mine has 3 phase steppers which make getting one a bit more difficult. Your laser cutter needs to have a outlet for plugging the rotary device in. Or you need to do the wiring yourself.

The attachment also is still missing some accessories like rollers to limit left to right movement and pressing the inside of glasses against the driven rollers.

Beside these short coming it works reasonably well and we have engraved several glasses and bottles with it.

  Are you sure? yes | no

Jan wrote 08/03/2018 at 11:50 point

Love this tool. One can spend so much time optimizing stuff like that but you "just" write a script for it and automate it for everyone to use for free. NICE!
But I wonder: don't use wood laser-cutters DXF files like the whole sheet metal industry?

  Are you sure? yes | no

Florian Festi wrote 08/03/2018 at 17:00 point

Yes, they do. Boxes.py can generate DXF using ps2edit. Edit: That's now available in the online generator, too.

  Are you sure? yes | no

paul wrote 08/02/2018 at 12:00 point

this tool is great but it outputs the svg into the browser, how do I download it?

  Are you sure? yes | no

Florian Festi wrote 08/02/2018 at 16:01 point

Just right click and "save as"

  Are you sure? yes | no

dejan.k wrote 06/26/2018 at 08:13 point

Hello, absolutly fenomenal work, thank you very much, you shoud think about adding a feature to universal box top_edge edge with hinges and click on, on other side so it closes :) 

  Are you sure? yes | no

Florian Festi wrote 08/03/2018 at 11:32 point

The click-on edge probably deserves some more love before that becomes really feasible. But adding lock and latches to the lids is on my todo list. To my shame I have to admit that I hand drew a pair of latches for the box I recently build...

  Are you sure? yes | no

Cristian wrote 06/04/2018 at 16:44 point

Hello people... Mr. Florian, your application it is of great help, thank you very much!!! if you are interested i have a kinda new project for you. Letter shaped boxes with and without lid. Those are used for led lighting lettes and so. 

  Are you sure? yes | no

Chris Jones wrote 02/06/2018 at 05:39 point

I really appreciate this project! It has helped me make card boxes and trays to help me organise board game components better inside their boxes.

This evening I have been having trouble, though. When I use traylayout to generate a tray from a layout file, the walls of the layout have gaps in them, and they are overlapping. I don't think there is anything different that I am doing, and I have screenshots to show you my input and the svg that is output. I can send them to you if you like. 

Thank you again for an incredibly useful tool!

  Are you sure? yes | no

Ian Hubbertz wrote 12/31/2017 at 13:03 point

What's the easiest way to split a large part into two (or more) parts with dovetail joints? 

I want to build a large "RoundedBox", so that the flexible part around the box is too long for the  laser cutter. It would be nice to split this part into two or even more parts?

  Are you sure? yes | no

Florian Festi wrote 01/14/2018 at 21:32 point

Oh, sorry! I missed your comment over the holidays.

The canonical way of doing this would be extending the roundedPlate() and surroundingWall() methods in boxes/__init__.py to take a param on how many splits should be used (one to four - may be without three) and then adding a param to the RoundedBox generator that set them. 

As an alternative you can provide a instructions to get Boxes.py running on Windows and I'll do the coding for you (see https://hackaday.io/project/10649/log/71764-boxespy-on-windows ). 

  Are you sure? yes | no

Ian Hubbertz wrote 01/20/2018 at 11:18 point

Ha.. :-) thanks for the offer, but I have absolutely no experience with development (or deployment) on Windows.

When I find some free time (I have two other projects right now with higher priority), I will have a look to see how to enhance the surroundingWall() method.

  Are you sure? yes | no

Florian Festi wrote 08/06/2018 at 17:53 point

OK, I finally did just that. Instead of offering full control over where exactly to split the wall I just used a param allowing values from 1 to 4. This allows to split:

* front only

* front and back

* front and right and back

* all four sides

The new code is already online. Please double check before laser cutting. The change isn't entirely trivial.

  Are you sure? yes | no

Chris wrote 11/17/2017 at 19:27 point

Thanks for sharing this project with the world, it looks fantastic. Do you do any further post-processing of the generated SVGs prior to cutting, and if so what is your preferred application? Also what software do you use to generate gcode/control your laser? I'm using LaserWeb 4, and I can't figure out what I need to do to the boxes.py SVG output to make it work properly in LaserWeb 4. If I open the SVG in Adobe Illustrator and save it, that only seems to increase the number of errors. Any hints or tips would be greatly appreciated.

  Are you sure? yes | no

Florian Festi wrote 11/17/2017 at 19:45 point

Our Chinese laser cutter comes with some proprietorial front end program that allows arranging the pieces. For other stuff I often use Inkscape. But this also is a mixed bag as it is not really a CAD program and adds the line widths to all measurements.

There are a few pitfalls:

Boxes.py creates a lot of very short segments. If you have some auto connect feature that tries to connect single line segments to a continuous polygon make sure if has only 0.01mm range. The common default of 0.1mm is too big.

Both SVG and also DXF do not really come with units. So all lengths are just a numbers that can mean different things to different programs under different circumstances.

If you need DXF you might want to install Boxes.py locally and also install ps2edit. Then Boxes.py can create DXF directly (among some other formats).

Update: The web instance now supports generating dxf and other formats

  Are you sure? yes | no

Chris wrote 11/20/2017 at 19:11 point

Thanks for your quick reply. Based on https://darklylabs.zendesk.com/hc/en-us/community/posts/206123108/comments/115000442212, I've had some success with the following Illustrator workflow:

1) Save boxes.py output as SVG from browser.
2) Open in Illustrator.
3) One-by-one, select each path…
4) Right-click > Release Compound Path
5) Right-Click > Join
6) For each enclosed shape, select all edges, Right Click > Join
7) For circles, Right Click > Join
8) Save As > SVG 1.1, Style Attributes

9) Import into LaserWeb

  Are you sure? yes | no

Florian Festi wrote 11/21/2017 at 09:18 point

Wow! This still sounds really painful. Have you tried DXF as a format? IIRC it is even more primitive so may be the importer can deal with the non connected line segments better.

  Are you sure? yes | no

Yash Gupta wrote 10/21/2017 at 20:56 point

Great project. I wonder if there is a way to automate splitting of the files across pages of a specific size to laser cur larger projects on laser cutters with limited real estate?

  Are you sure? yes | no

Florian Festi wrote 10/21/2017 at 23:22 point

No, this is not possible right now and I am not planning to add this. It turns out that the parts need to be rearranged by hand most of the time anyway. Even if they fit in the laser cutter they do not fit on the leftover sheets which at least I often use for one ofs.

In case you want to do a larger run with one size you'll want to optimize by hand anyway to make sure you make the best use of the your sheets.

  Are you sure? yes | no

Jarrett wrote 10/02/2017 at 16:12 point

I just want you to know that I really appreciate this project! Especially the web interface. It has saved me so much time in CAD stuff to just be able to directly generate profiles.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates