JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. hrgdavor
    • Profile
    • Following 2
    • Followers 1
    • Topics 21
    • Posts 171
    • Best 16
    • Controversial 0
    • Groups 0

    Davor Hrg

    @hrgdavor

    18
    Reputation
    138
    Profile views
    171
    Posts
    1
    Followers
    2
    Following
    Joined Last Online
    Website hrg.hr/ Location Croatia Age 45

    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: Using JScad just to display 3D-Object

      @hpb-htw I am happy more people are using jscad, but I have to schose my battles carefuly 🙂 (so many things I would like todo in jscad, and so little time).

      I am not able to lead the effort, but I will be here to help troubleshooting while you explore options how to use import with jscad.

      There is one project that is doing it this way, and it uses sourcemaps. This could help you get stared: https://github.com/receter/jscad-playground/blob/main/index.html

      Looking forward to see what you find and what you make, as there are likely others interested in this approach.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: Using JScad just to display 3D-Object

      I am a bit confused, as initial description says model, but in the conversation here I am seing that you may want to actually execute a jscad script (to generate a model).

      If you have STL files or some other format supported by jscad/io regl renderer is really a good choice as it is very light, and is just fine for displaying the model.

      regl is still great if you want to execute a jscad script, but thigs get bit complicated there. Demo if I remember correctly executes model code directly on main thread, adn is you make sth complex that will need x number of seconds to generate, it would freeze the UI and confuse users.

      If you will have more complex scripts, you will want to use a worker, and then thing get complicated. Especially if you want scripts that are split in multiple imports.

      give us some more info on your use case, so we can suggest a good direction.

      posted in General Discussions
      hrgdavor
      hrgdavor
    • RE: Modifying Variables From Imported Parametric model

      @shay-cerny
      62f5e661-4ea7-47d8-bc3d-b824427253b2-image.png

      https://openjscad.xyz/#https://openjscad.xyz/examples/parameters/allParamTypes.js

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: Jscad.app prototype desktop app

      @DavidLyon66 this is just a desktop version of the jscad prototype: jscad.app.

      openjscad.xyz stared implementing a desktop version, but was abandoned.

      Although I can easily use jscad.app or openjscad.xyz in the browser there are benefits of having a desktop version (dedicated button in taskbar).

      It could also be just personal preference to have desktop app that reliably works offline (PWA can be great but could break if cache is cleared while offline).

      This is more of an attempt to reach more users, as some users consider not having a desktop app a deal-breaker.

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • Jscad.app prototype desktop app

      For those interested in desktop app.
      Here is initial draft version built with neutralino
      https://3d.hrg.hr/jscad/desktop/draft1/

      the desktop app is just wrapped jscad.app there is currently no specific customizations in it to enhance desktop experience.
      it should work well if your OS web view is chrome (I did not implement FS access through neuralino yet)

      to run it, download both: executable for your OS, and resources.neu, put them in the sam dir and run

      Feedback for different OS is welcome, I only have windows available to test currently.

      posted in Development Discussions
      hrgdavor
      hrgdavor
    • RE: API documentation links broken

      @Zachary-Keim good to hear. Guess it was a temporary issue 🙂

      posted in Comments & Feedback
      hrgdavor
      hrgdavor
    • RE: API documentation links broken

      @Zachary-Keim
      I clicked a bit but all links I tried except TOS worked ok

      4030841e-5141-457b-9731-2e4a82ee3537-image.png

      TOS links are broken.

      what Other links did you find not working ?

      posted in Comments & Feedback
      hrgdavor
      hrgdavor
    • RE: Click to item for Callback/Event functionality

      @DavidLyon66 that is something I really want to imeplement, but I need to ask @z3dev to confirm this is not something in scope of jscad itself ... at least for now. I would need to experiment with it in jscadui.

      I have made some progress there that will be usable for jscad, but it takes years with time am able to put aside for it.

      making an extension that goes beyond exporting main method would allow to keep the current principle for jscad, and that principle serves well many users and many use cases.

      I would go about it by requiring an interactive script like you would like to create to export a different method, for example: export function interactive(){...} . There we could experiment with script doing more that just generating models without braking existing scripts and without confusing users that do not need such interactivity.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Click to item for Callback/Event functionality

      @DavidLyon66 said in Click to item for Callback/Event functionality:

      I would have thought that a callback with an index for the item on selection might not have been that hard.

      Said like that it is not too hard but it opens a pandora box and a can of worms.

      • who receives the callback,
      • do you need also moseover event
      • how do you highlight the selected element ?
      • what types of highlights would you need
      • what would you do with the selected item afterwards
      • index is fragile, objects should have a unique id for callback
      • script is in the worker, renderer is on main thread
      • how to send granular updates instead of re-render whole script (exponentional complication)

      Other contributors might disagree with me here, but I think this is something a separate project should do by using jscad.

      posted in Design Discussions
      hrgdavor
      hrgdavor
    • RE: Click to item for Callback/Event functionality

      @DavidLyon66 said in Click to item for Callback/Event functionality:

      be able to in code be able to do modifications to that selected object.

      in my opinion, this sentence alone makes it much more complicated than blender or ultimaker cura.

      If someone would implement what you are suggesting in jscad I would very happy and impressed at the same time.

      I am one of few developers that are still active on the project (although little by little, and much less I would like). Even if were to work on this full time my guess is it would take me at least a year, and even then I am not sure to what extent it would match your expectations (or at least what I imagine your expectations are here).

      btw, Blender has much more people smarter than me working there full time.

      TLDR;
      This looks huge to me and I would not dare to even start it, I would not mind if somebody would do it though.

      posted in Design Discussions
      hrgdavor
      hrgdavor