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

    To_1 conversion method

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 207 Views 3 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.
    • H Offline
      hlogoma
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        I'm not sure why its not working. Could you post some more of the code?

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          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

          Hi

          1 Reply Last reply Reply Quote 0
          • H Offline
            hlogoma
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              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

              Lately you've been tan, suspicious for the winter.
              All my Plugins I've written

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                Good catch!

                Hi

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement