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

    [Plugin] CenterPointAll.rb

    Scheduled Pinned Locked Moved Plugins
    34 Posts 18 Posters 40.8k Views 18 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.
    • TIGT Offline
      TIG Moderator
      last edited by TIG

      Here's an updated version that adds a centerpoint to anything that's selected - Group, ComponentInstance, Line, Circle, Face etc.

      [flash=600,338:1sj5banh]http://www.youtube.com/v/OIyHjakdhS0[/flash:1sj5banh]

      Select / filter what you want c'pointing first and then run the script. Centerpoints are added at every bounding box center. It 'undoes' in one go...PayPalButton


      CenterPointAll.rb

      TIG

      1 Reply Last reply Reply Quote 0
      • W Offline
        watkins
        last edited by

        Dear TIG,

        Your script uses the same name as Todd Burch's script, centerpoint.rb.

        favicon

        (www.smustard.com)

        An alternative name might be cPointEntity.rb to indicate that you select the entity or entities first (line, surface etc) before running the script.

        Regards,
        Bob

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

          @watkins said:

          Dear TIG,

          Your script uses the same name as Todd Burch's script, centerpoint.rb.

          favicon

          (www.smustard.com)

          An alternative name might be cPointEntity.rb to indicate that you select the entity or entities first (line, surface etc) before running the script.

          Regards,
          Bob

          I've renamed it "CenterPointAll.rb" (see earlier post...)

          TIG

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

            Hi TIG,

            Thanks for taking the time to create this script for me.
            I will try it out today.

            The name "CentrePointAll" describes exactly what is required.

            Thanks again.

            Mr S

            1 Reply Last reply Reply Quote 0
            • jujuJ Offline
              juju
              last edited by

              Sweet, thanks TIG. I'm shooting from the hip here but can someone create an icon for it so it can be placed on a toolbar? I'm using (I think) Jim's centrepoint ruby and icon as a reference.

              Save the Earth, it's the only planet with chocolate.

              1 Reply Last reply Reply Quote 0
              • david_hD Offline
                david_h
                last edited by

                Here's a problem I have. . ..If you create an ARC with the traditional Arc tool you can righ-clk on it and use the ARC CENTERPOINT rb to find the CENTER RADIUS Point of the arc. Very useful. I like that. BUT. . .and Here's the big BUT my friends . . .if you make an arc by stitching segments together via the WELD.rb and try to find the center point--you dont get teh option of using "Arc Centeroint" ruby, so I tried using the Centerpoint Rb. only finds the centroid of an implied closed figure as it were rather than the desired Radius point. Any insight you gurus could give on this would be greatly appreciated.
                Thx,

                Dlcenterpoint 1.jpgcenterpoint 2.jpg

                If I make it look easy...It is probably easy

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

                  If you weld lines into a curve there's no guarantee that that 'curve' will have a 'centre' at all (draw some connected lines and weld them into a curve - where's its centre ?). So, if you have an exploded arc don't weld it back into a curve (an arc is a curve but a curve isn't an arc): just redraw the arc and then it WILL have a centre...

                  The following are different animals...
                  CenterPoint marks the 'centre of gravity' of the selection.
                  My CenterPointAll marks the centres of all selected objects individually.

                  .

                  TIG

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

                    Hi David,

                    the API supports getting the center of an ArcCurve object. Once a curve is exploded, it no longer has a center (according to the API.)

                    What I typically do is create a new 2-segment arc over 2 of the existing segments - in essence tracing over 2 of the existing segments. Then you can use Arc Centerpoint on that arc.

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • david_hD Offline
                      david_h
                      last edited by

                      @tig said:

                      If you weld lines into a curve there's no guarantee that that 'curve' will have a 'centre' at all (draw some connected lines and weld them into a curve - where's its centre ?). So, if you have an exploded arc don't weld it back into a curve (an arc is a curve but a curve isn't an arc): just redraw the arc and then it WILL have a centre...
                      The following are different animals...CenterPoint marks the 'centre of gravity' of the selection.
                      My CenterPointAll marks the centres of all selected objects individually.

                      .

                      Understood, hence the question. However this CenterpointALL sounds intriguing. WHere does one find this?

                      thx

                      If I make it look easy...It is probably easy

                      1 Reply Last reply Reply Quote 0
                      • david_hD Offline
                        david_h
                        last edited by

                        I got the Centerpointall.rb. It's a good one , but not exactly doing what I need. It enabled me to do a workaround for my specific case, but I guess what is needed is a script that will find the Radius point of an arc even if SU doesn't recognize it as an arc per se.

                        If I make it look easy...It is probably easy

                        1 Reply Last reply Reply Quote 0
                        • plot-parisP Offline
                          plot-paris
                          last edited by

                          so basically you need a "geometric shape recognizer".

                          that would be a wonderful thing, by the way. imagine you have a complicated curved form consisting of loads of small lines and SketchUp simplifies it into (for example) three curves.

                          the plugin could have some correction-freedom settings too. for example if it recognizes two arcs in a shape which connecting bits are almost tangential, SU could correct the position of the connectin point slightly to match a perfect tangent...

                          that would be awesome! πŸ˜•

                          Y 1 Reply Last reply Reply Quote 0
                          • david_hD Offline
                            david_h
                            last edited by

                            Oui! C'est Ca! Where are these RUBY GURUS when you need them? (jk) 😳

                            Im sure they don't have anything else to do but respond to my whining. πŸ˜„

                            If I make it look easy...It is probably easy

                            1 Reply Last reply Reply Quote 0
                            • JClementsJ Offline
                              JClements
                              last edited by

                              When I have time, I often draw over "apparent" arcs and circles because I can then use Entity Info to verify radii of piping and to facilitate the extrusion of smoothed-surfaces and improve exporting .SKP's to other formats.

                              I think the bottom line is you'd need a basic script (using the model context or selection) to find series of contiguous segments, then analyze them to determine if they have the characteristics of an arc.

                              For instance: are all segments of equal length and are all of their common angles equal (there may be more conditions that I haven't thought of)? If all segments touch one another, then are they a polygon or a circle?

                              If such a script can be developed, then it could be used as a common routine called by other scripts such as pipe-along-path or used on intersected geometry. Once the script qualifies the segments, it could then automatically redraw them, make centerpoint guides, etc.

                              John | Illustrator | Beaverton, Oregon

                              1 Reply Last reply Reply Quote 0
                              • david_hD Offline
                                david_h
                                last edited by

                                Yeah. . .what he just said. .. uh Huh. I think

                                Anyway. .. I just want to find the Radius point of any curve be it arc or no. anything else, above that . . ..Gravy.

                                If I make it look easy...It is probably easy

                                1 Reply Last reply Reply Quote 0
                                • plot-parisP Offline
                                  plot-paris
                                  last edited by

                                  JClements, that would be a damn handy tool and a wonderful addition to the weld-script...

                                  1 Reply Last reply Reply Quote 0
                                  • W Offline
                                    watkins
                                    last edited by

                                    Dear David_H

                                    You can use the protractor to find the centre of an arc or circle. Snap the tool to the mid-point of a segment and then click on the end of that segment (you have a choice of two points). Rotate the protractor 90 degrees to create a construction line along the segment's normal (located at mid-point). Repeat for a second segment. The centre point is marked by the crossing of the construction lines.

                                    A ruby script might work in the same way.

                                    Activate the tool, and moving either clockwise or anticlockwise (but not both):

                                    Click first end point, segment 1
                                    Click second end point, segment 1
                                    Click third end point, segment 2
                                    Click fourth end point of segment 2
                                    Ruby computes equations of normals at mid-points of segments 1 and 2
                                    Ruby computes coincident point to yield x,y,z value of centre point

                                    Variations:

                                    Segments 1 and 2 are start and end segments of arc = redraw arc (input = number of segments)
                                    Segments 1 and 2 are connected = redraw circle (input = number of segments)

                                    I am not a script writer, but the above would seem do-able.

                                    1 Reply Last reply Reply Quote 0
                                    • david_hD Offline
                                      david_h
                                      last edited by

                                      Watkins. Yeah, I had been doing that. I was just hoping for a one-click solution. Cuz I ain't no Ruby Writer Neither. . .sigh! πŸ˜’ But thanks for the input.

                                      If I make it look easy...It is probably easy

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

                                        @unknownuser said:

                                        Watkins. Yeah, I had been doing that. I was just hoping for a one-click solution. Cuz I ain't no Ruby Writer Neither. . .sigh! πŸ˜’ But thanks for the input.

                                        Dave,

                                        You might have more luck if you start a new request thread in the Ruby forum.

                                        Hi

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

                                          Thanks.. Now more easier to make center point

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

                                            Does this video have sound? It's coming out silent on my PC.

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

                                            Advertisement