@hrgdavor Thanks, done:
https://github.com/jscad/OpenJSCAD.org/issues/1318
Posts made by Hermann-SW
-
RE: Can "openjscad.xyz/?uri=..." support "data" protocol in addition to "http(s)"?
@hrgdavor Sure, Hermann-SW.
Should I create the issue against this repo?
https://github.com/jscad/OpenJSCAD.org9/2022 I created thread on user user callbacks:
https://openjscad.nodebb.com/topic/384/are-there-jscad-user-callbacks?_=1705433092538
Should I create a freature request issue on that as well?Regards,
Hermann.
-
Small "shift+enter" bug in openjscad.xyz?
Open some design in openscad.xyz, eg.:
https://openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.jsThen open the editor and press "shift+enter" to update the view.
processing,
please waitappears on left side and disappears then.
Now press "shift+enter" again, this timeprocessing,
please waitappears, but does not go away.
Appending a space to editor window and pressing "shift+enter" again works once, but does not clean up when pressed 2nd time.So the update mechanism is not prepared for "shift+enter" cleanup for 2nd, 3rd, ... time on identical source.
Regards,
Hermann.
-
Can "openjscad.xyz/?uri=..." support "data" protocol in addition to "http(s)"?
I have minimal JSCAD file:
$ cat JSCAD.minimal.js module.exports=function main(){return require('@jscad/modeling').primitives.sphere({radius: 50})} $
I have it online on my webserver as well, and can start openjscad.xyz with it easily, and it just works:
https://openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.jsThen I tried to use "data" protocol:
$ cat doit #!/bin/bash browser=firefox browser=chromium-browser $browser "openjscad.xyz?uri=data:text/plain;base64,`base64 -w 0 $1`" $ ./doit JSCAD.minimal.js Opening in existing browser session. $
But that URI does not work:
https://openjscad.xyz/?uri=data:text/plain;base64,bW9kdWxlLmV4cG9ydHM9ZnVuY3Rpb24gbWFpbigpe3JldHVybiByZXF1aXJlKCdAanNjYWQvbW9kZWxpbmcnKS5wcmltaXRpdmVzLnNwaGVyZSh7cmFkaXVzOiA1MH0pfQo=Is there a reason why data scheme does not work for "?uri=data..."?
If not, can it be enabled?I ask because this method would allow to share simple JSCAD files in the URL without storing them somewhere ...
I tested, and there is an 8KB URI length limitation on openjscad.xyz. But in case data scheme would work, maybe "...?uri=data:application/gzip,base64;..." would work as well, allowing for scripts with gzipped length of up to 6KB ...
Regards,
Hermann.
P.S:
My GraphvizFiddle tool has a similar Share button approach, allowing to share a design via URL, eg:
https://stamm-wilbrandt.de/GraphvizFiddle/?1705330894960#digraph%20G%20%7Brankdir%3DLR%3B%20JS-%3ECAD%7D%0A -
RE: Are there JSCAD user callbacks?
Not exactly what I asked for, but OpenSCAD shows stack trace when right clicking on an object, here for "edge2()":
https://forums.raspberrypi.com/viewtopic.php?t=333342&start=50#p2022797
Has JSCAD similar functionality?
-
Are there JSCAD user callbacks?
I have a JSCAD model of C36.10 fullerene graph embedded onto sphere:
https://openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/C36.10.concave.jscadI would like to be able to click on a vertex, and then that vertex should be moved to centroid polar coordinate of its neighbors, like vertex 7 here:
Since JSCAD is JavaScript in browser, it should be possible to add callback for mouse click event.
But is there some helper function that tells me which JSCAD object I have clicked on I can use in callback? -
JSCAD preview faster than "same" model OpenSCAD preview
I completed implentation of 6coloring for JSCAD, JSCAD_ and OpenSCAD today:
https://forums.raspberrypi.com/viewtopic.php?p=2032727#p2032727My planar graph playground tool "node.tetra.js" now creates planar graph sphere embeddings for JSCAD/OpenSCAD using the "same" spherical polygon and great circle arc (for graph edges) implementations:
When playing with both models, JSCAD preview mode is much faster than OpenSCAD preview for rotating the model, not sure whether it is a simpler preview or just better. Has anybody noticed similar?
Here is sample JSCAD model to play with online:
https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C60.6coloring.vtype.js20KB JSCAD file:
https://stamm-wilbrandt.de/en/forum/JSCAD.C60.6coloring.vtype.jsHere is "same" sample OpenSCAD model (32KB) for download:
https://stamm-wilbrandt.de/en/forum/C60.6coloring.vtype.scad -
RE: How to generate JSCAD model in browser JS and display like demo.html?
@hrgdavor I tried that with openjscad.xyz and it did not work. But it does work with locally hosted demo.html !
Thanks, until now I had browser console open right, editor in middle and only half of 3D view left. After drag and drop, I can close the editor and see new graphs whenever I run node.tetra.js to produce a different x.jscad. So much easier to work now ... -
RE: How to generate JSCAD model in browser JS and display like demo.html?
@hrgdavor I follow up on graph algorithm work I stopped 28 years ago:
https://stamm-wilbrandt.de/en/TR/IAI-TR-93-10.ps.pdf
I built undirected graph library as basis already, it will grow over time. Currently output formats of the tools are SVG, PostScript, and OpenSCAD and JSCAD for sphere embeddings:
https://github.com/Hermann-SW/planar_graph_playgroundAll planar graphs can be 4-colored (face as well as vertex, faces/vertices sharing an edge have to get different colors), there is a linear time algorithm for 5coloring, and I have built an even simpler 6coloring algorithm: https://github.com/Hermann-SW/planar_graph_playground/blob/main/undirected_graph.js#L311-L332
Yesterday I made 6coloring work for JSCAD sphere embedding, 6coloring for embedding into the plane worked long ago:
https://forums.raspberrypi.com/viewtopic.php?p=2032214#p2032214
6coloring algorithm did use 5 colors only for sphere spherical face coloring (of C60 fullerene) left:
https://www.youtube.com/watch?v=Zl-KumZDBbQ
-
RE: How to generate JSCAD model in browser JS and display like demo.html?
Thanks for the pointers, I will look into. Yesterday I found a solution myself, I just had incorrect mindset. Details of the (surprisingly small) diff needed in this posting:
https://forums.raspberrypi.com/viewtopic.php?p=2031648#p2031648This is new mode JSCAD_ running graph algorithms, system of linear equations solver and "main()" for viewing in browser:
https://openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD_.1.jsShould show like this browser with Auto-zoom enabled:
JSCAD_ takes longer than JSCAD mode, because running graph algorithms ...
Also JSCAD_ output is 36KB, JSCAD only 19KB. -
How to generate JSCAD model in browser JS and display like demo.html?
Creating JSCAD model with functionality inside works pretty well with NodeJS:
https://forums.raspberrypi.com/viewtopic.php?p=2030878#p2030878https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C60_vtype_b.js
I can create planar embedding into plane in browser JS and display using SVG:
https://hermann-sw.github.io/planar_graph_playground/Now I want to create new JSCAD model in browser JS and then display it as with "demo.html" in local webserver or openjscad.xyz.
Is that possible?
If so, where can I find doc or an example? -
RE: JSCAD for planar graph embeddings onto (unit) sphere
I implemented optional JSCAD output for planar graph playground "node.tetra.js", details here:
https://forums.raspberrypi.com/viewtopic.php?p=2030546#p2030546Until now I played with C20 hand edited for JSCAD, this is newly created C60 fullerene with 60 vertices and 90 edges:
https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C60_vtype.jsMore vertices and edges than for C20, but design regeneration still done in less than 10 seconds on Intel it Linux Chrome!
-
RE: openscad.xyz support for "data:" URI scheme would be cool
@z3dev Thanks, I see your point wrt security.
But what is the difference of ...uri=data:... to this openscad.xyz link with model wrt security? In case you eval the uri= specified file (and that seems to be the case because the model gets rendered in browser) you break the same security rules ...
https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.js -
RE: JSCAD for planar graph embeddings onto (unit) sphere
I answered the question on whether JSCAD will be performant enough for low design regeneration with 12 spherical pentagons (it is, takes less than 5 seconds on Intel i7 Chrome, with carefully chosen values for gray points/segments), because all fullerenes have exactly 12 pentagons (
12*3*2=72
sp_tria2()
calls, ...), details here:
https://forums.raspberrypi.com/viewtopic.php?p=2029576#p2029576https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C20_params.js
-
RE: JSCAD for planar graph embeddings onto (unit) sphere
Done, now "vertex()" optional 3rd parameter "half" works as well:
https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.vertex_half.jsGreen vertices 1, 2, 15 and 16 are forced as "half" vertices, that is a cube of right size gets subtracted from inside. Subtraction can be seen for vertex 1 at "look_inside" hole border. Vertex 2, 15 and 16 cannot be seen on inside anymore, unlike the other vertices with default "half=false":
... vertex(0, [1,0,0]) ,vertex(1, [0,1,0], true) ,vertex(2, [0,1,0], true) ... ,vertex(15, [0,1,0], true) ,vertex(16, [0,1,0], true) ...
-
RE: JSCAD for planar graph embeddings onto (unit) sphere
Not perfect, but "vtxt()" works now in JSCAD as well:
https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.vtxt.js -
RE: JSCAD for planar graph embeddings onto (unit) sphere
After a problem with spherical triangle implementation (my problem, not JSCAD problem) ...
https://openjscad.nodebb.com/topic/378/problem-with-subtract-ing-hull-is-this-a-bug/3?_=1660487451987... now spherical triangle works. I called it three times to fill one spherical pentagon:
,sp_tria(2,1,15) ,sp_tria(2,15,16) ,sp_tria(2,16,3) ...
You can see spherical gray polygon from outside, and nothing of spherical polygon breaks into white sphere difference on the inside:
Click for view+rotate+zoom, design regeneration takes less than 3 seconds on Intel i7 Chrome
(normally I use chromium-browser on Raspberry Pi OS, will test that in 2 weeks):
https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.spherical_polygon.js
Clicking "Enable Auoto-zoom" and "Enable Auto-rotate" results in nice animation ...P.S:
Next step is to port "vtxt()" for adding text labels to vertex sphere, and "half()" for subtracting cube from inner side of vertex sphere, avoiding vertex to shine through to inside for 3Dprinting later.
After that is done, I will make "node.tetra.js" create JSCAD output as alternative to sofar OpenSCAD output. Creating C60 with 12 spherical pentagons JSCAD file and measuring design regeneration time for it will answer whether JSCAD is usable for great circle arc edge embedding of planar graphs onto sphere: 12 spherical pentagons is 12*3=36 spherical triangles, is 72 "sp_tria2()" and 36 differences with "hull()" of 6 points (mini cubes) ... -
openscad.xyz support for "data:" URI scheme would be cool
"https://openjscad.xyz?uri=..." is cool.
"data:" URI scheme does not work for openjscad.xyz:
https://en.wikipedia.org/wiki/Data_URI_scheme#SyntaxI use this working minimal JSCAD file:
https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.minimal.jsmodule.exports=function main(){return require('@jscad/modeling').primitives.sphere({radius: 50})}
This URI does not work:
https://openjscad.xyz/?uri=data:text/html;module.exports=function main(){return require('@jscad/modeling').primitives.sphere({radius: 50})}Base64 encoding and using application/json does not work either:
https://openjscad.xyz/?uri=data:application/json;base64,bW9kdWxlLmV4cG9ydHM9ZnVuY3Rpb24gbWFpbigpe3JldHVybiByZXF1aXJlKCdAanNjYWQvbW9kZWxpbmcnKS5wcmltaXRpdmVzLnNwaGVyZSh7cmFkaXVzOiA1MH0pfQo=It would be cool to have "data:" links working with openjscad.xyz, because that would allow to share JSCAD files without storing them anywhere — they are stored as part of the link ...
For looking where&how to add "data:" scheme: How is "dist/jscad-web.min.js" generated?
-
RE: Problem with "subtract()"ing "hull()", is this a bug?
Forgot to post the "answer" link for viewing in browser:
https://openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/A.JSCAD.vertex_edge2.sp_tria.js