jscad / OpenJSCAD.org

JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
https://openjscad.xyz/
MIT License
2.61k stars 511 forks source link

Ability to share OpenJSCAD application via URL #300

Open drom opened 6 years ago

drom commented 6 years ago

Feature request:

Ability to embed OpenJSCAD code by encoding it together with URL. This way URL can be shareable.

Example:

http://wavedrom.com/editor.html?%7B%20%22signal%22%20%3A%20%5B%0A%20%20%7B%20%22name%22%3A%20%22clk%22%2C%20%20%22wave%22%3A%20%22P......%22%20%7D%2C%0A%20%20%7B%20%22name%22%3A%20%22bus%22%2C%20%20%22wave%22%3A%20%22x.%3D%3D.%3Dx%22%2C%20%22data%22%3A%20%5B%22head%22%2C%20%22body%22%2C%20%22tail%22%2C%20%22data%22%5D%20%7D%2C%0A%20%20%7B%20%22name%22%3A%20%22wire%22%2C%20%22wave%22%3A%20%220.1..0.%22%20%7D%0A%5D%7D%0A

Opens editor with specific code block.

kaosat-dev commented 6 years ago

Do you mean encoding the contentof the jscad script(s) into the url ? Or just shareable urls pointing to a specific design ? If the first, then I do not think this is very realistic given the potential complexity of the scripts (you would end up with unmanageable urls), if the second one, I have been exploring (nothing public for now) possibilities for self hosted, peer to peer designs etc which would work like that.

drom commented 6 years ago

First Option:

Agree, it can be bulky, but maybe OK for some small code tweets. https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers

Second option:

https://gist.github.com is public. Some projects using gist: https://bl.ocks.org https://jsbin.com/help/import-gists http://requirebin.com

kaosat-dev commented 6 years ago

I use require.bin all the time, so I get the appeal :)

The problems & solutions :

drom commented 6 years ago

@kaosat-dev I ❤️ dat . Let's do dat

jtoy commented 6 years ago

love the idea, but hard to implement in practice, especially with data that is essentially unlimited code.