JSCAD User Group

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

    Davor Hrg

    @hrgdavor

    15
    Reputation
    121
    Profile views
    142
    Posts
    1
    Followers
    2
    Following
    Joined Last Online
    Website hrg.hr/ Location Croatia Age 43

    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
    • 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: 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

    Latest posts made by hrgdavor

    • RE: Default JSCAD script (index.js) for self-hosted website

      @z3dev that is exactly type of projects I want more jscad users to be able to do. It will likely be able to benefit from some of the resopnsiveness improvments I am making.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: export colored model to .obj

      @gilboonet vool 🙂 . Nice to see it working

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: export colored model to .obj

      @gilboonet the issue is likely that export calls generalize that then calls retessellate. these function try to fix the polygons if there are some fixable errors and also cobine multiple triangles that are coplanar into a single polygon. At that point the color info is lost as those colored triangles are replaced by a new polygon.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Designing with text

      @gilboonet I have on my list adding better support for ttf fonts, google fonts, but it will be some time until I get to it. There is also a bug in JSCAD bezier svg handling, that caused some of fonts to display differently than originally designed.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Designing with text

      @gilboonet VectorChar seems to work better, so you have a solution 🙂 Please share results of what you are aiming to create.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Designing with text

      @gilboonet taking a quick glance at the screenshot, you would not have issues with "4" if the sequence of transformations is rotation first, then translation. Using bezier is ok, but I am not sure there is anything to directly get value you need from bezier control points. But there are few bezier libs in JS that you could use to do whatever you might need.

      like https://pomax.github.io/bezierjs/

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • Realtime boolean preview using GPU image based csg!!

      The bounty was successfully collected for https://github.com/hrgdavor/jscadui/issues/17

      and the result is amazing little demo of boolean preview that you see realtime spheres cutting a block with no waiting.

      https://loosetooth.github.io/scs-csg-subtraction-webgl/
      84993634-b02d-4f90-9618-d5d1fbedae38-image.png

      and the repo is
      https://github.com/Loosetooth/scs-csg-subtraction-webgl

      posted in Development Discussions
      hrgdavor
      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