sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    My week-end challenge and DC problems

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    21 Posts 5 Posters 2.9k Views 5 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.
    • DareDevilD Offline
      DareDevil
      last edited by DareDevil

      Following a french thread about moving bridge, I challenge myself to make a DC model of the Rolling Bridge in London :

      http://upload.wikimedia.org/wikipedia/commons/a/ad/CurlingBridgeClip.jpg

      [flash=432,267:22xvxpe5]http://www.youtube.com/v/0aIl0bzyQD0[/flash:22xvxpe5]

      After some hours of work here is a functional test :
      Rolling_04_V7.skp
      And I have a little problem : when the bridge is in the final position (horizontal) the formula calculating the position of each element made a "divide by zero" error.
      Does some one know if there is a function to return "0" instead an error ?

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

        Perhaps something like this for AngleA and also for AngleB ?
        =IF(Course=0, 0, 29.0735587-ACOS((La*La+Course*Course-Lb*Lb)/(2*La*Course)))
        To stop the divide by zero error ??

        TIG

        1 Reply Last reply Reply Quote 0
        • DareDevilD Offline
          DareDevil
          last edited by

          ... don't work 😞
          I tried in a simple model with a
          X=if(Value=0,0,100/Value) onClick : ANIMATESLOW(Value,100,0)
          The component must move from X=1 to X=infinite, but must finish at X=0
          But when the value is 0 there is an error and the component stop where is it.
          I think if there is an error, SU don't interpret nothing 😞


          Divide_Zero.skp

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

            Did you try the whole thing for AngleA and AngleB as I set it out ?
            Perhaps putting ( ) around the second action...

            TIG

            1 Reply Last reply Reply Quote 0
            • DareDevilD Offline
              DareDevil
              last edited by

              Not needed to touch the AngleA and AngleB, the problem is not there because the Course never be 0 ( Course is the total length of each the hydraulic cylinder, not yet draw, and it never be equal to zero 😉 )
              The problem is in the Verin X and Z calculated with the formulas
              X = L*(sin((copy+.5)*A)-sin(A/2))/(2*sin(A/2)) Z = L*(cos(A/2)-cos((copy+.5)*A))/(2*sin(A/2))
              The L is the length of a pieces of the bridge floor and A is the angle between two pieces, so it will be equal to zero when the bridge is in the final position.
              These formulas are equivalent to
              X = L*(cos(A)+cos(2*A)+cos(3*A)+...+cos(n*A)) Z = L*(sin(A)+sin(2*A)+sin(3*A)+...+sin(n*A))
              If there is an other equivalent without a division by sin(a) it will be nice...

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

                How about
                X = IF(sin(A/2)=0, 0, L*(sin((copy+.5)*A)-sin(A/2))/(2*sin(A/2)))
                ???

                TIG

                1 Reply Last reply Reply Quote 0
                • DareDevilD Offline
                  DareDevil
                  last edited by

                  @tig said:

                  How about
                  X = IF(sin(A/2)=0, 0, L*(sin((copy+.5)*A)-sin(A/2))/(2*sin(A/2)))
                  ???

                  No 😞 😞 Always saying there is divided by zero and don't return the zero when A=0 (and so sin(A/2)=0)

                  1 Reply Last reply Reply Quote 0
                  • DareDevilD Offline
                    DareDevil
                    last edited by

                    Finished Rolling_08.skp
                    I haven't solved the divide by zero problem... but it works, and slowly 😕

                    1 Reply Last reply Reply Quote 0
                    • Rich O BrienR Offline
                      Rich O Brien Moderator
                      last edited by

                      You deserve a medal for that! With a day to spare what will you do with your time? 😉

                      Download the free D'oh Book for SketchUp 📖

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

                        Yes, well done!
                        An excellent 'complex DC'.

                        I still can't see why the IF() doesn't work to trap zero-divide issue ?
                        perhaps extra ( ) ???
                        X = IF(**(**sin(A/2)=0**)**, 0, **(**L*(sin((copy+.5)*A)-sin(A/2))/(2*sin(A/2))**)**)

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • DareDevilD Offline
                          DareDevil
                          last edited by

                          @tig said:

                          I still can't see why the IF() doesn't work to trap zero-divide issue ?
                          perhaps extra ( ) ???
                          X = IF(**(**sin(A/2)=0**)**, 0, **(**L*(sin((copy+.5)*A)-sin(A/2))/(2*sin(A/2))**)**)

                          Testing this kind of solution, I think SU want to evaluate any member of the IF before solving it, and if is an error it returns nothing but an error, even the error is in a non needed part of the function 😞

                          But... ❗

                          Reading your post I had a machiavellian idea : two IF in the function, one like you propose, one under the divide
                          X = IF(sin(A/2)=0, 0, L*(sin((copy+.5)*A)-sin(A/2))/**IF(2*sin(A/2)=0, 1, 2*sin(A/2)**)
                          The value for the true second IF can be anything but zero, just to avoid the divide by zero error, and the final result will be zero due to the first IF.

                          It works on the Divide_Zero.skp I sent before when Value = 0
                          X = if(Value=0,0,100/if(Value=0, 1, Value))

                          I will test it soon on the bridge model. It's already slow, and with 2 IF more in each part of the bridge, it can't be faster. But in real, it's slow 😆

                          1 Reply Last reply Reply Quote 0
                          • DareDevilD Offline
                            DareDevil
                            last edited by

                            @unknownuser said:

                            You deserve a medal for that! With a day to spare what will you do with your time? 😉

                            Looking for an other challenge ! 🤣

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

                              OR perhaps go back to where 'A' is set and use something like
                              =IF(A=0, 0.0001, A) then A is never quite 0 ?

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • DareDevilD Offline
                                DareDevil
                                last edited by

                                @tig said:

                                OR perhaps go back to where 'A' is set and use something like
                                =IF(A=0, 0.0001, A) then A is never quite 0 ?

                                Good idea too !! 👍 😛
                                Faster, but the bridge never be horizontal. OK, 0.0001 is quite horizontal... but not 😆 . I'm a man thinking Zero is not quite Zero 😳 😉
                                So two solutions : one simple and faster but cant realy accept all angles, the other more mathematic but slow and made long sentences.

                                Remember me the time I worked as multimedia designer. Me and a friend worked on Flash and for the same job, I made 1 frame and 200 lines of actionscript, and my friend made 1 line of actionscript and 200 frames 😄

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

                                  You'll also probably find that when it looks flat, in reality the bridge is slightly 'arched' [in a shallow 'hump'], because it will deflect under its own weight and the people standing on it, the engineer would want it to 'settle-down' to be no more than 'flat', in a 'worst case'.
                                  So this is then even more complicated, because it means at some point the parts will go from a positive 'arch' to a negative 'curl', passing through 'zero' just after it has started to 'rollup'...
                                  😕

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • DareDevilD Offline
                                    DareDevil
                                    last edited by

                                    @tig said:

                                    You'll also probably find that when it looks flat, in reality the bridge is slightly 'arched' [in a shallow 'hump'], because it will deflect under its own weight and the people standing on it, the engineer would want it to 'settle-down' to be no more than 'flat', in a 'worst case'.
                                    So this is then even more complicated, because it means at some point the parts will go from a positive 'arch' to a negative 'curl', passing through 'zero' just after it has started to 'rollup'...
                                    😕

                                    Yes, I noticed the arc, but not at the end.
                                    If you set the Course value to can se the end of the bridge dive into the pier 😳
                                    In the final position, Course = 109 (or 109.2 to avoid the divide by zero 😉 ) all is quite horizontal in my model.
                                    But in the model quite all is parametric. So if I want to have an arc at the end, just change the Lb value for little greater. This dimension is the size of the arms, that don't change the mesh size but just de calculation, so the axes aren't on the right place, but at the end the bridge is arched.

                                    1 Reply Last reply Reply Quote 0
                                    • DareDevilD Offline
                                      DareDevil
                                      last edited by

                                      Here is a little guide to understand the variables :
                                      02_1.jpg
                                      All the variables don't change the shape of the bridge, only the calculation.
                                      Only Course, La and Lb are variables ; Angles are calculated with them.

                                      1 Reply Last reply Reply Quote 0
                                      • jeff hammondJ Offline
                                        jeff hammond
                                        last edited by

                                        i had a similar problem before..

                                        the way i ended up dealing with it was by adding another attribute.. it wasn't elegant at the time and it still isn't 😄 ..your double if statement seems better but i'll post the method anyway.. (might get the discussion going again to find a better solution than either of these)

                                        for your Divide_Zero.skp, it would look like:

                                        Position
                                        X =if(trap=.12345,0,100/trap)

                                        Custom
                                        trap =if(value=0,.12345,value)
                                        value =(user input)

                                        you'd just have to make sure the trap value (.12345 in this example) is a number that should never come up as input..

                                        not sure but doing it like this might speed things up if you have to enter the double IF statement for all parts of the bridge.. this will result in one IF statement in each part of the bridge plus a single extra IF

                                        dotdotdot

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

                                          @unknownuser said:

                                          Here is a little guide to understand the variables :
                                          [attachment=0:20dsmooa]<!-- ia0 -->02_1.jpg<!-- ia0 -->[/attachment:20dsmooa]
                                          All the variables don't change the shape of the bridge, only the calculation.
                                          Only Course, La and Lb are variables ; Angles are calculated with them.

                                          Instead of checking sin(a) have you considered checking the angle. There are only a few cases( maybe only a=0) that would need checking constrained by your geo. Conversely can't you create a variable say z= sin(a) and do a check on that?? you could even go as far as using a taylor series exapnsion for all if SU has problem with small angles.

                                          1 Reply Last reply Reply Quote 0
                                          • DareDevilD Offline
                                            DareDevil
                                            last edited by

                                            @unknownuser said:

                                            Position
                                            X =if(trap=.12345,0,100/trap)

                                            Custom
                                            trap =if(value=0,.12345,value)
                                            value =(user input)

                                            I like this solution 👍 👍 Simple and economic.
                                            As you say, the only inconvenient is to found an unusable value for the test. In the case of the bridge, no problem? because the angles are limited.
                                            I will test it soon 😉

                                            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