ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
question about variables in ruby
by Mahadev Ittina other posts by this author
Nov 5 2009 4:22AM messages near this date
[ANN] RubyStation 0.1.5 (gives you the power of localhost!) | Re: question about variables in ruby
hello folks i am preparing a ruby plugin for sketchup, i hope you can
help me with this really nasty problem i am having

here is the method ,which belongs to a class

  def moment_calc

    weight = 0
    variable_load = 0
    permanent_load = 0
    moment = 0

    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]
    results = inputbox prompts, loads, "Other Loads"
    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
      @M = 0.11*uls*@length
      @shear = 0.60 * uls
    end
  end

my @b = 280 and @h=300 from before.. when i try to multiply the weight
it should come 2.1 but in this case it is 0.0032 or so.. which is
wrong.. hence because of that my uls values are wrong and hence the
entire following program.. i am pretty sure its problem with the
variables.. just cant figure out where!
-- 
Posted via http://www.ruby-forum.com/.
Thread:
Mahadev Ittina
jgabrielygalan
Mahadev Ittina
Mahadev Ittina
Marnen Laibow-Koser
Mahadev Ittina

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved