• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

[req] random polygon division and guide points @ vertices

Scheduled Pinned Locked Moved Plugins
12 Posts 6 Posters 906 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.
  • J Offline
    john2
    last edited by 26 Nov 2014, 14:57

    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
    • T Offline
      TIG Moderator
      last edited by 26 Nov 2014, 15:21

      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
      • J Offline
        john2
        last edited by 26 Nov 2014, 17:48

        @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
        • T Offline
          TIG Moderator
          last edited by 26 Nov 2014, 17:59

          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
          • B Offline
            Box
            last edited by 26 Nov 2014, 19:19

            Works for me with normal notepad.

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 26 Nov 2014, 19:37

              @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
              • F Offline
                fredo6
                last edited by 27 Nov 2014, 06:07

                @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
                • F Offline
                  fredo6
                  last edited by 27 Nov 2014, 06:08

                  @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
                  • J Offline
                    john2
                    last edited by 27 Nov 2014, 14:01

                    @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 Offline
                      Rich O Brien Moderator
                      last edited by 27 Nov 2014, 14:07

                      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 27 Nov 2014, 15:57

                        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
                        • J Offline
                          john2
                          last edited by 28 Nov 2014, 11:31

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

                          Advertisement