<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Website &quot;load a file&quot; functionality?]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I'm new to OpenJSCAD. Is there an API on the <a href="http://openjscad.org" rel="nofollow ugc">openjscad.org</a> site to load &amp; render a supplied JSCAD script as a URL parameter? e.g.</p>
<p dir="auto"><a href="https://www.openjscad.org/?file=https://my.url/something.jscad" rel="nofollow ugc">https://www.openjscad.org/?file=https://my.url/something.jscad</a></p>
<p dir="auto">or</p>
<p dir="auto"><a href="https://www.openjscad.org/?script=function%20main%20()%20" rel="nofollow ugc">https://www.openjscad.org/?script=function main () </a>{...</p>
<p dir="auto">I have a web page that generates a jscad file with javascript, and I'd like to be able to render it on the <a href="http://openjscad.org" rel="nofollow ugc">openjscad.org</a> site with just a single click.</p>
<p dir="auto">Thanks</p>
]]></description><link>https://openjscad.nodebb.com/topic/155/website-load-a-file-functionality</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Mar 2026 11:42:37 GMT</lastBuildDate><atom:link href="https://openjscad.nodebb.com/topic/155.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 13 Sep 2020 16:02:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Mon, 05 Oct 2020 01:33:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/415">@zorglups</a> there's a bug in the V1 proxy script, <a href="http://remote.pl" rel="nofollow ugc">remote.pl</a>, and this prevents files to be loaded properly if the file (URL) does not have a proper extention.</p>
<p dir="auto">a fix has been made, and the V2 website is running the fixed version of <a href="http://remote.pl" rel="nofollow ugc">remote.pl</a></p>
<p dir="auto">but you need to provide a URL which accesses a V2 design, such as...</p>
<p dir="auto"><a href="https://www.jscad.xyz?uri=https://www.thingiverse.com/download:8705160" rel="nofollow ugc">https://www.jscad.xyz?uri=https://www.thingiverse.com/download:8705160</a></p>
<p dir="auto">OR</p>
<p dir="auto"><a href="https://www.jscad.xyz#https://www.thingiverse.com/download:8705160" rel="nofollow ugc">https://www.jscad.xyz#https://www.thingiverse.com/download:8705160</a></p>
]]></description><link>https://openjscad.nodebb.com/post/406</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/406</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Mon, 05 Oct 2020 01:33:25 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Sun, 04 Oct 2020 08:28:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/415">@zorglups</a> The syntax is not ?url=[your_url] but #[your_url]. But on this case, the url is a download url, the script must be downloaded then dropped to <a href="http://OpenJSCAD.org" rel="nofollow ugc">OpenJSCAD.org</a> file drop zone (bottom left frame).</p>
]]></description><link>https://openjscad.nodebb.com/post/405</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/405</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Sun, 04 Oct 2020 08:28:25 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Sat, 03 Oct 2020 21:34:04 GMT]]></title><description><![CDATA[<p dir="auto">Strangely enough, the following link won't work:<br />
<a href="https://openjscad.org/?uri=https://www.thingiverse.com/download:106799" rel="nofollow ugc">https://openjscad.org/?uri=https://www.thingiverse.com/download:106799</a></p>
<p dir="auto">This is said because it would make easy to let people open an openjscad object from a link in the thingiverse description.</p>
<p dir="auto">The error is:<br />
Uncaught Error: The JSCAD script must contain a function main() which returns one or more CSG or CAG solids.<br />
Line: 89,col: 7</p>
<p dir="auto">Tjere is a main() though.</p>
]]></description><link>https://openjscad.nodebb.com/post/404</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/404</guid><dc:creator><![CDATA[zorglups]]></dc:creator><pubDate>Sat, 03 Oct 2020 21:34:04 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Tue, 15 Sep 2020 23:37:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/361">@sheffieldnick</a> this would be a nice addition, but V2 is the main focus now. we would welcome changes to make this part of V2. <img src="https://openjscad.nodebb.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=k4h1pp0pk3c" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
]]></description><link>https://openjscad.nodebb.com/post/367</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/367</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Tue, 15 Sep 2020 23:37:37 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Tue, 15 Sep 2020 13:36:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/5">@gilboonet</a> 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.</p>
]]></description><link>https://openjscad.nodebb.com/post/364</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/364</guid><dc:creator><![CDATA[sheffieldnick]]></dc:creator><pubDate>Tue, 15 Sep 2020 13:36:31 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Tue, 15 Sep 2020 13:34:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/361">@sheffieldnick</a> said in <a href="/post/361">Website "load a file" functionality?</a>:</p>
<blockquote>
<p dir="auto">It should be very easy to support data: URIs, and you wouldn't need the backend process to get around CORS issues, etc.</p>
</blockquote>
<p dir="auto">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:</p>
<pre><code>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)
</code></pre>
]]></description><link>https://openjscad.nodebb.com/post/363</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/363</guid><dc:creator><![CDATA[sheffieldnick]]></dc:creator><pubDate>Tue, 15 Sep 2020 13:34:34 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Tue, 15 Sep 2020 11:50:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/361">@sheffieldnick</a> As V2 is on active development, I don't think that new functionality could be add to V1, but I'm only a user not a developer. This project could maybe help you :<br />
<a href="https://github.com/danmarshall/jscad-gallery" rel="nofollow ugc">https://github.com/danmarshall/jscad-gallery</a><br />
Or you could also do a fork. Long ago, I added some functionalities to OpenJSCAD v0.5 so the user can select a data file that will load openJSCAD with a .jscad file and populate it with parameters, but it's very old code (from 2016) that's not on github... <a href="http://gilboo.carton.free.fr/OJSC5/edit_ner2.html" rel="nofollow ugc">http://gilboo.carton.free.fr/OJSC5/edit_ner2.html</a></p>
]]></description><link>https://openjscad.nodebb.com/post/362</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/362</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Tue, 15 Sep 2020 11:50:05 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Tue, 15 Sep 2020 11:26:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/1">@z3dev</a> Thanks. I've done some searches of previous threads but couldn't find anything directly relevant.</p>
<p dir="auto">Here is my site that dynamically generates a small piece of JSCAD code for 3D printing a stencil alignment jig for PCBs:</p>
<p dir="auto"><a href="https://climbers.net/sbc/kicad-pcb-panelization-javascript/" rel="nofollow ugc">https://climbers.net/sbc/kicad-pcb-panelization-javascript/</a></p>
<p dir="auto">at the moment I'm just asking users to copy'n'paste the code into the <a href="http://jscad.org" rel="nofollow ugc">jscad.org</a> 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.</p>
<p dir="auto">It should be very easy to support data: URIs, and you wouldn't need the backend process to get around CORS issues, etc.</p>
]]></description><link>https://openjscad.nodebb.com/post/361</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/361</guid><dc:creator><![CDATA[sheffieldnick]]></dc:creator><pubDate>Tue, 15 Sep 2020 11:26:48 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Mon, 14 Sep 2020 23:48:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/361">@sheffieldnick</a> sorry, but only full URLs are supported.</p>
<p dir="auto">there's a backend process involved, that down loads the URL contents, and posts the contents to the WEB UI.</p>
<p dir="auto">i think that you are trying to create a custom website using a JSCAD design in the back ground. if so you can look at some of the previous threads posted here, so on the issue list.</p>
]]></description><link>https://openjscad.nodebb.com/post/357</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/357</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Mon, 14 Sep 2020 23:48:20 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Mon, 14 Sep 2020 07:51:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/361">@sheffieldnick</a> I don't remember that it handles data protocol, only used if with file names</p>
]]></description><link>https://openjscad.nodebb.com/post/355</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/355</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Mon, 14 Sep 2020 07:51:31 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Mon, 14 Sep 2020 07:19:26 GMT]]></title><description><![CDATA[<p dir="auto">Thanks <img src="https://openjscad.nodebb.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=k4h1pp0pk3c" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":slightly_smiling_face:" alt="🙂" /> It doesn't seem to support data: URIs? e.g.</p>
<p dir="auto"><a href="https://www.openjscad.org/#data:text/javascript;charset=utf-8;base64,ZnVuY3Rpb24gbWFpbiAoKSB7DQogIHJldHVybiB1bmlvbigNCiAgICBjdWJlKHtzaXplOiBbMjAyLDEwNCw0XX0pLA0KICAgIGN5bGluZGVyKHtyOiAyLCBoOiA2fSkudHJhbnNsYXRlKFsxMCw1LDRdKSwNCiAgICBjeWxpbmRlcih7cjogMiwgaDogNn0pLnRyYW5zbGF0ZShbMjAyLTEwLDUsNF0pDQogICk7DQp9" rel="nofollow ugc">https://www.openjscad.org/#data:text/javascript;charset=utf-8;base64,ZnVuY3Rpb24gbWFpbiAoKSB7DQogIHJldHVybiB1bmlvbigNCiAgICBjdWJlKHtzaXplOiBbMjAyLDEwNCw0XX0pLA0KICAgIGN5bGluZGVyKHtyOiAyLCBoOiA2fSkudHJhbnNsYXRlKFsxMCw1LDRdKSwNCiAgICBjeWxpbmRlcih7cjogMiwgaDogNn0pLnRyYW5zbGF0ZShbMjAyLTEwLDUsNF0pDQogICk7DQp9</a></p>
<p dir="auto">should load the script:</p>
<pre><code>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])
  );
}
</code></pre>
<p dir="auto">Thanks</p>
]]></description><link>https://openjscad.nodebb.com/post/354</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/354</guid><dc:creator><![CDATA[sheffieldnick]]></dc:creator><pubDate>Mon, 14 Sep 2020 07:19:26 GMT</pubDate></item><item><title><![CDATA[Reply to Website &quot;load a file&quot; functionality? on Sun, 13 Sep 2020 17:55:49 GMT]]></title><description><![CDATA[<p dir="auto">Hello, it can be done like that, put a "#" after <a href="http://openJSCAD.org" rel="nofollow ugc">openJSCAD.org</a> then the url of your script.<br />
<a href="https://openjscad.org/#https://raw.githubusercontent.com/gilboonet/designs/master/make_pattern.jscad" rel="nofollow ugc">https://openjscad.org/#https://raw.githubusercontent.com/gilboonet/designs/master/make_pattern.jscad</a></p>
]]></description><link>https://openjscad.nodebb.com/post/352</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/352</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Sun, 13 Sep 2020 17:55:49 GMT</pubDate></item></channel></rss>