manyfold3d / manyfold

A self-hosted digital asset manager for 3d print files.
https://manyfold.app
MIT License
726 stars 48 forks source link

OpenSCAD Customizer #2214

Open ToasterUwU opened 4 months ago

ToasterUwU commented 4 months ago

I'm a programmer, and predictably I fell in love with OpenSCAD and use it as my main CAD tool now.

One thing about OpenSCAD files is, that if they are made in a specific way (in my opinion "properly") you can change some variables at the top of the file, and use this not as a "build instruction" for a single STL but effectively as an X Generator. So at least well-made OpenSCAD files are not "Screw Container" Source files, they are "Screw Container" Generators that can take inputs from the user and automatically generate a proper container in all kinds of sizes and with all kinds of optional features.

One great example of the power of OpenSCAD is this: (Click to expand) A few GIFs from the README of https://github.com/kennetek/gridfinity-rebuilt-openscad ![height_dimension](https://github.com/manyfold3d/manyfold/assets/43654377/c501d139-8b6a-4a29-9027-ddc8c2407414) ![base_dimension](https://github.com/manyfold3d/manyfold/assets/43654377/d1b43f6b-92f4-4bf0-9cd2-a8ccc77b56f0) ![compartment_dimension](https://github.com/manyfold3d/manyfold/assets/43654377/5f6c935e-9936-4438-8c57-26361220f789) ![custom_dimension](https://github.com/manyfold3d/manyfold/assets/43654377/fcc563f5-c754-40af-8fab-7482443d2bcc) ![holes_dimension](https://github.com/manyfold3d/manyfold/assets/43654377/bfd583a8-5f36-4bbe-be24-c632c523ac4f) ![tab_dimension](https://github.com/manyfold3d/manyfold/assets/43654377/6df52b84-a253-4a0c-a00a-4a0b718c4583)

The idea I have for Manyfold is to make a Customizer like the one from Thingiverse. Meaning that there would be a "Customize" Button that brings you to a menu with sliders, checkboxes, dropdowns, and whatever is needed based on the types of variables the .scad file has. Then the user can enter their values, export the file as an STL or something else, and maybe even save it in Manyfold automatically with some kind of info attached for what the values were to get this.

I know this is a huge feature request, so I understand if this never becomes a thing or gets left in the backlog for a long time, but I at least wanted to leave this note here.

For me specifically, it would be nice, since I make my things with OpenSCAD and do them "properly". So I can just say "This thing needs to be wider by 5cm" and change that one line in the top, but for that, I currently would have to download my OpenSCAD file from Manyfold, edit it, export my STL, and use it. I cant do it in manyfold even tho it would be pretty simple for a program to do these things, and at least rn i cant add my newly generated STL to the existing Model either, which is a different issue.

The process would be:

  1. Putting a Button on OpenSCAD files for customizing
  2. Make a Menu that reads the OpenSCAD text file, parses the variables in it
  3. Identify the variable types and generate the inputs for them
  4. On press of the "Export" button change file so the new values are applied
  5. Run openscad with parameters to generate the stl from the scad file
  6. Give file to user as Download
  7. Maybe even import to the existing Model

Thanks for reading the wall of text!

t-paul commented 4 months ago

Just two notes from the OpenSCAD perspective: 1) OpenSCAD can already parse and export customizable parameters, this was implemented for the now dormant (dead?) cadhub.xyz project via https://github.com/openscad/openscad/pull/3864. I'm not aware of any big official users of the interface, so it could still be changed if needed 2) It's not well advertised, but there's a WASM build, so the Customizer could run on client side too (neither Thingiverse nor MakerWorld use that)

ToasterUwU commented 4 months ago

OpenSCAD can already parse and export customizable parameters, this was implemented for the now dormant (dead?) cadhub.xyz project via https://github.com/openscad/openscad/pull/3864. I'm not aware of any big official users of the interface, so it could still be changed if needed

Very interesting, I had no idea this existed. I guess no wonder if one single thing that seems to be dead uses it. But maybe this could be interesting for Manyfold as well, not sure.

Floppy commented 4 months ago

Ooh, that's nice, looks like that param file could be used to generate the customiser UI. Very interesting. This is probably an argument for some sort of plugin system for Manyfold... Hmmmm.

ToasterUwU commented 4 months ago

A plugin System sounds like an interesting idea. Could allow for more niche/optional features.

For example, random thought: Synced sources, like giving manyfold a git repo, and it clones it, pulls updates automatically and everything else, so that you have a always up to date copy of something that is managed with git.

How would a plugin system work? Is it something you mean as a optional feature you can enable but it comes preinstalled, or more of a extension system like with VSCode, where everyone can make it and the only "official" part is it being in some kind of database that lists the "approved" ones?

Floppy commented 4 months ago

Not sure yet! Would be nice if it could be open like the VSCode approach...

Jookia commented 3 months ago

Not to scope creep, but if this could be done server-side using a job system we could have FreeCAD generation too.