JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Has anyone had success using openjscad in react?

    General Discussions
    4
    15
    369
    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.
    • K
      kevinos @z3dev last edited by

      @z3dev by V2 I assume you mean the V2 branch of the openjscad repo on github. What do you mean by pre-compiled (JSON) design? You won't insult my intelligence I'm fairly new to openjscad and web dev 😃

      Also, thank you for sharing, I did test locally and your project works. Very exciting!

      z3dev 1 Reply Last reply Reply Quote 0
      • z3dev
        z3dev @kevinos last edited by

        @kevinos sure.

        here's the code https://github.com/z3dev/vue-components

        this is only a viewer for a pre-compiled (JSON) design. V2 only!

        K 1 Reply Last reply Reply Quote 1
        • K
          kevinos @z3dev last edited by

          @z3dev Can you share your example with Vue? This might possibly give me some clues, or I might just switch to Vue.

          z3dev 1 Reply Last reply Reply Quote 0
          • K
            kevinos @gilboonet last edited by

            @gilboonet Ah ok, well thank you. So far I am able to embed openjscad into static pages, just have not been able to with react.

            1 Reply Last reply Reply Quote 0
            • gilboonet
              gilboonet @kevinos last edited by

              @kevinos No, as I wrote on my first reply, I don't use React.

              K 1 Reply Last reply Reply Quote 0
              • K
                kevinos @gilboonet last edited by

                @gilboonet Is this with React? I took the code in viewer-minimal.html, completely copied and pasted it into index.html added in the div with id root for react to pickup and that is all. I removed nothing from the example but it will not render.

                Just to be clear, I can get the view to render in a static html page, my question is more geared towards if anyone got it to render with react. I'm specifically using react and react-dom and this is on google chrome 84.0.4147.105 if that matters

                gilboonet 1 Reply Last reply Reply Quote 0
                • gilboonet
                  gilboonet @kevinos last edited by

                  @kevinos Capture d’écran de 2020-08-03 08-30-51.png It works for me (I changed the design-url). This error is maybe due to the fact that your server sent html generated content for error 404 (or so on) instead of min.js.

                  K 1 Reply Last reply Reply Quote 0
                  • z3dev
                    z3dev @kevinos last edited by

                    @kevinos There's no documentation on embedding because there far too many frameworks. However, as you already researched, there are people embedding JSCAD in webpages.

                    Recently, I've been playing Vue, and have a simple Vue component which can render a JSCAD V2 geometry. It's kind of cute, but shows potential.

                    K 1 Reply Last reply Reply Quote 0
                    • K
                      kevinos last edited by

                      Unfortunately there's an error, so it displays "Hello" since thats whats in the errordiv

                      2f971367-3df4-479e-a01f-6b8a57bbbb74-image.png

                      gilboonet 1 Reply Last reply Reply Quote 0
                      • gilboonet
                        gilboonet last edited by

                        Hello, I cannot help with react as I don't use it. Did you take a look at viewer-minimal.html (https://github.com/jscad/OpenJSCAD.org/blob/master/packages/web/viewer-minimal.html) ? It was my starting point to integrate jscad into web pages.

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        Powered by NodeBB | Contributors