Navigation

    JSCAD User Group

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

    Davor Hrg

    @hrgdavor

    14
    Reputation
    121
    Profile views
    119
    Posts
    0
    Followers
    2
    Following
    Joined Last Online
    Website hrg.hr/ Location Croatia Age 42

    hrgdavor Unfollow Follow

    Best posts made by hrgdavor

    • RE: Embedding a design in a website

      Unfortunately, things that would make this possible easily are still in develompment.

      option1 (future)

      3mf serializer is on the way and with it you would be able to export colors I think and then use threjs 3mf import

      Option 2 (you can do right now)

      you can use my nasty coded(below linked) jscad prototype to load jscad script(only single file scripts currently) and do 3mf export there(it does have a bug with instances right now, but I could get to fixing it if you rly need this).

      Option 3 (you can do right now)

      If you are eager to do it and not have time to wait these things in jscad core, here is a link to my nasty code that runs jscad using threejs instead of regl
      http://3d.hrg.hr/jscad/three/threejscad2.html?

      You need to export json (it is just JSON.stringify of the geometries)

      Make a page with threejs, load json, and then convert those to BufferGeometry

      code I have to convert from jscad to threejs is in these 2 scripts:

      http://3d.hrg.hr/jscad/three/CSGToBuffers.js
      http://3d.hrg.hr/jscad/three/CSG2Object3D.js

      I have cleaning to do to bring this to jscad, along with some other changes needed in jscad inernally.

      If you want to use this right now, and you have questions about the scripts I can also be reached on discord.

      posted in General Discussions
      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: Hosting/publishing a shape?

      I am using github gists, and then make a link to openjscad taht opens that gist

      example:
      https://jscad.xyz/#https://gist.githubusercontent.com/hrgdavor/7419194097fc2ffd42d840f82fc83ca1/raw/31e0194693629e780e3b82848f9082d1796814ec/rounded_top.js

      and gist is :
      https://gist.github.com/hrgdavor/7419194097fc2ffd42d840f82fc83ca1/

      posted in General Discussions
      hrgdavor
      hrgdavor
    • cadhub.xyz integration

      as discussed here: https://github.com/jscad/OpenJSCAD.org/discussions/893

      Initial test integration is available (now: 2021-08-01) https://cadhub.xyz/dev-ide/jscad

      bc8e69e7-5fe4-4325-86b4-6bec0f0e6a00-image.png

      check it out, feedback is appreciated.

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Initial release of FlexiSystem

      nice prototype 🙂

      is it opensource ?

      posted in General Discussions
      hrgdavor
      hrgdavor
    • cadhub.xyz integration is now live !

      visit https://cadhub.xyz/projects to see our first example there ... I chose the prettiest one :), although the slowest one I have 😞

      3085c0d5-242a-46e7-9fd3-66e1ac80623f-image.png

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Auto-reload and external editor workflows

      Hi,
      kudos for the atx connector generator, pretty nice one 🙂

      I am using windows 10 and chrome. Auto-reload on jscad.xyz works just fine for me.

      Bu it only works for me if I drag and drop the jscad file on the button, but not if I click the button and chose the file.
      dab061a7-76ad-47a6-afd4-929e73ed9edf-image.png

      I have used livereload for many years now and I use the one from npm:
      https://www.npmjs.com/package/livereload
      It may not have been developed for years but it just works.

      livereload is actually not required, but it helps to reload changes faster (notice changes faster)
      without livereload jscad has to scan project files/files periodically which can become slow

      ...
      I have also converted from OpenSCAD when I discovered openjscad.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: Auto-reload and external editor workflows

      @rich-27 thanks for the feedback 🙂 ... it is nice see more people join the community. Have fun and create more cool stuff 🙂

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: Auto-reload and external editor workflows

      @rich-27 Browser glitches are pain to investigate and fix.

      I am not a dev here, but I am curious.

      Could you just for sake of more info test your "dice charging station" in chrome incognito(without plugins or ad blockers)

      make sure "Enable Auto-reload" is checked and then use drag and drop to load the project file.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • three.js integration part2 (threejscad)

      Hello ppl, here is my second update regarding the three.js integration.

      The effort now has a code-name: threejscad 😄

      I very much dislike functional style programming so I hope my explorations with threejs will give ideas for improvement in jscad as it is not very likely I would be able to bring those improvements to jscad codebase.

      I appreciate all the effort that went into making jscad v1 and v2, it really is refreshing and smooth experience after using OpenSCAD. Generating a bit more complex model to STL would take ages in OpenSCAD so it quickly became annoying to work with.

      I have tested most of the jscad examples that do not load additional resources, and have found an example where threejscad is faster.

      565d6b47-2a82-4255-92d4-9716d82aa003-image.png

      • jscad: colorCube.js
      • threejscad colorCube.js

      click both urls and play with "Colorize Method" parameter to compare how long it takes to show the result in each instance.
      Performance is gained by reusing the geometry so webgl ony needs to upload it in GPU once and then render it in different locations with different color.

      Another example that intrigued me was parametric_butt_hinge.

      3c5710a3-2c8f-4b25-8baa-bcb7d5a5ab1e-image.png

      • jscad: parametric_butt_hinge
      • threejscad parametric_butt_hinge

      You may notice that I have implemented my own generator for forms based on parameter definitions, and improved the slider a bit

      • it show the value
      • it has an additional option live=1 to render the scene while dragging the slider (I just love to do it when render is fast)

      In this example jscad takes quite a long time to render (which is just fine and not too long when all you ned is to generate STL from it).
      But this is a great example where rendering is too slow for animating and caching the shapes makes it smooooooth.

      This optimization works by making a small change in original theparametric_butt_hinge code:

      create cahce variable outside main method

      let cache = {}
      

      Generate cache key by serializing params object. To have the same key regardless of the view options, those options are set to fixed value before serialization. Generate new model only if cache key changes.

        const key = JSON.stringify({...params,m_flip_model:0,m_throw_angle:0})
        if(cache.key != key){
          cache.key = key
          cache.female = leaf(params, C_FEMALE)
          cache.male = leaf(params, C_MALE)
        }
      

      This optimization currenty works in threejscad but not in jscad. The reason is that jscad runs the whole model file from scratch, but threejscad re-runs the main method, allowing this type of caching to work.

      After making the jscad models work in three.js and loading this one, I just enjoyed dragging the "Throw angle" slider and seeing the hinge move instantly.

      posted in General Discussions
      hrgdavor
      hrgdavor

    Latest 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