@gilboonet Thanks, but I'm not interested in running my own custom version of the site. I just want to link to the public website, hence the request to add this feature.
Posts made by sheffieldnick
-
RE: Website "load a file" functionality?
-
RE: Website "load a file" functionality?
@sheffieldnick said in Website "load a file" functionality?:
It should be very easy to support data: URIs, and you wouldn't need the backend process to get around CORS issues, etc.
Looking at the V1 source (which is what the public site is running?), it appears the loading is done in /packages/web/src/ui/examples.js in function loadInitialExample(). Adding something like this would probably work:
const isData = documentUri ? documentUri.match(/(data:\S+)$/) !== null : false ... } else if (isData) { // base64-encoded data example, e.g. https://openjscad.org/#data:... loadLocalStorage(atob(documentUri.split(',')[1]), params)
-
RE: Website "load a file" functionality?
@z3dev Thanks. I've done some searches of previous threads but couldn't find anything directly relevant.
Here is my site that dynamically generates a small piece of JSCAD code for 3D printing a stencil alignment jig for PCBs:
https://climbers.net/sbc/kicad-pcb-panelization-javascript/
at the moment I'm just asking users to copy'n'paste the code into the jscad.org website, but it would be great if you could add support for loading content with data: URIs so that I could provide a simple link and avoid the extra copy'n'paste steps.
It should be very easy to support data: URIs, and you wouldn't need the backend process to get around CORS issues, etc.
-
RE: Website "load a file" functionality?
Thanks It doesn't seem to support data: URIs? e.g.
should load the script:
function main() { return union( cube({size: [202,104,4]}), cylinder({r: 2, h: 6}).translate([10,5,4]), cylinder({r: 2, h: 6}).translate([202-10,5,4]) ); }
Thanks
-
Website "load a file" functionality?
Hi,
I'm new to OpenJSCAD. Is there an API on the openjscad.org site to load & render a supplied JSCAD script as a URL parameter? e.g.
https://www.openjscad.org/?file=https://my.url/something.jscad
or
https://www.openjscad.org/?script=function main () {...
I have a web page that generates a jscad file with javascript, and I'd like to be able to render it on the openjscad.org site with just a single click.
Thanks