On Thu, Nov 5, 2009 at 1:18 PM, Mahadev Ittina <mittina / gmail.com> wrote: > 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 > > ¨Âåæ íïíåîôßãáì> > ¨Âåéçè> ¨Âáòéáâìåßìïáä > ¨Âåòíáîåîôßìïá> ¨Âïíåî> > ¨Âåéç轨¨²µ®°ªÀâªÀè© ±°ªª¶© > ¨Âòïíðôó Û¢Öáòéáâìå Ìïáä¨ëÎ¯í© ¢¬ ¢Ðåòíáîåîô Ìïáä¨ëÎ¯í© ¢¬ ¢Íáø > Moment known(Nmm)"] > ¨Âïáäó Û°®°°®°¬ °®°Ý > ¨Âåóõìôó éîðõôâïø ðòïíðôó¬ ìïáäó¬ ¢Ïôèåò Ìïáäó¢ > ¨Âáòéáâìåßìïáäðåòíáîåîôßìïáäíïíåîô òåóõìô> > ¨Â¨íïíå °© > ¨Âíïíåîô > ¨Âìó> ¨Âìó ¨±®³µªöáòéáâìåßìïá±®µªðåòíáîåîôßìïáä > 1.5*weight)*@length > ¨Â°®±±ªõìóªÀìåîçôè > ¨Âóèåá°®¶° õì> ¨Âîä > ¨Âîä > > 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! irb(main):001:0> @b = 280 => 280 irb(main):002:0> @h = 300 => 300 irb(main):003:0> weight =((25.0*@b*@h) / 10**6) => 2.1 This calculation is correct: 2.1, so if you are getting a different result it has to be that @b or @h don't contain what you think they do. Can you try to print @b, @h and weight, and show us the calling code that produces weight being 0.00032? def moment_calc puts "@b is #{@b}" puts "@h is #{@h}" weight =((25.0*@b*@h) / 10**6) puts "weight is #{weight}" end If you put this in your program, what happens? Also, you don't need this: > weight = 0 > variable_load = 0 > permanent_load = 0 > moment = 0 in Ruby you don't need to declare your variables before assigning (another value) to them. So assigning them a 0 only to assign them another value afterwards is not needed. Jesus.