Navigation

    JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. hrgdavor
    3. Posts
    • Profile
    • Following 2
    • Followers 0
    • Topics 12
    • Posts 119
    • Best 12
    • Groups 0

    Posts made by 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
    • RE: how to create a multicolor polyhedron ?

      looking at jscad sourcecode you can set color on each polygon,
      cd8a6544-f051-4e44-8f65-eec31b05461d-image.png

      const jscad = require('@jscad/modeling')
      const { cube } = jscad.primitives
      
      function main(){
        const c = cube({size:10})
        c.polygons[0].color = [1,0,0]
        c.polygons[2].color = [0,1,0]
        console.log(c)
        return c
      }
      
      module.exports = {main}
      
      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Using JSCAD to build meshes for BabylonJS

      @ajw1970 if you just push the jscad geometries to console or generate json, you will see the data inside is pretty intutive to to go through and convert to points for babylon or whatever you need.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Using JSCAD to build meshes for BabylonJS

      @ajw1970 I am curious, do you have a lot of experience with Babylonjs ?
      Is there a specific reason you are using it instead of Threejs ?
      I am not advocating Threejs or Babylon, it is just that I already have code that converts jscad models to Threejs geometries and Babylon is only in progress.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Using JSCAD to build meshes for BabylonJS

      Hi,
      I am currently working on compatibility layer for 3 webgl libs I know of: relg(currenttly used in jscad), threejs, babylonjs.

      I have pieces needed for threejs and regl, but I have just started with Exploring creating line segments and mesh via TypedArray directly (it is important for usability with web workers and performance of postMessage)

      The work is part of a prototype branch,
      https://github.com/jscad/OpenJSCAD.org/discussions/944

      If you use discord, I am more active there https://discord.gg/AaqGskur93

      Unfortunately email notifications do not work on this forum, and sometimes days go by before I remember to check for new topics . Actually @platypii alerted me about your question.

      I will check-in here also after I produce at least some working code for Babylonjs.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Unfolder V2, stress test on FF and Chrome

      @gilboonet that is excellent, it may be possible later on to integrate that one with jscad or at least take your experience for ideas how to improve 2D use-cases in jscad.

      posted in Comments & Feedback
      hrgdavor
      hrgdavor
    • RE: Unfolder V2, stress test on FF and Chrome

      @gilboonet that is great news. the performance gain will be available in new jscad prototype too....
      I could add 2d output to threejscad2 ...

      posted in Comments & Feedback
      hrgdavor
      hrgdavor
    • new JSCAD prototype progress 2022-01

      There is some progress in the prototype of jscad that is able to run 3 different 3D engines:

      • regl
      • Three.js
      • Babylon.js

      https://github.com/jscad/OpenJSCAD.org/discussions/944

      81ead24e-f169-4387-9451-33c04daaaf15-image.png

      https://user-images.githubusercontent.com/2480762/152607806-0d244616-f0b5-4212-8db5-691e5d5ec0b7.mp4

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Unfolder V2, stress test on FF and Chrome

      @gilboonet those can be tricky to debug. One thing I am thinking is if you really need 3000 faces. Is that practical to actually make ?

      Also issue could be in the code that sends your data to WEBGL.

      can you try to run it inside:
      http://3d.hrg.hr/jscad/three/threejscad2.html
      ?

      posted in Comments & Feedback
      hrgdavor
      hrgdavor
    • RE: Unfolder V2, test on Ubuntu with Chromium

      @gilboonet yes, specification for sort functions is to

      • return zero if a==b
      • return neg or positive number depending if u want to sort ASC or DESC
      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Unfolder V2, stress test on FF and Chrome

      @gilboonet JS uses a garbage collector, so to release memory you need to remove references to objects.

      One advanced trick when caching stuff is using WakMap https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap . This is a familiar concept to me from Java. It allows you to cache some heavy calculations but also allows garbage collector to delete them.

      Initial versions of garbage collectors counted references and when counter is zero they clean the mem. Then they added a concept of weak references where, you could reference something weakly, but allow garbage collector to clear it if RAM is needed.

      chrome dev tools has a nice profiler, probably firefox too, and you could use that to see where most of RAM is spent.

      posted in Comments & Feedback
      hrgdavor
      hrgdavor
    • RE: Does anyone use jscad on iPhone ?

      iti s hard to tell for these cases. unfortunately I do not have an iphone to test it.

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: V2 Unfolder complete, multipage pdf creation from its 2d output

      @gilboonet that is definitely something worth considering either as part of jscad or an addon library. I think we will have better idea after I have some time to cooperate with you on your project. It is definitely an interesting use-case, and a real project will give much needed insight on how to proceed with it.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: dynamic parameters caption works oddly

      @gilboonet it is nice to see a multilingual script 🙂

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: V2 Unfolder complete, multipage pdf creation from its 2d output

      @gilboonet there is even a possibility to do this via JS PDF library

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: function to create regular polygon

      @gilboonet not sure if this is what u need
      7094d8db-ba0c-4bb1-8b49-8401b616acee-image.png

      α angle of the triangle is Math.PI/sidesCount in radians or 360/sidesCount/2 in degrees
      red line is A = Math.sin(α)
      blue line is A=Math.cos(α)
      the radius you are looking for the circle isR=1 in this drawing

      R=sideLength/2/Math.sin(α)
      or
      sideLength=(R*Math.sin(α)) * 2

      
      const jscad = require('@jscad/modeling')
      // https://openjscad.xyz/docs/module-modeling_primitives.html
      const { circle } = jscad.primitives
      
      function main({// @jscad-params
      	sideLength = 15,
      	sidesCount = 6,
      }){
      	let alpha = Math.PI / sidesCount
      	let R = sideLength/2/Math.sin(alpha)
      	// R === sideLength in case of sideCount=6 (hexagon)
      	console.log('R',R)
      	return circle({radius:R, segments: sidesCount})
      }
      
      module.exports = {main}
      
      
      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: [Christmas Update!]New application of JSCAD: Fully 3D-printed music box

      Very glad to see interesting uses of jscad. Nice idea if I have seen correctly, that u are using hairpins for music.

      Also if you at some point want to share the project, there is rather new project for sharing code-cad projects: https://cadhub.xyz

      posted in General Discussions
      hrgdavor
      hrgdavor