JSCAD User Group

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

    Are there JSCAD user callbacks?

    Development Discussions
    3
    4
    744
    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 Hermann-SW

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

      I 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:
      C36.10.concave.jscad.anim.gif

      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?

      Hermann-SW 1 Reply Last reply Reply Quote 0
      • Referenced by  Hermann-SW Hermann-SW 
      • Jason Sprouse
        Jason Sprouse @Hermann-SW last edited by

        @Hermann-SW said in Are there JSCAD user callbacks?:

        tionality?

        Wouldn't that also be displayed in the browser stack trace?

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

          @Hermann-SW this is one of many thing we would like to implement, but it is not implemented, or even specified as a possible future feature.

          Current 3d engine is regl, and I am working on interchangeable support for Three.js and Babylon.js.

          regl has slowed down with development but Three.js and Babylon.js are very much active
          Getting info what object is clicked or mouse over is easy in Three.js and Babylon , but for regl I am not sure (it may or may not be easy to do).

          You likely want to use jacad to generate geometries, give them some identifiers, interact with them and then upon interaction change the model with performance in mind by updating only things that changed.

          This is something we could colaborate on, but it is not something that can be simply implemented as part of jscad script runner. Because the current workflow for jscad is:

          • make a script
          • expose getParameterDefinitions - jscad can generate params form
          • expose main method - jscad will call it with parameters and display result
            As you can see there is no concept of partial interactions or reactive changes, it is more like a commandline program that you write, and jscad calls to display it's output in 3d (and provide export option)

          there are several building blocks that make this combo getParameterDefinitions + main work, with proper separation of those building blocks users would be allow to create much more than just scripts that produce 3d geometry. But such efforts take time, and we are low on man-power.

          One such reusable block I started creating is code editor https://github.com/hrgdavor/jsx6/tree/main/libs/editor-monaco although there are nice code editors, they are not too easy to use or combine with JS projects (takes too much knowledge) so I am aiming to create more friendly wrappers. Each editor is stuck with their own cool build process and tooling that was popular at the time of the project start.

          I am also improving my skills with web workers, and babel transformations to provide building blocks for script execution with proper line numbers in stack traces and built-in browser's debugger integration.

          so, slowly something is comming along ... slowly...

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

            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?
            https://stamm-wilbrandt.de/en/forum/OpenSCAD.object.stack_trace.png

            hrgdavor Jason Sprouse 2 Replies Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB | Contributors