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

    Mathematics related problem

    Scheduled Pinned Locked Moved Developers' Forum
    23 Posts 4 Posters 2.2k Views 4 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
      meeta
      last edited by

      yes i can see what you mean.. this is confusing for me.. I will do some experiments and figure it out! thank you fellows πŸ˜„

      Meet A

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

        All you need to do is not pass on the default value as a Length class. Use Float, Integer or String.

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

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

          Perhaps I am just a raw beginner myself but it appears that in his original snippet meeta is setting @M = bending.

          Shouldn't that be @M = result?

          Inputbox does not alter the input default value that I can see.
          therefore bending will still be 0.0 after the input.

          Resistance is .... Character Forming. Grin

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

            @gruff said:

            Perhaps I am just a raw beginner myself but it appears that in his original snippet meeta is setting @M = bending.
            Shouldn't that be @M = result?

            yes your absolutely true.. i corrected that in my code and yet its showing the same results.. and besides if it were to be 0 then @M / 'anything ' = NaN? there is some problem there.. but I got a newer problem after sorting that out.. this is more interesting i reckon.. please have a look at this

            @b = 300
                  @h = 280
                  weight =((25.0*@b*@h) / 10**6)
                  prompts = ["Variable Load(kN/m) ", "Permanent Load(kN/m) ", "Max Moment known(Nmm)"]
                  loads = [0.0, 0.0, 0.0] #At this point enter 21, 50.1 and 0
                  results = inputbox prompts, loads, "Loads apart from Self-weight/ Or if moment is known, Please enter"
                  variable_load, permanent_load, moment = results
            		
            		if (moment != 0) 
            			@M = moment
            		else
            			uls = (1.35*variable_load + 1.5*permanent_load + 1.5*weight)*@length
            			UI.messagebox(@M)
            			UI.messagebox(weight)
            			UI.messagebox(results)
            			@M = 0.11*uls*@length 
            			@shear = 0.60 * uls 
            			UI.messagebox(uls)
            			UI.messagebox(@M)
            		end
            	
            

            I don't know why, the weight that it should be showing is 2.1, but its showing 0.0032 something at the very beginning of the code.. its really taking a toll on me now! I know that many UI boxes is absolutely silly but that's my way of debugging because I know no other way! pls recommend any other method for debugging!

            Meet A

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

              @meeta said:

              I know that many UI boxes is absolutely silly but that's my way of debugging because I know no other way! pls recommend any other method for debugging!

              Output the values to the Ruby Console, use the puts method. puts "Hello World"

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

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

                @thomthom said:

                @meeta said:

                I know that many UI boxes is absolutely silly but that's my way of debugging because I know no other way! pls recommend any other method for debugging!

                Output the values to the Ruby Console, use the puts method. puts "Hello World"

                yes i tried doing that,, but strangely the answer in ruby is always right but not in sketchup! so i figured something must be wrong in the code or in sketchup! hopefully its my code because that'll be easier to fix

                Meet A

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

                  @meeta said:

                  yes i tried doing that,, but strangely the answer in ruby is always right but not in sketchup! so i figured something must be wrong in the code or in sketchup! hopefully its my code because that'll be easier to fix

                  ??
                  You are aware of the Ruby Console window in Sketchup, right? That's the one I'm referring to. That will let you see the values you get from the script running in SU's Ruby.

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

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

                    @thomthom said:

                    You are aware of the Ruby Console window in Sketchup, right? That's the one I'm referring to. That will let you see the values you get from the script running in SU's Ruby.

                    oh you mean that ruby console,, i thought you were talking of the interactive ruby console.. sorry about them.. let me try it out now!

                    Meet A

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

                      There are people that have worked out how to hook up debuggers to SU's ruby. But I've so far managed by using the Sketchup Ruby Console to output data throughout the script when I need to debug errors and abnormalities. It's the Sketchup Ruby Console that most people here on this forum will be referring to when they mention the Console.

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

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

                        ohh really? thanks i am newb with sketchup programming have been using sketchup for a few years though.. anyways now i wont look like a fool if anyone says console and i think of the irb! thanks

                        Meet A

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

                          For most people here, the Sketchup Ruby Console is the debugging tool. Some are also using Jim's custom console which has some extended features.

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

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

                            FYI, I'd never used Ruby before I started making plugins for SU. And I only recently installed a normal Ruby installation on my computer - never touched a full Ruby installation before.

                            So there's no wonder we're getting confused here. πŸ˜„

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

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

                              haha i see what you mean.. i ought to not touch the irb as well! i just downloaded and installed jim's web console.. its really good.. i dinno i could write and test the code in sketchup! i used to restart and edit it in msft notepad! not anymore.. always love increasing productivity : πŸ’š

                              Meet A

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

                                I write in Notepad++ and use the regular Console to debug. Reload the changes by typing load "rubyfile.rb" into the Console. Crude - but it works. Though there are cases where I really wish I could step through 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
                                • M Offline
                                  meeta
                                  last edited by

                                  ahh notepad++ old friend.. i used to do my c++ programming on it and then take it to university to test it! haha
                                  i think i am gonna take the night off and start over with this tomorrow might crack something.. πŸ˜„ good night world!

                                  Meet A

                                  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