JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

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

    Scheduled Pinned Locked Moved Design Discussions
    7 Posts 3 Posters 3.3k Views 2 Watching
    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-SWH Offline
      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?

      z3devZ 1 Reply Last reply Reply Quote 0
      • z3devZ Offline
        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
        • Hermann-SWH Offline
          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
          • hrgdavorH Offline
            hrgdavor
            last edited by

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

            Hermann-SWH 1 Reply Last reply Reply Quote 0
            • hrgdavorH Offline
              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-SWH 1 Reply Last reply Reply Quote 0
              • Hermann-SWH Offline
                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
                • Hermann-SWH Offline
                  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

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • First post
                    Last post
                  Powered by NodeBB | Contributors