To_1 conversion method
-
Hi,
I am getting an error code "undefined method `to_1' for 0:Fixnum" when I use this method.
What is the proper format for this conversion method?
Thanks.
-
I'm not sure why its not working. Could you post some more of the code?
Chris
-
It is to be called on a String, rather than a Fixnum.
"100mm".to_l 3.93700787401575
If you want to convert a number, use these: http://code.google.com/apis/sketchup/docs/ourdoc/numeric.html
-
Thanks Jim and Chris,
Essentially the code come from the beginning ruby tutorial 2.
Here is the code that is flagged on entering sketchup.
prompts = ['Push/Pull Distance']
defaults = [0.to_1]
results = UI.inputbox prompts, defaults, 'Distance to Push/Pull'
distance = results[0]
the error seems to object to the defaults = [0.to_1] line.I decided to rewrite default = [0]
What happens now is that as you enter sketchup, the inputbox is activated, prompts for the "Push/Pull distance." Of course you enter it and then it loads the script.
I then open my file that I am working on and goto plugins and select the Multiple_push_pull script and the inputbox is activated again and then once you enter the required distance it works.
Is there a way to stop the inputbox from being called the first time you load sketchup.
I attempted to address the last question by removing the script from plugins directory and yet it still runs every time you startup sketchup even though the script is no longer in the directory.
My apologies for loading this thread with another question but if its not a bother...thanks again.
-
Aha! its a typo. that is .to_1 (TO_ONE). It should be to_l (.TO_L). So change the one with an l and you should be set.
Chris
-
Good catch!
Advertisement