JSCAD User Group

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

    Davor Hrg

    @hrgdavor

    17
    Reputation
    122
    Profile views
    152
    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: fetch() in a design

      @Andreas-Plesch jscad.app has been just updated, and the example:

      const jscad = require('@jscad/modeling')
      const { deserializers } = require('@jscad/io')
      const { translate, scale, rotateZ } = jscad.transforms
      
      const main = async () => {
        const url = 'https://raw.githubusercontent.com/jscad/OpenJSCAD.org/master/packages/io/x3d-deserializer/tests/ElevationGrids.x3d'
        
        const response = await fetch(url)
        const cadX3D = await response.text()
        const cad = deserializers.x3d({ output: 'geometry' }, cadX3D)
      
        console.log(cad[1], jscad.geometries.geom3.isA(cad[1]))
      
        return cad[1]
      }
      
      module.exports = { main }
      

      works now

      posted in Design 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

    Latest posts made by hrgdavor

    • RE: Embedding a design in a website

      @cdub I have been slowly working on providing bits and pieces to create different apps/websites with jscad embeded in different ways here
      https://github.com/hrgdavor/jscadui/ ... contributors are welcome

      one of demos is about making a new version of jscad web https://jscad.app that was actually made by @platypii

      Although my progress is slow there, that is also one place where you could find useful stuff.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: fetch() in a design

      @Andreas-Plesch jscad.app is just a new prototype, not yet part of official jscad, I did not implement /remote ... it is meant for fetching remote scripts you can report issues on jscadui git or ask on discord.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: fetch() in a design

      @Andreas-Plesch there is also this
      https://github.com/hrgdavor/jscadui/tree/main/apps/model-page

      I made this as an example for some users that asdek on discord and published sample here https://3d.hrg.hr/tmp/darvin/

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: fetch() in a design

      @Andreas-Plesch jscad.app has been just updated, and the example:

      const jscad = require('@jscad/modeling')
      const { deserializers } = require('@jscad/io')
      const { translate, scale, rotateZ } = jscad.transforms
      
      const main = async () => {
        const url = 'https://raw.githubusercontent.com/jscad/OpenJSCAD.org/master/packages/io/x3d-deserializer/tests/ElevationGrids.x3d'
        
        const response = await fetch(url)
        const cadX3D = await response.text()
        const cad = deserializers.x3d({ output: 'geometry' }, cadX3D)
      
        console.log(cad[1], jscad.geometries.geom3.isA(cad[1]))
      
        return cad[1]
      }
      
      module.exports = { main }
      

      works now

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: fetch() in a design

      @Andreas-Plesch jscadui project also aims to simplify for users to create their own flavor of jscad app, or demo page for their parametric creations.

      talking about it, it may be cool if jscad app reacts to drag and drop of an url .... we then create a sample script that shows how to read model from ulr and how to start manipulating it

      const jscad = require('@jscad/modeling')
      const { deserialize } = require('@jscad/io')
      const { translate, scale, rotateZ } = jscad.transforms
      
      const main = async () => {
      const object = await deserialize('https://raw.githubusercontent.com/jscad/OpenJSCAD.org/master/packages/io/x3d-deserializer/tests/ElevationGrids.x3d')
        
        // you can do some jscad operations on the loaded object and return 
        // that instead the generated return below
      
        // sample script returns the deserialized object
        return object
      }
      
      module.exports = { main }
      
      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: fetch() in a design

      latest prototype of https://jscad.app supports async/promises main method.

      const jscad = require('@jscad/modeling')
      const { deserializers } = require('@jscad/io')
      const { translate, scale, rotateZ } = jscad.transforms
      
      const main = async () => {
        const url = 'https://raw.githubusercontent.com/jscad/OpenJSCAD.org/master/packages/io/x3d-deserializer/tests/ElevationGrids.x3d'
        
        //const url = 'https://raw.githubusercontent.com/create3000/Library/main/Tests/Components/CADGeometry/CADGeometry.x3d'
        const response = await fetch(url)
        const cadX3D = await response.text()
        // const cadX3D = x3d
        const cad = deserializers.x3d({ output: 'geometry' }, cadX3D)
      
        console.log(cad[1], jscad.geometries.geom3.isA(cad[1]))
      
        return cad[1]
      }
      
      module.exports = { main }
      

      4dd24ecb-835f-4f40-bfbf-b709735a3537-image.png

      the version that works with above mentioned code is not live yet, you can test by runing locally (untili it is):
      https://github.com/hrgdavor/jscadui/tree/main/apps/jscad-web

      IMPORTANT: jscad.app is playground for prototyping future version of openjscad web app, and is not part of of jscad officially yet, but most if not all features will make it to jscad when ready.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Interoperability with URDF / Gazebo and modelling of Robots

      @RelatingData that is openscad syntax, not jscad.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: AI in JSCAD for Generative AI

      @Jason-Sprouse it is an interesting idea. I am skeptical bout viability of current "AI" that is actually not AI, not even close.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: Starting reusing JSCAD for unfolding projects

      @gilboonet cool, combining it into single app would be awesome one day

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: How about a new design?

      @z3dev I periodically mention discord channel to ppl, so we could from time to time also mention this forum to users on those git tickets.

      posted in Design Discussions
      hrgdavor
      hrgdavor