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

    Help with opening additional instance of SketchUp.

    Scheduled Pinned Locked Moved Developers' Forum
    17 Posts 5 Posters 916 Views 5 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.
    • honoluludesktopH Offline
      honoluludesktop
      last edited by

      I am using system "C:\\Program Files\\Google\\Google SketchUp 8\\SketchUp.exe "+name+".skp" to start a new instance of Sketchup to "Edit_Selected_Component". Problem is that it causes the original instance of Sketch to hang until the new instance is closed. I also tried exec but that did not permit returning to the first instance.

      Is there another way to do this that allows access to both instances of SketchUp at the same time?

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

        Assuming windows knows what to do with a .skp filetype, use UI.openURL("/path/to/model.skp")

        My version opens the saved component in the same instance of SketchUp instead of opening another, then re-opens the original.

        Hi

        1 Reply Last reply Reply Quote 0
        • honoluludesktopH Offline
          honoluludesktop
          last edited by

          Jim,. thanks. I have never used IE to open a file before. How about that, from the IE File > Open I can select a skp to open in a new instance of SketchUp. Couldn't get it to work from the plugin yet. Guess I have to play with it for a while.

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

            @honoluludesktop said:

            Jim,. thanks. I have never used IE to open a file before. How about that, from the IE File > Open I can select a skp to open in a new instance of SketchUp. Couldn't get it to work from the plugin yet. Guess I have to play with it for a while.

            Rather than try and include new code into a plugin immediately why not test it by typing/pasting a line to the Ruby Console... UI.openURL("full_path_to_model.skp") - if it doesn't work you should get an error message [or two!] - e.g. don't forget to escape backslashes etc inside double-quotes "C:\Users\Me..."..........

            TIG

            1 Reply Last reply Reply Quote 0
            • honoluludesktopH Offline
              honoluludesktop
              last edited by

              Now that I have figured out the correct path\filename, it works great. Will it work with OSX?

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

                @honoluludesktop said:

                Now that I have figured out the correct path\filename, it works great. Will it work with OSX?

                With MAC you might need to adjust the code slightly... try something like
                UI.openURL("file:/path/to/model.skp")
                with forward slashes [ /] and the extra leading ' file:/' - note that that might also work on PC too... 🤓

                TIG

                1 Reply Last reply Reply Quote 0
                • honoluludesktopH Offline
                  honoluludesktop
                  last edited by

                  This is interesting, If the app is written with the ruby method system, the original model will not update until the second instance of SketchUp is closed. By using UI.openURL(path\filename) a message box (or some other means) must be used to stop processing the app on the first instance of SketchUp. While the former is safer, the latter allows viewing the whole model while editing the selected component.

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

                    On Mac.. an additional Sketchup instance is not needed as the Mac edition is a tabbed MDI (Multiple Document Interface.) So using the API method Sketchup.open_file you should be able to have your plugin edit the component file in a new model tab.

                    I did log requests for several new methods for MDI use such as a close_model method, along with appropriate observers. If more coders ask for these in the API Wish list forum, perhaps their priority will be raised.

                    Additional topic threads on this subject:
                    [Wishlist] Edit Component
                    [HowTo?] Edit Components (or change "active level")

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      favicon

                      (www.ruby-forum.com)

                      @unknownuser said:

                      If you are just trying to avoid blocking you could use
                      system("start process") as start returns immediately.

                      Thomas Thomassen — SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        @honoluludesktop said:

                        system ("start C:\Program Files\Google\Google SketchUp 8\SketchUp.exe")

                        Avoid spaces between method name and brackets.

                        Of all your different versions to call it, have you tried adding quotes around the path to SketchUp?

                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • honoluludesktopH Offline
                          honoluludesktop
                          last edited by

                          My original code, system file_path_name+name+".skp" starts a second instance of SU, suspending the first. I tried every combination of:

                          system("start"+file_path_name+name+".skp") system(start file_path_name+name+".skp") system(start,file_path_name+name+".skp") system ("start C:/Program Files/Google/Google SketchUp 8/SketchUp.exe") system ("start C:\\Program Files\\Google\\Google SketchUp 8\\SketchUp.exe") Thread.new {system ("start C:\\Program Files\\Google\\Google SketchUp 8\\SketchUp.exe")}

                          etc. and, couldn't start sketchup, with or without, a parameter. system ("start command") however, will open the cmd window without suspending the first instance of Sketchup. What could I be doing wrong?

                          1 Reply Last reply Reply Quote 0
                          • honoluludesktopH Offline
                            honoluludesktop
                            last edited by

                            No, I'll try those too.

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              This worked:
                              system('start "New SketchUp Window" "C:/Program Files (x86)/Google/Google SketchUp 8/SketchUp.exe"')

                              I looked at the help information for start:
                              start_args.png

                              Turns out the first argument must be a title - for that command window that briefly flickers.

                              Not sure if this works under OSX though.

                              Thomas Thomassen — SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • honoluludesktopH Offline
                                honoluludesktop
                                last edited by

                                OK, now I have, but to no avail. Will comeback and try later, just have to go and eat some breakfast.

                                Addenda: posted without seeing yours. Thanks.

                                1 Reply Last reply Reply Quote 0
                                • honoluludesktopH Offline
                                  honoluludesktop
                                  last edited by

                                  Thomas, Thanks, it too works for me. Don't think that I would have thought to enclose the set of parentheses in another enclosing parentheses.

                                  system("C:/Program Files/Google/Google SketchUp 8/SketchUp ") will start without specifying ".exe", or splashing a cmd window. So, that may work with OSX. But excluding ".exe" in system('start "process......."') fails to start. I think (for now) that I will stick with starting the second instance of SketchUp with UI.openURL('process.....'). Don't know if that works with OCX. In Win, however, Sketchup appears to start faster, but don't know about the overhead.

                                  I see that your version of DOS is 6.1. Is this its original release, or the one that came with your WinOS? Which machine were you on at the time? I have a copy of DOS 6.1 (left over from the good old days) installed in a VPC.

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

                                    The paths to Sketchup.app on OSX, and Sketchup.exe on Windows, are different.

                                    I'm not here much anymore.

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

                                      @honoluludesktop said:

                                      I see that your version of DOS is 6.1. Is this its original release, or the one that came with your WinOS? Which machine were you on at the time? I have a copy of DOS 6.1 (left over from the good old days) installed in a VPC.

                                      FYI ... DOS 6.22 came out at the same time as Win 3.11 for Workgroups (I still have my disks and manuals as well.) DOS 7 was distroed with Win98 (not sure about Win95.) Win 2000 & up are NTFS not DOS.

                                      BUT ... you misread the image. It is the Windows ver that is displayed, not DOS.
                                      Win 5.0 = Windows 2000
                                      Win 5.1 = Windows XP
                                      Win 6.0 = Windows Vista
                                      Win 6.1 = Windows 7

                                      I'm not here much anymore.

                                      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