sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    Mac User? | Join the Rayscaper Beta for Mac Learn More

    Triangulate triangles ?

    Scheduled Pinned Locked Moved Plugins
    41 Posts 8 Posters 11.3k Views 8 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.
    • Rich O BrienR
      Rich O Brien Moderator
      last edited by

      It is Artisan subdivide. Thank you Catmull Clark πŸ˜‰

      Download the free D'oh Book for SketchUp πŸ“–

      1 Reply Last reply
      Reply Quote 0
      • pilouP
        pilou
        last edited by

        So no! πŸ˜„ And why not the connections with middles ?

        Medians are wanted! πŸ˜„
        But if you a have the plugin why not, that can be used for other thing πŸ˜„

        Frenchy Pilou
        Is beautiful that please without concept!
        My Little site :)

        1 Reply Last reply
        Reply Quote 0
        • pilouP
          pilou
          last edited by

          Yep cool, but not like the first post πŸ˜„
          And I should know it! πŸ˜‰

          Frenchy Pilou
          Is beautiful that please without concept!
          My Little site :)

          1 Reply Last reply
          Reply Quote 0
          • pilouP
            pilou
            last edited by

            Alas I have deserted the Ruby language for a while! 😞

            If you can make a little plugin that will be wonderful 😎

            Frenchy Pilou
            Is beautiful that please without concept!
            My Little site :)

            1 Reply Last reply
            Reply Quote 0
            • renderizaR
              renderiza
              last edited by

              Here is an example code for achieving what you want Pilou...

              
              model = Sketchup.active_model
              ents = model.active_entities
              sel = model.selection
              faces = ents.grep(Sketchup;;Face)
              
              faces.each do |face|
                vertices = face.vertices
                bbox = face.bounds
                cpoint = bbox.center
              
                vertices.each do |vertex|
                  p1 = cpoint
                  p2 = vertex
                  line = ents.add_line p1,p2 
                 end
              end
              
              

              Note: Some very pretty geometry start appearing when you keep splitting! πŸ‘

              [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

              1 Reply Last reply
              Reply Quote 0
              • renderizaR
                renderiza
                last edited by

                I will do that! πŸ‘

                [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                1 Reply Last reply
                Reply Quote 0
                • TIGT
                  TIG Moderator
                  last edited by

                  Beat me to it πŸ˜‰
                  You might want to change the
                  faces = ents.grep(Sketchup::Face)
                  to
                  faces = **sel**.grep(Sketchup::Face)
                  So then the user changes only selected faces ?
                  OR perhaps
                  faces = sel.grep(Sketchup::Face) faces = ents.grep(Sketchup::Face) **unless faces[0]**
                  so it works on a selection OR everything if there is no selection...

                  Also you want to make it undoable, so add
                  **model.start_operation('subtri')** faces.each... ...end **model.commit_operation**
                  πŸ€“

                  TIG

                  1 Reply Last reply
                  Reply Quote 0
                  • renderizaR
                    renderiza
                    last edited by

                    Hahaha!

                    TIG I would be very happy if you modify your existing plugin to add Pilou is feature request. πŸ‘

                    I am interested in making this for learning and I have some additional ideas I want to explore. I consider you my mentor TIG and there will never be competition between you and me I promise! πŸ’š

                    By the way thanks for the suggestion! πŸ‘

                    Here is updated code...

                    model = Sketchup.active_model
                    ents = model.active_entities
                    sel = model.selection
                    faces = sel.grep(Sketchup;;Face)
                    
                    model.start_operation('csplit')
                      faces.each do |face|
                        vertices = face.vertices
                        bbox = face.bounds
                        cpoint = bbox.center
                    
                        vertices.each do |vertex|
                          p1 = cpoint
                          p2 = vertex
                          line = ents.add_line p1,p2
                        end
                      end
                      sel.clear
                    model.commit_operation
                    

                    [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                    1 Reply Last reply
                    Reply Quote 0
                    • TIGT
                      TIG Moderator
                      last edited by

                      OK
                      I'll make a simple script and publish it shortly...

                      TIG

                      1 Reply Last reply
                      Reply Quote 0
                      • renderizaR
                        renderiza
                        last edited by

                        Thank you TIG! πŸ‘

                        [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                        1 Reply Last reply
                        Reply Quote 0
                        • A
                          anar
                          last edited by

                          Thanks Pilou !
                          You convinced TIG...
                          And Thanks TIG, I think it's a must have !

                          http://www.polyloop.net/attachment.php?attachmentid=32959&d=1382032801

                          1 Reply Last reply
                          Reply Quote 0
                          • TIGT
                            TIG Moderator
                            last edited by

                            Try this http://sketchucation.com/forums/viewtopic.php?p=495430#p495430
                            TriangulateAllFaces...

                            TIG

                            1 Reply Last reply
                            Reply Quote 0
                            • cottyC
                              cotty
                              last edited by

                              I think the triangulation is not the same...


                              tri.jpg

                              my SketchUp gallery

                              1 Reply Last reply
                              Reply Quote 0
                              • renderizaR
                                renderiza
                                last edited by

                                Both of these are very useful so maybe add an option to choose between the two.

                                http://s23.postimg.org/sp0h6r557/e_1.png

                                [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                                1 Reply Last reply
                                Reply Quote 0
                                • TIGT
                                  TIG Moderator
                                  last edited by

                                  To do the former you need to first triangulate all faces, then find each triangle's center using the angles' bisectors' intersections...
                                  πŸ˜•

                                  TIG

                                  1 Reply Last reply
                                  Reply Quote 0
                                  • renderizaR
                                    renderiza
                                    last edited by

                                    Not as easy as using the center of face.bounds.center is it. πŸ˜•

                                    If I find the best way to do it with code I'll let you know...Best of luck! πŸ‘

                                    [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                                    1 Reply Last reply
                                    Reply Quote 0
                                    • renderizaR
                                      renderiza
                                      last edited by

                                      I sure don't call the code below a success but its definitely interesting...

                                      http://s13.postimg.org/yerdljl8n/eee.jpg

                                      
                                      model = Sketchup.active_model
                                      ents = model.active_entities
                                      sel = model.selection
                                      faces = sel.grep(Sketchup;;Face)
                                      
                                      model.start_operation('csplit')
                                        faces.each do |face|
                                          vertices = face.vertices
                                          edges = face.edges
                                          bbox = face.bounds
                                          cpoint = bbox.center
                                      
                                         edges.each do |e|
                                            e1 = e.start.position
                                            e2 = e.end.position      
                                      
                                            x = (e2.x + e1.x) / 2
                                            y = (e2.y + e1.y) / 2 
                                            z = (e2.z + e1.z) / 2
                                      
                                            vertices.each do |vertex|
                                              p1 = [x, y, z]
                                              p2 = vertex
                                              line = ents.add_line p1,p2
                                            end
                                          end    
                                        end
                                        sel.clear
                                      model.commit_operation
                                      

                                      Note: I also find strange that new edges don't intersect with each othere making a new vertex...why is this?

                                      [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                                      1 Reply Last reply
                                      Reply Quote 0
                                      • renderizaR
                                        renderiza
                                        last edited by

                                        If the second time you apply script you do each face individually inside a group, then you get very pretty geometry. πŸ˜›

                                        http://s15.postimg.org/3zyfm7ayz/pp1.jpg

                                        [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                                        1 Reply Last reply
                                        Reply Quote 0
                                        • JQLJ
                                          JQL
                                          last edited by

                                          Renderiza,

                                          That's not success, that's brilliance!

                                          I'll start designing tiles right away...

                                          Thanks!

                                          JQL

                                          www.casca.pt
                                          Visit us on facebook!

                                          1 Reply Last reply
                                          Reply Quote 0
                                          • renderizaR
                                            renderiza
                                            last edited by

                                            Wish you success or better yet brilliance in your designs! πŸ’š

                                            [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                                            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
                                            • 1
                                            • 2
                                            • 3
                                            • 3 / 3
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement