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!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    OnPageChange event

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 289 Views 2 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.
    • J Offline
      Jim
      last edited by

      I wanted to detect a Scene change in SketchUp. The only method I could find was onContentsModified of the PagesObserver, which apparently gets fired twice.

      I know it could be worked-around using a timer.

      I just can't stop asking myself "Where's the onPageChange" event?

      Hi

      1 Reply Last reply Reply Quote 0
      • chrisglasierC Offline
        chrisglasier
        last edited by

        And in Google SketchUp Ruby API what's the difference between

        PagesObserver.onContentsModified

        and

        PagesObserver.onElementAdded

        If I add a scene am I not modifying the pages content?

        There is no pageObserver. So if I update a page am I modifying the pages content?

        I know if I change the selected_page, PagesObserver.onContentsModified tells me which page, but I am not really modifying the content aren't I just getting data at that stage?

        I think we should be told!

        With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

        1 Reply Last reply Reply Quote 0
        • chrisglasierC Offline
          chrisglasier
          last edited by

          
             def CgScenes.page_contents_modified(pages)
          		a = 0
          		#puts(pages)
          		pages.each do | page |
          			if page == pages.selected_page
          			@ind = a
          			puts "Modified " + pages[a].name.to_s
          			end
          		a = a + 1
          		end
          		array = [0,@ind]		#colNo,activeRow
          		array = array.join(",")
          		@dlg.execute_script("sceneSliderAdjust('#{array}');")
              end
          

          Pages observer double mod.png

          One for the old; one for the new!

          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

          1 Reply Last reply Reply Quote 0
          • chrisglasierC Offline
            chrisglasier
            last edited by

            @chrisglasier said:

            And in Google SketchUp Ruby API what's the difference between

            PagesObserver.onContentsModified

            and

            PagesObserver.onElementAdded

            ...

            Now I have got to the point where I am checking what happens when the scene machine is plugged in to a model with no scenes. It is sensible to add one or more scenes to get started. But when I do that onContentModified sets off the JavaScript function for a scene selected from an existing set and throws an error. I suppose I will find a way round, but it does not seem right when there is " onElementAdded." There again I could have missed something fundamental. Either way I would appreciate some clarification.

            Thanks

            Chris

            With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

            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