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

Feature: 3D preview #145

Closed
matthijskooijman opened this issue Jun 17, 2019 · 2 comments
Closed

Feature: 3D preview #145

matthijskooijman opened this issue Jun 17, 2019 · 2 comments

Comments

@matthijskooijman
Copy link
Contributor

It would be interesting if boxes.py could render a 3D preview. For complex boxes, this could help a lot to see what a box looks like, and during development to see if things are lining up correctly.

For this to work, you would need some kind of 3D rendering library that can import the 2D parts, extrude them to thickness and arrange them in a 3D view. Most of this is generic, except the arranging which has to be done by each generator individually.

Having a 3D preview might also help for #140 (though actual pictures of finished products are probably nicer).

@florianfesti
Copy link
Owner

I doubt this is actually possible with the project right now. The parts are not really properly closed lines. This project was deliberately done aiming for 2D only. For a 3D preview it is probably easier to start a new box generator based on a different technology all together.

@chrysn
Copy link
Contributor

chrysn commented Mar 11, 2024

I'm not sure we're too far off. I've played around a bit; the roadmap I envision is:

  • Expose metadata about which line belongs to which part.
    That is done in Make better use of part names #644
  • Export metadata about edges.
    My local checkout has an added place_oriented_marker() function on the context, which exports the affine matrix for each named part and edge number in the format of OpenSCAD, as well as its inverse matrix.
  • The only metadata that is missing per generator is which edges go together (like, "front edge 3 is right edge 1"), and whether those go clockwise or counterclockwise. That piece of data would also be very handy in verification (a la "Warning: a pair of aligned edges is using h and E, which do not fit").
    Currently, I provide that information in custom OpenSCAD code – .

With those 3, I could already assemble some of the universal box in OpenSCAD:
openscad

The edges that do fit fit well. The right part's edge does not fit – either I've failed to account for some more metadata (there is something in the code about inverting some parts), or this generator relies on parts to be symmetric, or I missed something else.

As this was closed as out-of-scope, I'll try to motivate PRs that support this goal also from additional angles – and indeed there are nice properties obtained from the planned changes. For example, ensuring that edges match up would also enable irregular teeth patterns that prevent a box from being assembled the wrong way.

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

No branches or pull requests

3 participants