sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    Help needed with Sketchup.exe -RubyStartup

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

      Hello everyone and happy new year!

      I'm trying to launch a new instance of SketchUp and have it open a plugin at start up... this what works to launch SketchUp but it doesn't run the file. Any ideas what I'm doing wrong?

      For now the file is just printing a line to the ruby console.

      path=File.join(__dir__, "test.rb")
      
      system('start "New SketchUp Window" "C:/Program Files/Sketchup/Sketchup 2019/SketchUp.exe" "-RubyStartup path"')
      

      Frank

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

        At startup SketchUp 'always' loads all .RB files that it finds in your user's Plugins folder.
        So simply having your Ruby code in a .RB file in that folder should load it, and also run any commands etc that it defines and chooses to run...
        Your _dir_ is running into issues because by the time it runs it's returning nil.
        What is your thinking behind this process ?

        TIG

        1 Reply Last reply Reply Quote 0
        • F Offline
          Frankn
          last edited by

          Let me try and explain what I'm trying to do because I have a few things I'd like to accomplish... this being what I think should be the first step. Though I tend to change/modify my ideas as I work on them.

          Basically I have a cabinet plugin I'm working on and one thing I'd like to do is add nesting/cut sheet/layout functionality... so basically...

          • identify all the top faces of the panels (I can do this).
          • make a copy of the faces before adding them to an array... still need to figure this out.
          • launch a new instance of SketchUp and adding the faces from the array I copied... I was thinking of making a ruby script to do this and then launch/open a plugin to manage the nesting options.

          I got the idea after finding this...
          https://community.sketchucation.com/topic/139502/sketchup-command-line-switches

          Hopefully that's not to confusing and makes some sense.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by Dan Rathbun

            A bit late, but ...

            FYI : The __dir__ global method returns the path to the file that the statement is in. (This means that you cannot use this method when pasting statements into the Ruby Console.)

            That said, the system method call fails because you did not use string interpolation to stuff that value of the path variable into the parameter string, like so:

            system(%[start "New SketchUp Window" "C:/Program Files/Sketchup/Sketchup 2019/SketchUp.exe" "-RubyStartup #{path}"])
            

            Using %[ ] is another way in Ruby of delimiting a double-quoted string that supports interpolation (and as a bonus, nested double quotes.)

            See: Ruby Doc : Interpolable String Literals

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement