I am intrigued by this MakerCase tool and I am wondering how I would make my own parametric model generator.
There are situations where I have a parametric model and I want to publish it, but customizing parameters requires an external tool, like OpenSCAD for example. For someone to customize the model requires multiple steps, where one of the steps is installing a program, which is a tall ask.
What I am wanting is something that runs purely in the browser without any back-end, so it can be entirely hosted on GitHub (or any other static site) and it must directly generate the parameterized model for download, similar in a way to my test pattern generator.
What would be the recommended way to approach building such a tool?
The requirements are:
Must run entirely in browser using static data and no server computation
Must enable specification of parameters, generation, and download of SVG or STL models
Must be completely independent of external services, e.g. online Fusion 360 or OnShape hosted models are not allowed. Or TV for that matter, if it even still works.
These are some non-requirements:
Visualization/rendering optional, not required
Need not be pure js; solution may use WebAssembly, meaning C/C++, Rust, perhaps other libraries are allowed
Models need not be represented in a standard language or format. I can implement models in a custom format if necessary.
Darn it you set high goals for yourself, you know it!
I do i.t. but never really approached this. Thingiverse always wowâed me with the openscad plugin, (not really plugin but where you put in values and it spits out). So i myself would ponder that openscad must have a way to do this. Now at WHAT COST! The hardware required to do that and allow for multiple users would be quite high end. It may require a high end graphics card for number crunching.
Whoâs the audience, someone not opposed to using a minimal web equivalent of OpenScad, e.g. https://codepen.io or https://projects.codesandbox.io that loads some js library exposing primitives, manipulation operations and svg export functions?
The idea is that it would completely hide the modeling, similar to MakerCase, and present only the customization options, and some documentation/instructions, plus a âdownloadâ button (actually generates browser-side).
Each project/model would have its own URL on GitHub and would offer a handy way to share by just giving the URL. Printables is fine for static models but it falls short on customizable designs.
Maybe some query options in the URL could pre-populate the customization fields, so itâs also possible to share a specific customization of a model.
If a model has multiple parts, I guess that would be another desire, which is to download a zip file containing the parts, although thatâs not necessary for the first iteration.
It wouldnât even need to be terribly sophisticated⌠Iâd love to have some simple parametrics like cut a hole x mm in diameter y mm deep using z bit parameters using current location as center point built into something like cnc.js
But that would only be usedul in very limited cases, like the box. Cases where you were going to get a lot of uses out of it, and it would be simple to generate the geometry yourself.
But the openscad library makes it way more useful. What you need is a sort of âvanillaâ project. When you make a new project, you define:
A list of parameters. Maybe a json object with names and types. Future versions could support arrays or maps
The âhard codedâ openscad file, which you would manually create offline.
The vanilla project:
creates a simple UI for the user to set parameters
combines the results from the parameters with the openscad script
sends that to the library you linked l
shows the result with the stl viewer they used
builds the download stl for the user when they approve
I can easily see you making 25-50 of these. But even at 3-5, having that âscaffoldingâ ready would be a big help.
I suppose the minimum viable product doesnât include the scaffolding, just a single proof of concept.
The ideal for me is if it could run on a smartphone. That is how you know you are pushing the limits.
100% agree Jeff. Once the groundwork is laid, it should be very quick to wrap a parametric model into a GitHub page by copy-pasting the vanilla project, tweaking the web UI (including adding instructions), and uploading the parametric model into the back-end.
I was unsure if I would have to do a lot of work to build that starting point, which might be beyond me, but now it looks like I can steal from existing work where they have done most of the hard part. They already have basically a superset of what Iâm looking for so maybe I can prune it down and locate the right hooks to stuff my parameters and models.
Stole a bunch of code and hacked it into submission. Itâs not pretty; please donât judge my javascript
Right now the parameters have to be manually implemented in the HTML forms and manually bound in the javascript that invokes OpenSCAD. Iâm sure thereâs a nicer way.
I posted the same gridfinity model to Printables but Iâm guessing the majority of people are not willing to download OpenSCAD to take advantage of the customization, which makes me sad.
Now each model is just a html/zip file pair, and it works.