• Login
sketchucation logo sketchucation
  • Login
๐Ÿค‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Looking for a script

Scheduled Pinned Locked Moved Plugins
9 Posts 4 Posters 774 Views
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.
  • P Offline
    Panga
    last edited by 11 Feb 2010, 09:32

    Hi all,

    I'm looking for a script able to insert a component at each vertex of all objects in selection...I'm pretty sure that this script exists, but did not success to find it, don't remember the name.

    Thanks in advance !!

    Regards.
    Panga.

    1 Reply Last reply Reply Quote 0
    • N Offline
      numbthumb
      last edited by 11 Feb 2010, 11:17

      Hm... Component Spray 1.3 has the option to drop component at each vertex of selected faces.

      Comfortably numb...

      1 Reply Last reply Reply Quote 0
      • P Offline
        Panga
        last edited by 11 Feb 2010, 11:21

        Thanks for the answer, but I have also edges in my selection...I have a script that puts a guidepoint at each vertex, but theses are not components...I'm still searching...Any other ideas ?

        1 Reply Last reply Reply Quote 0
        • P Offline
          pilou
          last edited by 11 Feb 2010, 12:45

          Component Stringer can put a component at a vertice

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

          1 Reply Last reply Reply Quote 0
          • T Offline
            TIG Moderator
            last edited by 11 Feb 2010, 12:56

            Try this

            require 'sketchup.rb'
            def placecomponentsatvertices()
              # select a component-instance and some faces/edges
              # the component is placed at each vertex...
              model=Sketchup.active_model
              ents=model.active_entities
              ss=model.selection
              instance=nil
              verts=[]
              ss.each{|e|
                verts<< e.vertices if e.class==Sketchup;;Face or e.class==Sketchup;;Edge
                instance=e if e.class==Sketchup;;ComponentInstance
              }
              if instance and verts[0] 
                defn=instance.definition
                verts.flatten!
                verts.uniq!
                points=[]
                verts.each{|v|points<< v.position}
                points.each{|p|
                  tr=Geom;;Transformation.new(p)
                  ents.add_instance(defn,p)
                }
              else
                UI.messagebox("Select a Component-Instance and some Edges/Faces...")
                return nil
              end#if
            end
            

            Copy the text into a file called placecomponentsatvertices.rb in the ../Plugins/ folder.
            Select a component-instance and some faces/edges...
            Type placecomponentsatvertices + <enter> in the Ruby Console.
            The component is placed at each vertex...
            ๐Ÿค“
            You can add a menu item yourself... ๐Ÿ˜‰

            TIG

            1 Reply Last reply Reply Quote 0
            • P Offline
              pilou
              last edited by 11 Feb 2010, 13:06

              Component sprays by Didier Bur makes that

              @unknownuser said:

              What's new in 1.3.:
              New "shape" option to drop component at each vertex of selected faces.

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

              1 Reply Last reply Reply Quote 0
              • P Offline
                Panga
                last edited by 11 Feb 2010, 14:28

                Component stringer...this is the one I was thinking of !!! Thanks for the info Pilou.

                Thanks a lot for your piece of code Tig, I'm gonna try it ๐Ÿ˜‰

                EDIT : It works like a charm...now I just have to learn how to create the menu item !! Something I always wanted to do this in order to organize all my plugins !! Any clue to acheive this ??? Not a solution, I want to learn how to do this.

                Regards.

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 11 Feb 2010, 14:57

                  if not file_loaded?(__FILE__)
                      titletext="menuTextGoesHere"
                      UI.menu("Plugins").add_item(titletext){defNameGoesHere()}
                      cmd=UI;;Command.new(titletext){defNameGoesHere()}
                      cmd.status_bar_text=titletext+" someInstructionTextGoesHere"
                      ### you could put optional toolbar stuff here using 'cmd'...
                  end
                  file_loaded(__FILE__)
                  

                  This code goes at the end of the file outside of the def...end...
                  Using the __FILE__ method lets you call the ruby anything you like...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    Panga
                    last edited by 11 Feb 2010, 16:19

                    Thanks a lot Tig. I'll give a look tonight at home.

                    Regards.

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

                    Advertisement