sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Set centre point on multiple objects?

    Scheduled Pinned Locked Moved Developers' Forum
    13 Posts 6 Posters 1.8k 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.
    • M Offline
      Mr S
      last edited by

      Hi,

      I have done this before but have now forgot how I did it!

      I have multiple objects selected and I wish to place a centre point on all of them.
      At the moment I can only create one centre point in the middle of them all.
      As you can see from the atttached image I am using a ruby script called 'centrepoint'.
      I'm pretty sure that is what I used last time but maybe it was just a similar ruby script?

      I am trying to follow through a guide created by 'Howard Leslie' who kindly helped me with this previously. I have attached this also, so you can see better what I am trying to do.

      Thanks.
      Mr S


      SetCentrePoint.jpg


      SvySymbol_2_Surface_V2.skp

      1 Reply Last reply Reply Quote 0
      • G Offline
        GreyHead
        last edited by

        I don't think that's my guide - or my memory is worse that I think it is . . . I can't see how to get all the centerpoints at one go. Maybe someone could extend a script to do this?

        Bob

        1 Reply Last reply Reply Quote 0
        • M Offline
          Mr S
          last edited by

          Hi Bob,

          Sorry, about that.
          You also helped out with this problem but it was actually Howard Leslie who provided the tutorial. I have edited my original post.

          Mr S.

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            Not a fully-fleshed out plugin, but you can type (or copy & paste) this into the Ruby Console, one line at a time.

            
            # Select entities first
            UI.menu("Plugins).add_item("Group Centerpoint") {
            m = Sketchup.active_model; e = m.active_entities; s = m.selection
            groups = s.find_all {|g| g.typename == "Group"}
            groups.each {|g| e.add_cpoint(g.bounds.center)}
            }
            
            
            

            Hi

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by

              Here's a quick menu for it. Drop it in Plugins and restart.


              grp_cp.rb

              Hi

              1 Reply Last reply Reply Quote 0
              • M Offline
                Mr S
                last edited by

                Hi Jim,

                Thanks for trying to help, but...
                I ran each command one at a time in the Ruby command console but nothing seemed to happen.
                This will be user error, I know!

                This is really frustrating because I have done this in the past using the guide shown.
                I know I was able to create centre points on hundreds of multiple objects using a Ruby plugin. Just wish I could remember how I did it.

                Here is the original link for the "Howard Leslie" guide: http://www.sketchucation.com/forums/scf/viewtopic.php?f=22&t=4276

                Regards
                Mr S

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Mr S
                  last edited by

                  Hi Jim,

                  Sorry, but after adding the plugin I received this error on restarting SketchUp.
                  See attached

                  Mr S


                  error.jpg

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Matt666
                    last edited by

                    Quote missing...


                    grp_cp.rb

                    Frenglish at its best !
                    My scripts

                    1 Reply Last reply Reply Quote 0
                    • Dave RD Offline
                      Dave R
                      last edited by

                      I'm probably sticking my nose in where it doesn't belong but what if you made the symbols instances of the same component using ApplyTo.rb? Then, while editing one of them, you could add the guidepoint to all of them. Explode them to separate the geometry from the guidepoints. Use the Selection filters to select the geometry leaving the the guidepoints. The selected geometry could then be hidden.

                      Just an idea.

                      Etaoin Shrdlu

                      %

                      (THERE'S NO PLACE LIKE)

                      G28 X0.0 Y0.0 Z0.0

                      M30

                      %

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        Mr S
                        last edited by

                        Hi Jim,

                        Yipee!!

                        You are another Ruby genius who has helped me out.
                        Thanks very much for taking the time to help me out.

                        (Still wish I could remember how I did it originally!)

                        Regards
                        Mr S

                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          Mr S
                          last edited by

                          Hi Jim,

                          Perhaps my "Yipee" was premature!

                          I have attached 2 SketchUp files.

                          One is from the original Site Survey guide. Your script works on this.
                          The second one is a section of the file I am currently working on. your script doesn't seem to work.

                          For the life of me I can't see any obvious reason why this would happen.
                          Can you figure it out?

                          Regards
                          Mr S


                          Works.skp


                          Doesn't_Work.skp

                          1 Reply Last reply Reply Quote 0
                          • H Offline
                            Howard leslie
                            last edited by

                            Mr S,
                            Jim's Script appears to work on Groups only - you have Components - thats probably why it doesn't work with your data.
                            ...
                            A few possible solutions;

                            1. Is your original data in a Spreadsheet or Text File ???
                              I think Didier has a script to import this data directly.
                              Very useful for large numbers of points.

                            2. Get Jim to adjust his script to work on Components also.

                            3. TIG has a useful script - AddVertex+
                              Ask TIG to adjust his script to give you an option to add a Vertex at the Intersections only (on a large selection set) - and have the ability to mine down into Components and Groups (something he has added to numerous scripts he's written).
                              ...
                              Regards
                              Howard L'

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              Jim
                              last edited by

                              Yeah, the script was a quickie I did before work this morning. I was originally just going to make a copy & paste one-liner for the Ruby Console, but putting it in a menu was easy enough. I just used Groups because that is all that the first example model had.

                              Update: TIG has updated this script to work on Groups and Componenets. See the following link:

                              301 Moved Permanently

                              favicon

                              (www.sketchucation.com)

                              Hi

                              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