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

    Getting and iterating scene list?

    Scheduled Pinned Locked Moved Developers' Forum
    16 Posts 3 Posters 316 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.
    • thomthomT Offline
      thomthom
      last edited by

      Doesn't sleep freeze up SketchUp itself?

      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

        @thomthom said:

        Doesn't sleep freeze up SketchUp itself?

        Yes it does.

        puts 'foo'; Kernel.sleep(5); puts 'bar';
        SketchUp doesn't respond at all until sleep is over.

        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

          @thomthom said:

          Doesn't sleep freeze up SketchUp itself?

          It should not freeze the C++ side, which should continue animating or zooming the camera. It should only pause the Ruby interpreter.

          And I likely showed more time than is needed in at least the first place in the example. The second place is dependent upon how many pages need updating thumbnails, etc.

          I'm not here much anymore.

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

            @thomthom said:

            @thomthom said:

            Doesn't sleep freeze up SketchUp itself?

            Yes it does.

            puts 'foo'; Kernel.sleep(5); puts 'bar';
            SketchUp doesn't respond at all until sleep is over.

            Apples and Oranges.

            puts is on the ruby side, ... of course sleep will pause between the two Ruby statements!

            I'm not here much anymore.

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

              @dan rathbun said:

              @thomthom said:

              @thomthom said:

              Doesn't sleep freeze up SketchUp itself?

              Yes it does.

              puts 'foo'; Kernel.sleep(5); puts 'bar';
              SketchUp doesn't respond at all until sleep is over.

              Apples and Oranges.

              puts is on the ruby side, ... of course sleep will pause between the two Ruby statements!

              I should have been more specific - I cannot interact with SketchUp until sleep is over. The puts statements where just visual clues to know when it was over.

              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

                @dan rathbun said:

                @thomthom said:

                Doesn't sleep freeze up SketchUp itself?

                It should not freeze the C++ side, which should continue animating or zooming the camera. It should only pause the Ruby interpreter.

                You didn't test it, did you?

                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

                  It's probably not perfect,.. and I did say this:

                  @dan rathbun said:

                  If this does not work correctly.. then we'll have to implement a FrameChangeObserver.

                  I'd likely use a UI.start_timer block along with a FrameChangeObserver if the sleep did actually interfer (perhaps SketchUp cannot call ViewObserver or PageObserver instances during sleep call ??)

                  So.. you could be correct Thomas. This the ol' workaround thingummy again. I wish the API would finish doing certain things, before returning a value from many API method calls (like setting pages, etc.)

                  I'm not here much anymore.

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

                    @thomthom said:

                    You didn't test it, did you?

                    Nope.. caught me!

                    I just whacked it out. 😳

                    I'll have to drink another cup of coffee, and put in a FrameChangeObserver

                    I'm not here much anymore.

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

                      Rember, we cannot even use Ruby threads without blocking SketchUp. And wouldnt it be difficult for the Ruby engine to interact with the SketchUp engine and the entities if they ran in a separate thread/process?

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

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        HPW
                        last edited by

                        OK, things seems not so easy.
                        The scene tab even does first appear after a autosart ruby has run, so no way to access the scenes via shortcut.

                        Other idea: Scenes can store the camera loctation. So can a ruby calculate a new camera location for each scene and write the property.
                        This would not update the screen or change the visible scene. But next time the scene-change is used it updates to the new location.
                        And the new camera locations are stored for each scenes in onSave.

                        What Propertys does ZoomExtents set? Is there a equivalent in ruby to calculate the values in the same way?

                        Regards

                        Hans-Peter

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          HPW
                          last edited by

                          This does what I want:

                          
                           model = Sketchup.active_model
                           pages = model.pages
                           pages.each {|page|
                              pages.selected_page = page
                              UI.messagebox("Scene; "+page.name)
                              view = model.active_view
                              new_view = view.zoom_extents
                              status = page.update(33) 
                              }
                          
                          

                          But I have to press OK on the messagebox when scene-update has finished.

                          Edit: Kernel.sleep does not work for that.

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

                            @hpw said:

                            Edit: Kernel.sleep does not work for that.

                            Yes.. I guess we decided it would not, because the C++ engine cannot call observers, as the scene changes, etc.

                            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