JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Using Jscad in a web project

    Scheduled Pinned Locked Moved Development Discussions
    5 Posts 3 Posters 1.4k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      walt
      last edited by

      I'm trying to use Jscad to display my 3D models. I have code which I got from openjscad.xyz to create the viewer like so:

      const el1 = document.getElementById('jscad')
      const jscadInst1 = jscadWeb(el1, {name: 'jscad1'})
      

      But now, how do I interact with the viewer? I need to be able to:

      • load a file (STL or Jscad),
      • set the foreground and background colors,
      • remove any loaded files from the viewer

      Any help would be much appreciated!
      Walt

      1 Reply Last reply Reply Quote 0
      • hrgdavorH Offline
        hrgdavor
        last edited by hrgdavor

        There is a simpler demo in jscad source that uses regl renderer
        https://github.com/jscad/OpenJSCAD.org/blob/master/packages/utils/regl-renderer/demo.html
        there is also a version of it that runs in a web-worker that is not yet ready for public eyes (still a bit messy)

        and bit of advertisement after that:
        I am working on a version that renders via threejs that has multiple levels of render performance improvements
        http://3d.hrg.hr/jscad/three/threejscad.html?uri=model.logos.js (handles ok 10x10x10 logos)

        latest improvement being instancing (handles 32x32x32 logos no problem ... while regl chokes above 4x4x4)
        http://3d.hrg.hr/jscad/three/threejscad2.html?uri=model.logos.js

        still, that threejs based code is a bloody mess currently but if you want to discuss jscad related stuff in a chat
        https://discord.gg/BVnJ27vgcD

        1 Reply Last reply Reply Quote 0
        • z3devZ Offline
          z3dev
          last edited by

          @walt Welcome!

          There are several discussions available, so please look around.

          If you’re familiar with REACT or VUE frameworks then you can try the components created by some of our more experienced users. These may be a good solution to get something started quickly.

          Let us know if you have any questions!

          1 Reply Last reply Reply Quote 0
          • W Offline
            walt
            last edited by walt

            Thanks for the replies.

            All I really need to do is have the Jscad viewer display my file (which may be an STL or a JSCAD file) when the page loads. Is there any way for my javascript code to make the view display my file?

            1 Reply Last reply Reply Quote 0
            • hrgdavorH Offline
              hrgdavor
              last edited by hrgdavor

              check this post https://openjscad.nodebb.com/topic/248/react-library-v2

              or this https://github.com/jscad/OpenJSCAD.org/discussions/895

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              Powered by NodeBB | Contributors