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

    Start of V2 version of my unfolder

    Scheduled Pinned Locked Moved Design Discussions
    7 Posts 2 Posters 1.3k Views 1 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.
    • gilboonetG Offline
      gilboonet
      last edited by gilboonet

      Hello, this week I rewrote my automatic unfolder for jscad V2 and it already works fine. Can be tested here with a 280 faces model, https://openjscad.xyz/#https://raw.githubusercontent.com/gilboonet/gilboonet.github.io/master/outils/unfolderV2/unfold_PIG280.js!Capture d’écran de 2021-12-10 16-48-12.png

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

        @gilboonet Super cool! It's nice to know that V2 is working for your designs.

        Please post any updates or new designs.

        gilboonetG 1 Reply Last reply Reply Quote 0
        • gilboonetG Offline
          gilboonet @z3dev
          last edited by gilboonet

          @z3dev here's an update of the unfolder, a version that can use any 3d from jscad Capture d’écran de 2021-12-11 18-52-06.png
          can be tested here : https://openjscad.xyz/#https://raw.githubusercontent.com/gilboonet/gilboonet.github.io/master/outils/unfolderV2/unfoldCSG.js

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

            I almost finished the V2 automatic unfolder. I'm at the last step where I export all pieces on an svg. I have an array (rr[]) where I push all objects for each piece, then translate them accordingly to my frame size. It's not perfect on screen, but on svg it's worse. Capture d’écran de 2021-12-17 16-52-24.png Is there something I could do to have my pieces correctly distribued ? What I already do is measure each of them, then center it into frame dimensions and add frame.width x piece number.

            var b = measureAggregateBoundingBox(r)
                var d = [ b[0][0] + (b[1][0]-b[0][0])/2,
            		  				b[0][1] + (b[1][1]-b[0][1])/2 ]
                // frame
                var delta = [ (frame[0] * (nf + 0.5)) -d[0] +1, (frame[1] * 0.5) -d[1] +1]
                r = r.map( O => translate(delta, O))
                //r.push(rectangle({center: [frame[0]/2+frame[0]*nf, frame[1]/2]
            		//									, size: [frame[0], frame[1]]}))
                rr.push(r)
            
            gilboonetG 1 Reply Last reply Reply Quote 0
            • gilboonetG Offline
              gilboonet @gilboonet
              last edited by

              @gilboonet I replaced the r = r.map( O => translate(delta, O)) by a simple r = translate(delta, r) and the render is more accurate, but it changes nothing on the svg output. So for the moment I'm using the dxf output that works perfectly.

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

                @gilboonet thanks for the good information.

                I’d like to have the JSON export from the final results. The JSON will allow some testing of the SVG Serializer, which may have an issue.

                Can you attach the JSON to this thread? You may have to rename the file to *.txt

                gilboonetG 1 Reply Last reply Reply Quote 0
                • gilboonetG Offline
                  gilboonet @z3dev
                  last edited by

                  @z3dev the .json

                  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