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!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    [req] random polygon division and guide points @ vertices

    Scheduled Pinned Locked Moved Plugins
    12 Posts 6 Posters 1.0k Views 6 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.
    • john2J Offline
      john2
      last edited by

      Is there a plugin that divides my irregularly shaped plane into multiple polygons of random size? Actually I am using the Voronoi plugin and need to speed up things.

      Another requirement, a plugin that places guide points at various vertices selected

      Sketchup Make 2017 (64-bit), Vray 4.0 , Windows 10 – 64 bit, corei7-8750H, 16GB RAM, Nvidia GeForce GTX 1050Ti 4GB

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

        To add guide-points at every selected vertex copy/paste + <enter> this in the Ruby Console.

        m=Sketchup.active_model;a=m.active_entities;s=m.selection;vs=((s.grep(Sketchup;;Edge).collect{|e|e.vertices})+(s.grep(Sketchup;;Face).collect{|e|e.vertices})).flatten.uniq;m.start_operation('x');vs.each{|v|a.add_cpoint(v)};m.commit_operation
        

        It's one step undo-able. It finds vertices from selected edges and/or faces and places a guide-point on each one... Note how it can use a 'vertex' and does not need 'vertex.position' to place the cpoint...

        TIG

        1 Reply Last reply Reply Quote 0
        • john2J Offline
          john2
          last edited by

          @tig said:

          To add guide-points at every selected vertex copy/paste + <enter> this in the Ruby Console.

          m=Sketchup.active_model;a=m.active_entities;s=m.selection;vs=((s.grep(Sketchup;;Edge).collect{|e|e.vertices})+(s.grep(Sketchup;;Face).collect{|e|e.vertices})).flatten.uniq;m.start_operation('x');vs.each{|v|a.add_cpoint(v)};m.commit_operation
          

          It's one step undo-able. It finds vertices from selected edges and/or faces and places a guide-point on each one... Note how it can use a 'vertex' and does not need 'vertex.position' to place the cpoint...

          Is it possible to make a plugin out of this? πŸ˜‰ It is indeed I suppose. ❓ Actually I find ruby console quite technical and programmo-expert sort of thing. So, that's why, Im asking for a plugin for a novice like me.

          Sketchup Make 2017 (64-bit), Vray 4.0 , Windows 10 – 64 bit, corei7-8750H, 16GB RAM, Nvidia GeForce GTX 1050Ti 4GB

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

            It just needs adding to some code:

            require 'sketchup.rb'
            module TIG
            def self.cpoint_vertices()
                m=Sketchup.active_model;a=m.active_entities;s=m.selection;vs=((s.grep(Sketchup;;Edge).collect{|e|e.vertices})+(s.grep(Sketchup;;Face).collect{|e|e.vertices})).flatten.uniq;m.start_operation('x');vs.each{|v|a.add_cpoint(v)};m.commit_operation
            end
            end
            

            Copy paste it into a file named say TIG-cpoint_vertices.rb in the Plugins folder.
            It must be 'UTF8 without BOM' encoded to suit Ruby - you might need Notepad++.exe [free download] to be able to do that on a PC, as the built-in Notepad.exe might not automatically do that encoding...
            When that file loads it makes the command that can be run from the Ruby Console:
            TIG.cpoint_vertices
            I expect you want a menu item too... add this extra code to the above module - just before its final ' end'...

            unless file_loaded?(__FILE__)
              UI.menu('Plugins').add_item('#{self}.cpoint_vertices'){ self.cpoint_vertices() }
            end
            file_loaded(__FILE__)
            

            It then appears in the 'Plugins' menu [retitled 'Extensions' under v2015].
            That allows you to 'shortcut' it...

            TIG

            1 Reply Last reply Reply Quote 0
            • BoxB Offline
              Box
              last edited by

              Works for me with normal notepad.

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

                @box said:

                Works for me with normal notepad.
                I have Notepad++ set for all text editing, so I was unsure.
                I just re-enabled Notepad.exe and checked.
                If you accept its save-default of "ANSI" and then open it in Notepad++ it reports as "UTF8 without BOM" 0 so it's OK !
                Which is interesting... πŸ˜•
                So you can use Notepad.exe to edit/make RB files.
                Just make sure it has the .rb file-type suffix, so that SketchUp recognizes it as a Ruby file as it starts and loads all of the scripts from the Plugins folder... πŸ€“

                I still recommend Notepad++ - it has lots of goodies, like syntax coloring in files like RB... πŸ˜„

                TIG

                1 Reply Last reply Reply Quote 0
                • fredo6F Offline
                  fredo6
                  last edited by

                  @john2 said:

                  Another requirement, a plugin that places guide points at various vertices selected

                  You can use MarVertices which is part of FredoTools.
                  It works on a selection.

                  Fredo

                  1 Reply Last reply Reply Quote 0
                  • fredo6F Offline
                    fredo6
                    last edited by

                    @john2 said:

                    Is there a plugin that divides my irregularly shaped plane into multiple polygons of random size? Actually I am using the Voronoi plugin and need to speed up things.

                    Are you looking for a Voronoi plugin? And what do you mean "Seep up things"?

                    Fredo

                    1 Reply Last reply Reply Quote 0
                    • john2J Offline
                      john2
                      last edited by

                      @fredo6 said:

                      @john2 said:

                      Is there a plugin that divides my irregularly shaped plane into multiple polygons of random size? Actually I am using the Voronoi plugin and need to speed up things.

                      Are you looking for a Voronoi plugin? And what do you mean "Seep up things"?

                      Fredo

                      I am using the voronoi plugin, the latest one. Well, I need polygon division quickly done automatically for a given surface. I have to manually divide it into polygons. "Seep up things?" , I wrote "Speed up things" i.e. to make the process of polygon division faster.

                      Sketchup Make 2017 (64-bit), Vray 4.0 , Windows 10 – 64 bit, corei7-8750H, 16GB RAM, Nvidia GeForce GTX 1050Ti 4GB

                      1 Reply Last reply Reply Quote 0
                      • Rich O BrienR Online
                        Rich O Brien Moderator
                        last edited by

                        Looks like someone is already building a future classic!

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

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

                          And this little thing ?
                          Not exactly totally automatic but funny! β˜€

                          Protrude by Jim Foltz
                          Random Painter by Chris Fullmer

                          radom.jpg

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

                          1 Reply Last reply Reply Quote 0
                          • john2J Offline
                            john2
                            last edited by

                            @rich o brien said:

                            Looks like someone is already building a future classic!

                            superb! πŸ‘ I want to do that stuff exactly. How should I do it?

                            Sketchup Make 2017 (64-bit), Vray 4.0 , Windows 10 – 64 bit, corei7-8750H, 16GB RAM, Nvidia GeForce GTX 1050Ti 4GB

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            Buy SketchPlus
                            Buy SUbD
                            Buy WrapR
                            Buy eBook
                            Buy Modelur
                            Buy Vertex Tools
                            Buy SketchCuisine
                            Buy FormFonts

                            Advertisement