sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Delete all scenes?

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 1.7k Views 4 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.
    • daikuD Offline
      daiku
      last edited by

      I have a need to delete all scenes from my ruby script. I read somewhere that this is not possible, but I did find model.pages.erase: http://code.google.com/apis/sketchup/docs/ourdoc/pages.html#erase.

      I thought that this code would work, but it splats for me:

      
      pgs = Array.new
      model.pages.each {|pg| pgs.push pg}
      pgs.each {|pg| model.pages.erase pg}
      
      

      Any ideas? CB.

      Clark Bremer
      http://www.northernlightstimberframing.com

      1 Reply Last reply Reply Quote 0
      • R Offline
        remus
        last edited by

        I think you just missed out the model = Sketchup.active_model

        This works for me:

        model = Sketchup.active_model
        
        pgs = Array.new
        model.pages.each {|pg| pgs.push pg}
        pgs.each {|pg| model.pages.erase pg}
        

        http://remusrendering.wordpress.com/

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

          Remus's code works on v7, BUT not on v6.

          There is no equivalent to model.pages.erase(page) till v7...

          TIG

          1 Reply Last reply Reply Quote 0
          • daikuD Offline
            daiku
            last edited by

            Ah, that's the confusion (v6 vs v7).

            I had set model earlier in the script.
            My splat seems to be related to undoing the erasures, and then erasing them again. Will require more investigation.

            Clark Bremer
            http://www.northernlightstimberframing.com

            1 Reply Last reply Reply Quote 0
            • daikuD Offline
              daiku
              last edited by

              Seems I can create this splat fairly easily without using ruby at all. Just open a model that has one scene, and then delete that scene. Then close SU, and it will splat. At least for me.

              Clark Bremer
              http://www.northernlightstimberframing.com

              1 Reply Last reply Reply Quote 0
              • Chris FullmerC Offline
                Chris Fullmer
                last edited by

                Interesting, I'm not seeing that. Perhaps you have a ruby installed that is conflicting. You might need to test which ruby it is.

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

                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