• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

[Request]Define Segment Length Plugin

Scheduled Pinned Locked Moved Plugins
7 Posts 5 Posters 874 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
    Physicsguy1
    last edited by 15 Aug 2009, 03:12

    I am asking for a plugin that can create a polygon with any number of segments, in which you can specify a length for the segments and create the polygon. For example, you could define an endpoint position. Then your tool would move onto the next endpoint, so you could define a position and then create the polygon. I'll post a pic of what I am trying to ask for.

    plugin req.png

    1 Reply Last reply Reply Quote 0
    • M Offline
      MartinRinehart
      last edited by 15 Aug 2009, 15:28

      @unknownuser said:

      I am asking for a plugin that can create a polygon with any number of segments, in which you can specify a length for the segments and create the polygon.

      Not sure I understand. You want something like the Polygon tool but its distance would be the line segment length, not radius?

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      1 Reply Last reply Reply Quote 0
      • P Offline
        Physicsguy1
        last edited by 15 Aug 2009, 21:02

        I think you've got it.

        1 Reply Last reply Reply Quote 0
        • W Offline
          watkins
          last edited by 16 Aug 2009, 07:56

          Dear Physicsguy,

          As a work around, make the polygon a group, edit the group, and then use the tape measure tool to set the length of the segment.

          Regards,
          Bob

          1 Reply Last reply Reply Quote 0
          • D Offline
            Daniel S
            last edited by 16 Aug 2009, 13:12

            Hi Physicsguy
            I had to do the same... here is what I do:
            Create the polygon with the number of segments you want.
            Explode Curve.
            Take all the segments except one and weld them togheter.
            Take the only segment that is not welded and use fredoscale... you can hit the TAB key to define the segment length.

            Define Segment Length.gif
            Hope that helps...

            Daniel S

            1 Reply Last reply Reply Quote 0
            • M Offline
              MartinRinehart
              last edited by 16 Aug 2009, 13:17

              According to:

              Link Preview Image
              Regular polygon - Wikipedia

              favicon

              (en.wikipedia.org)

              the radius "r" of a regular polygon of segment length "s" and number of sides "n" is

              r = s / ( 2 * sin(pi/n) )

              so the segment length, as a function of the radius should be

              s = r * ( 2 * sin(pi/n) )

              So file this little bit somewhere (not your plugins directory) as "radius.rb" and when you want it, in your Ruby Console "load /my/choice/radius.rb". (If you're going to use it often, "r = '/my/choice/radius.rb'" and then "load r".)

              
              # radius.rb
              require 'sketchup.rb'
              
              ns = UI.inputbox ['Number of sides; ', 'Side length; '], ['6', '1'],'Radius Given Side Length'
              
              n = ns[0].to_f
              s = ns[1].to_f
              
              puts s / ( 2 * Math.sin(Math;;PI / n) )
              
              

              I've not used the VCB part of the API yet. Maybe someone who has can pitch in the last step.

              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

              1 Reply Last reply Reply Quote 0
              • T Offline
                TIG Moderator
                last edited by 16 Aug 2009, 20:30

                @watkins said:

                Dear Physicsguy,

                As a work around, make the polygon a group, edit the group, and then use the tape measure tool to set the length of the segment.

                Regards,
                Bob

                Watkins's solution is the straightforward and easiest... Draw polygon, group it, use tapemeasure tool, pick two adjacent vertices, type in require length, hit enter key, accept to scale group, exit group-edit, select group and explode - you have the polygon with the required length of side...

                Alternative structure for a Ruby: drawn a polygon, select and pick 'Set Polygon side length' tool, in dialog enter new 'length'. The tool takes the length of curve.edges[0].length [polygon's edge length] and then applies a scaling transformation to the polygon's curve, about it's center, based on the 'desired length' and actual 'length' ratio...

                TIG

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

                Advertisement