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

    Multi-threading inside SketchUp

    Scheduled Pinned Locked Moved Developers' Forum
    17 Posts 10 Posters 5.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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Offline
              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 Offline
                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 Offline
                  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 Offline
                    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 Offline
                      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 Offline
                        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 Offline
                          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
                          • 1 / 1
                          • First post
                            Last post
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement