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

    [Plugin] Simple Catenary Curve

    Scheduled Pinned Locked Moved Plugins
    34 Posts 14 Posters 41.7k Views 14 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.
    • R Offline
      remus
      last edited by remus

      A quick little plugin i put together. Its very basic πŸ‘

      Usage: draw->simple catenary curve, then rotate and scale the curve in to place. A small warning is also attached, ive used a method that can some times crash sketchup, although it hasnt done so during my testing.

      If i ever get round to learning how to make proper tools (in the ruby sense) i'll try and make it more point-and-click.

      And if your wondering what a catenary curve is, its the shape an unloaded string/chain/cable/wire will make when suspended between 2 points. e.g. power cables, washing lines etc. http://en.wikipedia.org/wiki/Catenary_curve


      simple_cat_curve.rb

      http://remusrendering.wordpress.com/

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

        Hey Remus:

        Next step is "chain maker" or "rope maker"..πŸ˜„

        User inputs parameters of a link or the name of an Link component and the links are strung properly on a series of connected Catenary curves.

        John | Illustrator | Beaverton, Oregon

        1 Reply Last reply Reply Quote 0
        • K Offline
          Khai
          last edited by

          thank you πŸ˜„
          this is going to be very very useful..

          1 Reply Last reply Reply Quote 0
          • mitcorbM Offline
            mitcorb
            last edited by

            Yes, I'd vote for JClements idea. It would certainly keep the file small.

            I take the slow, deliberate approach in my aimless wandering.

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              Ah. I was wondering when we'd see this plugin. I'm curious to look at the code. πŸ‘

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

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

                its really nothing special thom. i was initially going for the whole point and click thing but i kept getting confused πŸ˜‰

                http://remusrendering.wordpress.com/

                1 Reply Last reply Reply Quote 0
                • GaieusG Offline
                  Gaieus
                  last edited by

                  And as for how to quickly model a catenary in SU, see this model in the Warehouse:
                  http://sketchup.google.com/3dwarehouse/details?mid=4dd6375bd3e37bc7f30a9640f41eb5ed&prevstart=0

                  (but of course, this is not to lessen this cool plugin, Remus πŸ˜‰ )

                  Gai...

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

                    Fairly sure thats a parabola, not a catenary curve.

                    http://remusrendering.wordpress.com/

                    1 Reply Last reply Reply Quote 0
                    • GaieusG Offline
                      Gaieus
                      last edited by

                      Is it really?

                      Hm... I last studied maths more than 26 years ago. 😳
                      Anyway, I can model parabolas then!
                      Thanks! πŸ‘

                      Gai...

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

                        Doubled checked on wikipedia and it seems it is a parabola. Part of the conic sections if you fancy investigating further.

                        http://remusrendering.wordpress.com/

                        1 Reply Last reply Reply Quote 0
                        • K Offline
                          kwistenbiebel
                          last edited by

                          Hi remus, that's a wonderful idea.(Didn't know the term Catenary though).
                          By the way, could multiple Catenary curves define a tensile structure?

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

                            You probably could, but i dont think it would be physically accurate. Catenary curves only describe lines with no forces (other than gravity) acting along their length.

                            I know that in simple cases like a suspension bridge the curve is a parabola, but i dont know if this would still be true for more complicated tensile structures.

                            http://remusrendering.wordpress.com/

                            1 Reply Last reply Reply Quote 0
                            • GaieusG Offline
                              Gaieus
                              last edited by

                              @remus said:

                              Doubled checked on wikipedia and it seems it is a parabola. Part of the conic sections if you fancy investigating further.

                              I believe you, Remus, truely. πŸ˜‰

                              Gai...

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

                                I just though other people might be interested (although i realise maths geeks are probably in short supply around here πŸ˜› )

                                http://remusrendering.wordpress.com/

                                1 Reply Last reply Reply Quote 0
                                • thomthomT Offline
                                  thomthom
                                  last edited by

                                  I'm no math geek - but that cursed curve had me stumped when I wanted to make a chain/rope plugins.

                                  I've still not looked at the code, but can it be used to specify two 3D points and the total length of the curve?

                                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                  List of my plugins and link to the CookieWare fund

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

                                    2 3d points is fairly easy as long as the 2 points are level, if not you have to start messing around with numerical solutions and it all gets rather messy.

                                    Its similarly difficult to specify a length if i remember correctly.

                                    http://remusrendering.wordpress.com/

                                    1 Reply Last reply Reply Quote 0
                                    • thomthomT Offline
                                      thomthom
                                      last edited by

                                      Yea, that's what I tried. Different heights.
                                      And also specifying length. Only solution to the length I could find was a method that did loop of approximation until it came within a given tolerance...

                                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                      List of my plugins and link to the CookieWare fund

                                      1 Reply Last reply Reply Quote 0
                                      • fredo6F Offline
                                        fredo6
                                        last edited by

                                        Remus,

                                        I am glad you show the way to Users to get their ownautomation via Ruby. Obviously, Sketchup needs to be complemneted by some generic Rubies that does geometrical operations that SU does not do in native.

                                        But Ruby is also a very convenient way for individual users to speed up their workflow with some adhoc, simple programming. It's a little bit like Excel macros. They are meant for users to help with a few lines of code. But of course, some specialists could also write complete applications with thousands of lines of VB Scripts for Excel and share them to a community of users.

                                        Your program is 10 lines of code and does the work of creating a catenary curve. For the purpose of what it does for an individual user, it is very concise and elegantly written. Ruby is not very complex for simple things and you demonstrate it in your script.

                                        Now, yes, for writing a general plugin drawing any catenary curve in 3D between 2 points, with options, live feeback and postedition, the script would have to go one level beyond, and may not be an easy task for an occasional programmer (but do not worry, there is also a strong community of script writers!).

                                        So, I can only send you my support for showing what Ruby can do with a few lines of code, to automate repetitive tasks or make simple calculations.

                                        Fredo

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          tomot
                                          last edited by

                                          @remus said:

                                          I just though other people might be interested (although i realise maths geeks are probably in short supply around here πŸ˜› )

                                          count me in the math geek column!
                                          great little program, Ive been using it to learn more about Ruby.

                                          =begin
                                          Simple Catenary Curve script
                                          
                                          Author; Remus Knowles
                                          =end
                                          
                                          module RTK
                                          
                                          def self.simple_cat_curve
                                          
                                          ents = Sketchup.active_model.active_entities
                                          pts = []
                                          # add or delete interval to be evaluated 
                                          intervals = [-3,-2.75,-2.5,-2.25,-2,-1.75,-1.5,-1.25,-1,-0.75,-0.5,-0.25,0,0.25,0.5,0.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75,3]
                                          
                                          intervals.each{|e|
                                          # main math formula, try x = (Math.sinh(e)), or (Math.sin(e))
                                          x = (Math.cosh(e))
                                          
                                          # pts.push([e,20,x]) entering 20 moves the curve  along green axis  20 units 
                                          # pts.push([e,x,0])  draws the curve in plan view 
                                          # pts.push([x,0,e,]) draws the curve in elevation view
                                          
                                           
                                          pts.push([x,10,e]) 
                                          pts.push([x,0,e,])
                                          pts.push([x,-10,e]) 
                                          }
                                          
                                          cat_curve = ents.add_curve(pts)
                                          
                                          cat_curve_grp = ents.add_group(cat_curve)
                                          
                                          end#method
                                          
                                          end#module
                                          
                                          UI.menu("Draw").add_item("Simple Catenary Curve") {RTK.simple_cat_curve}
                                          
                                          

                                          my attached code documents some of the things I have tried


                                          curve.png

                                          [my plugins](http://thingsvirtual.blogspot.ca/)
                                          tomot

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

                                            Fred, thanks, it means a lot coming from someone of your experience.

                                            Tomot, good effort on the mods, best way to start learning ruby in my opinion.

                                            http://remusrendering.wordpress.com/

                                            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