sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    UI exit ruby?

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 624 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.
    • artmusicstudioA Offline
      artmusicstudio
      last edited by

      hi,
      is there a function in the UI, where i could

      stop the ruby at this point and exit,

      to check the actual state of elements in sketchup directly?

      thanx
      stan

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        I use a manual combo...

        E.G.
        puts 999
        or
        p 999
        at a given point in the code will tell me it has got to that point successfully.

        A UI.messagebox('!') pauses the script while it's open - I'd use that to check if a temporary file was made etc... Used after a Sketchup.active_model.active_view.refresh call it will let me see what geometry has been made thus far...

        If I am in a 'loop' [ for or {} block] I can include a next to skip the current item being processed and then do the next one, or break to exit the loop altogether. I might use an extended UI.messagebox with OK|Cancel and use next| break on a 'Cancel' ?

        If I want just to exit a method's execution I include a return in the loop-test, OR simply at some point in the main code, so that everything after it remains unprocessed...

        TIG

        1 Reply Last reply Reply Quote 0
        • tt_suT Offline
          tt_su
          last edited by

          Yes you can - at least with SU2014 and above (M1 for OSX). You grab your favorite Ruby IDE and start SketchUp in debug mode. You can then set breakpoint in the IDE which will halt SketchUp and you can inspect the Ruby variables in the call stack. It does away with "puts-debugging" so you don't have to modify your source code and restart SketchUp any more to inspect the data.

          Link Preview Image
          GitHub - SketchUp/sketchup-ruby-debugger: Ruby API debugger for SketchUp 2014 and later.

          Ruby API debugger for SketchUp 2014 and later. Contribute to SketchUp/sketchup-ruby-debugger development by creating an account on GitHub.

          favicon

          GitHub (github.com)

          You cannot however halt execution and then interact with the viewport - if that was what you wanted.

          1 Reply Last reply Reply Quote 0
          • artmusicstudioA Offline
            artmusicstudio
            last edited by

            hi and thanx to both,
            @ tig: yes, i also use puts-tags to follow the code in the console , whit line-number-output to see, in which code -line the puts is.
            i will try out all the break, next etc. functions. thanx for this?

            and @tt_su

            yes, interaction with the viewport was exactly, what i hoped for, so i could inspect the geometry at any stage ot the running code. (break - inspect geometry - go on....). the rest is still tooooo 'high' for me, although i already 'speak' a bit ruby...-:)

            stan

            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