JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How to generate JSCAD model in browser JS and display like demo.html?

    Design Discussions
    3
    7
    1572
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Hermann-SW
      Hermann-SW last edited by

      Creating JSCAD model with functionality inside works pretty well with NodeJS:
      https://forums.raspberrypi.com/viewtopic.php?p=2030878#p2030878

      https://www.openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/JSCAD.C60_vtype_b.js
      alt text

      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?

      z3dev 1 Reply Last reply Reply Quote 0
      • Hermann-SW
        Hermann-SW @hrgdavor last edited by

        @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 ...

        1 Reply Last reply Reply Quote 0
        • Hermann-SW
          Hermann-SW @hrgdavor last edited by Hermann-SW

          @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_playground

          All 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
          https://stamm-wilbrandt.de/en/forum/6coloring.spherical_plane.png

          1 Reply Last reply Reply Quote 0
          • hrgdavor
            hrgdavor last edited by

            Also if you have commandline that produces a jscad script to be executed, you can use jscad to view it without placing it online

            if you have a commandline like: command_produce_sth_for_jscad.sh > test.js

            then you open https://openjscad.xyz/ and turn on Auto reload and drag and drop the test.js

            each time you want to update the output you can run command_produce_sth_for_jscad.sh > test.js
            and jscad will notice changed file and reload it.

            Hermann-SW 1 Reply Last reply Reply Quote 0
            • hrgdavor
              hrgdavor last edited by

              That looks cool. What is the the use case for those planar graphs ?

              Hermann-SW 1 Reply Last reply Reply Quote 0
              • Hermann-SW
                Hermann-SW last edited by

                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#p2031648

                This 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.js

                Should show like this browser with Auto-zoom enabled:
                https://forums.raspberrypi.com/download/file.php?id=56287

                JSCAD_ takes longer than JSCAD mode, because running graph algorithms ...
                Also JSCAD_ output is 36KB, JSCAD only 19KB.

                1 Reply Last reply Reply Quote 0
                • z3dev
                  z3dev @Hermann-SW last edited by z3dev

                  @Hermann-SW There several examples of websites mentioned in this user group, so you might want to contact those authors.

                  It seems that you already stumbled across the simple demo as part of regl-renderer. You could build upon that, or adopt one the frameworks, such as React.

                  You can find some links on the User Guide. I'm trying to keep this up to date.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB | Contributors