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

    Delete your scenes via the API - working?

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 201 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      I am trying this method but not getting it to work. Is it really implemented? Or am I missing something? my code loks like this:

      model = Sketchup.active_model pages = model.pages pages.each do |e| e.erase end
      and the error is:

      (eval):69:in ā€˜initialize’: undefined method ā€˜erase’ for #<Sketchup::Page:0x81289e0>

      What am I missing here, I'm guessing it will be something simple and embarrassing - as usual šŸ˜„

      Chris

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

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

        e.erase! ??

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

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

          I tried it, that didn't work either unfortunately.

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

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

            Read the API carefully - the .erase method is for the Pages class, not the Page class. That's why your code didn't work. Try this:

            pages.each{|page| pages.erase(page)}
            

            Or, in your style

            pages.each do |e|
              pages.erase(e)
            end
            

            RickW
            [www.smustard.com](http://www.smustard.com)

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

              Interesting. I had not found it in the API, rather in the blog post here:

              Link Preview Image
              What's New in SketchUp 7

              Posted by Scott Lininger, SketchUp Team SketchUp 7 contains several improvements to the Ruby API. Here's a quick tour of the best changes. I...

              favicon

              (sketchupapi.blogspot.com)

              and the only hint it gives is this:

              Delete your scenes via the API
              my_page.erase

              So I assumed it was a page thing. Then when I looked for it in the API, it was not in the "page" class section.

              So I see it now, and I'll go give it a shot. Thanks Rick,

              Chris

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

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

                @chris fullmer said:

                Interesting. I had not found it in the API, rather in the blog post here:

                Link Preview Image
                What's New in SketchUp 7

                Posted by Scott Lininger, SketchUp Team SketchUp 7 contains several improvements to the Ruby API. Here's a quick tour of the best changes. I...

                favicon

                (sketchupapi.blogspot.com)

                and the only hint it gives is this:

                Delete your scenes via the API
                my_page.erase

                So I assumed it was a page thing. Then when I looked for it in the API, it was not in the "page" class section.

                So I see it now, and I'll go give it a shot. Thanks Rick,

                Chris

                Yes, it does give that impression. I can see why it was confusing.

                RickW
                [www.smustard.com](http://www.smustard.com)

                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