JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. hrgdavor
    3. Posts
    • Profile
    • Following 2
    • Followers 1
    • Topics 19
    • Posts 135
    • Best 13
    • Controversial 0
    • Groups 0

    Posts made by hrgdavor

    • some more progress with prototype.

      Loading of folder projects works, it can handle ESM modules, cjs scripts (require) and even typescript projects. Also worker improvements that allow script developers to optimize execution when parameters change and cache expensive operations.

      current jscad

      https://user-images.githubusercontent.com/2480762/213881095-dcd72bce-881a-463d-a105-c9ad9c0b44bb.mp4

      my new prototype is still ugly, but things are progressing bit by bit

      It was my mission from the first attempt at making a new jscad prototype to allow script developers to optimize for performance and bling.

      in this example I took a complex model and added caching so that model is kept in case only View Options parameters change. Those only affect rotation of the parts.

      also I enhanced parameter definition to allow for live updates for any of the parameter (it is not default, but opt-in)

      https://user-images.githubusercontent.com/2480762/213881066-e947e0ae-1b80-4a06-8234-fa9b1c974a19.mp4

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Default JSCAD script (index.js) for self-hosted website

      @tjw25425 if you would go in direction uding threejs this could help with faster preview
      https://github.com/gkjohnson/three-bvh-csg

      and then for export use jscad to perform the boolean operations.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: Default JSCAD script (index.js) for self-hosted website

      That is an interesting, but also bit complex use-case. Probably will be heavy on computation, sou you will need to do the computing in a worker. Also you need to pass graphic data for rendering back to main thread. And there is a question if you already have chosen webgl engine, or you can use current jsacad default: regl

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: A project for rendering JSCAD in JupyterLab

      It is nice to see more users and a new enviroment. @z3dev we should think about adding a section on jscad website with links to projects like this so other users that are interested in this way of interacting with jscad can find it.

      @TerryGeng there are few of jscad fans also on discord, you may share your plugin there too. https://discord.gg/AaqGskur93

      posted in General Discussions
      hrgdavor
      hrgdavor
    • Themes for all 3 engines in the prototype

      also

      • reusable orbit controls (same one used for all 3 engines)
      • html based gizmo for camera
      • camera jumps to common positions
      • camera jump animations
      • transparency works on all 3
      • color on meshes and default color from theme

      18931cf5-3daa-4f1b-ad7a-a6c31a99727a-image.png

      video:

      https://user-images.githubusercontent.com/2480762/206038051-31938795-2f32-44ef-b29b-b428bdef22d0.mp4

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Reusable OrbitControls and camera gizmo

      default colors and transforms for babylon
      febb97cd-3c8c-425f-a7b4-703746fd89f4-image.png

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • $100 Bounty OpenCsg port proof of concept

      $100 Bounty OpenCsg port proof of concept , looking for ways to ensure the payment that is not PayPal
      https://github.com/hrgdavor/jscadui/issues/17

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Reusable OrbitControls and camera gizmo

      @gilboonet thnx. It has been slow for almost a year due to many projects at work, but finally I am having more time to move forward with jscad UI components.

      6ab77b66-d43d-436a-bc7b-33c7a4b741ca-image.png

      there were some tricky things to get different rendering engines to render jscad models. There are some differences regards to lighting, color channels (rgb,rgba) and babylon uses different orientation of vertices than three and regl...

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • Reusable OrbitControls and camera gizmo

      Things are progressing bit faster, and here is some progress on orbit controls and camera gizmo.

      04aebfad-6406-40b4-a4c5-cd53758274aa-image.png

      video:
      https://user-images.githubusercontent.com/2480762/205169462-dc4d3be3-d58f-4ed0-b07b-89249412945d.mp4

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • camera view gizmo cube

      My attention is dispersed (it is my nature) but things are happening that will bring some useful things to jscad.

      One feature that I wanted to have is a gizmo in the corner that shows current camera orientation when the model itself obscures the exes lines.

      I am close to finishing OrbitControls code that can be used for all 3 render engines. But the gizmo is closer to finishing so here is a little demo
      https://hrgdavor.github.io/jscadui/html-gizmo/

      2ade0967-a2e9-408c-8c0d-75dff42ef070-image.png

      and video of my OrbitControl moving all 3 engines at the same time on the same page

      https://user-images.githubusercontent.com/2480762/202859326-f08a2138-540c-4817-87ed-71586af037cc.mp4

      scrn:
      493ced4b-0e21-406c-921e-1f635f23961d-image.png

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: interesting new project

      @z3dev got my first email from this user group 🙂 and daily digest. That is great news that you got this working.

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • interesting new project

      https://discourse.threejs.org/t/three-bvh-csg-a-library-for-performing-fast-csg-operations/42713

      claims even 100x performance for booleans

      look at this smooth realtime boolean 🙂

      https://gkjohnson.github.io/three-bvh-csg/examples/bundle/simple.html

      It is dependant on threejs, but is interesting to explore nevertheless
      https://github.com/gkjohnson/three-bvh-csg

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Are there JSCAD user callbacks?

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

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • Multipart project template others could find useful

      copy pasta from https://github.com/jscad/OpenJSCAD.org/discussions/1141

      Sharing this idea and also calling to discuss improvements to it.
      Even ideas how jscad could be improved to better facilitate use case like this are welcome.

      Very often when creating thins for 3d print I have multiple parts, so in time I have created a sort of template I like to use. Even if I have single piece I tend to split design in few parts to more easily handle it.

      This is the latest iteration that solves few issues for me

      • parameter definition to select a part is generated automatically
      • no need to declare configurable parameters in each function ( func that creates a part)
      • can reuse one part in another part
      const jscad = require('@jscad/modeling')
      const {sphere, cube} = jscad.primitives 
      const {translate} = jscad.transforms
      
      // all of the functions that generate parts will see the parameters without declaring them explicitly
      const main = ({//@jscad-params
        size=10, // {type:'slider'}
        part,
      }, getParams)=>{
      
        // UTILITY placeholder for part generator functions
        const parts = {}
      
        // CTRL+R in vscode works just fine
        parts.Sample_Cube = ()=>cube({size})
      
        parts.Sample_Sphere = ()=>{
          return sphere({radius:size/2})
        }
      
        // parts can easily be combined
        parts.Assembly = ()=>([
          // jump to definition in vscode (ALT+click) works
          parts.Sample_Cube(),
          translate([size+5,0,0], parts.Sample_Sphere()),
        ])
      
        /*********************** UTILITY below is just utility code. do not change **************** */
      
        // we were called by getParameterDefinitions so we need to provide list of parts
        if(getParams === true){
          const values = Object.keys(parts)
          return {values, initial: values[0]}
        }
      
        // make sure we always call one of the functions
        if(!parts[part]) part = Object.keys(parts)[0]
        return parts[part]()
      }
      
      const getParameterDefinitions = ()=>[{ name: 'part', caption:'Part', type: 'choice', ...main({}, true)}]
      
      module.exports = {main, getParameterDefinitions}
      

      image

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: How to generate JSCAD model in browser JS and display like demo.html?

      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.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: How to generate JSCAD model in browser JS and display like demo.html?

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

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Dynamically updating the parameter array returned by getParameterDefinitions() ?

      @antoine-guillaume this could be done by adding support for a second function getDynamicParameters where:

      • firstly getParameterDefinitions is called and a list of basic parameters is generated and remembered
      • secondly getDynamicParameters is called but with the values from the form and it provides more inputs
      • on any change to base parameters, getDynamicParameters is called again with changed values to regenerate dynamic list of inputs

      if there are ppl interested in this feature please open an issue or a discussion where we could define a feature like this. This is something I could implement relatively easy in my new prototype, but is unlikely I would have patience to buid it ony the current jscad web from master branch.
      https://github.com/jscad/OpenJSCAD.org/discussions/944

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: A camera without gimbal lock

      progress of the mentioned prototype with suport for different wegl libs can be found here:
      https://github.com/jscad/OpenJSCAD.org/discussions/944

      I have just made another step forward: mesh support (but with some quirks ATM)
      I have some lighting to fix, and also babylonjs for some weird rason uses left handed system (this adds a bit of complexity to the worker to support it properly)

      Also when switching viewers, if they are different orioentation currently I need to run the script again manually to get properly oriented triangles

      https://user-images.githubusercontent.com/2480762/162638934-7a945625-420d-4041-98fc-5735fcc34c6b.mp4

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Build a specialized graphical editor

      for now best piece of code to start with using jscad standalone or creating an app is I think in packages/utils/regl-renderer/demo.html

      it is the basis I used for my jscad experiments

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Dynamically updating the parameter array returned by getParameterDefinitions() ?

      @udif perhaps add an issue on git, with examples what you would like to do with parameters, we could discussit there a bit more, and maybe come-up with some ideas.

      This is not something possible right now, so it could be a feature request.

      posted in General Discussions
      hrgdavor
      hrgdavor