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!
    Mac User? | Join the Rayscaper Beta for Mac Learn More

    Multi-threading inside SketchUp

    Scheduled Pinned Locked Moved Developers' Forum
    17 Posts 10 Posters 6.7k Views 10 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.
    • thomthomT
      thomthom
      last edited by

      So after creating the threads, you have to start a loop that runs until your threads complete? And that means you can't do anything else in SU while the threads execute?

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

      1 Reply Last reply
      Reply Quote 0
      • J
        jhauswirth
        last edited by

        @thomthom said:

        So after creating the threads, you have to start a loop that runs until your threads complete? And that means you can't do anything else in SU while the threads execute?

        That's what I found, but this solution wouldn't work for me because I needed the thread to always run.

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

          @thomthom said:

          So after creating the threads, you have to start a loop that runs until your threads complete?

          NO... use Thread.join instead of a loop.
          ` th1 = Thread.new {

          code

          }
          th1.join`
          Suggest always have an exit condition inside thread. Not like example in first post (ie, it's an endless loop.)

          I'm not here much anymore.

          1 Reply Last reply
          Reply Quote 0
          • M
            MartinRinehart
            last edited by

            @dan rathbun said:

            ... Suggest ...

            Dan,

            I've played a lot with threads in SketchUp Ruby and have zero useful results. Could you post a small example that actually works?

            Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

            1 Reply Last reply
            Reply Quote 0
            • C
              cjthompson
              last edited by

              This gets the best results for me so far. It's really slow, but it seems to be executing on a regular basis.

              
              def testThread(times)
              	timer = UI.start_timer(0,true){Sketchup.active_model.entities}
              	thread = Thread.new{(0...times).each{|num| addBox};UI.stop_timer(timer)}
              end
              
              def addBox
              	group = Sketchup.active_model.entities.add_group
              	face = group.entities.add_face([0,0,0],[1,0,0],[1,1,0],[0,1,0])
              	face.pushpull(-1)
              	group.transformation = Geom;;Transformation.new([rand(500),rand(500),rand(500)])
              end
              
              
              1 Reply Last reply
              Reply Quote 0
              • A
                Aidus
                last edited by

                I need 64 bit support 😞

                CPU: Intel Core i7 Extreme Edition 965
                RAM: OCZ Gold DDR3 1600MHz 12Gb
                Video: Asus Radeon HD4870 X2 2Gb
                Mobo: Asus P6T Deluxe 1366 Intel X58

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

                  @aidus said:

                  I need 64 bit support 😞

                  For what?

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

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

                    @aidus said:

                    I need 64 bit support 😞

                    This topic is about using Ruby "Green" threads, not native OS threads (which can run on several CPU cores.)

                    Ruby ver 2.0 "may" have native thread support, but current estimates of the work to be done, has 2.0 needing 17 years more work.

                    I'm not here much anymore.

                    1 Reply Last reply
                    Reply Quote 0
                    • C
                      cjthompson
                      last edited by

                      @dan rathbun said:

                      @aidus said:

                      I need 64 bit support 😞

                      This topic is about using Ruby "Green" threads, not native OS threads (which can run on several CPU cores.)

                      Ruby ver 2.0 "may" have native thread support, but current estimates of the work to be done, has 2.0 needing 17 years more work.

                      I thought 1.9 had basic support for native threads, but Sketchup can't connect to its hooks.

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

                        @cjthompson said:

                        I thought 1.9 had basic support for native threads, but Sketchup can't connect to its hooks.

                        Might be.. (I'd like to know for sure if you can post a link.)

                        However Sketchup cannot currently load the 1.9.x interpreter DLL (... I've tried, and get an "entry point not found error." There seems to be some kind of difference between the 1.8.x and the 1.9.x DLLS, which I'd also like to know why this is. )

                        Also, "basic support" I read as "beta" (and likely error prone.)

                        I'm not here much anymore.

                        1 Reply Last reply
                        Reply Quote 0
                        • A
                          Aidus
                          last edited by

                          I'm working with very large textures and I think su offten crashes because of that reason. It just can't work with very large files. You can operate inside sketchup but forget the export. Well that's just my guess. At home I have x64 bit os and there are no such problems - not so offten.

                          CPU: Intel Core i7 Extreme Edition 965
                          RAM: OCZ Gold DDR3 1600MHz 12Gb
                          Video: Asus Radeon HD4870 X2 2Gb
                          Mobo: Asus P6T Deluxe 1366 Intel X58

                          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