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

    [Code] layer.delete()

    Scheduled Pinned Locked Moved Developers' Forum
    20 Posts 7 Posters 5.3k Views 7 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.
    • chrisglasierC Offline
      chrisglasier
      last edited by

      Sorry I just want this topic to appear in "Your posts" - i.e mine

      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
      • thomthomT Offline
        thomthom
        last edited by

        @al hart said:

        Is there no way to delete a layer directly?

        Not via the API, erase! method for layers and materials are missing. There's also missing methods to edit names etc... ๐Ÿ˜ž

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

        1 Reply Last reply Reply Quote 0
        • Al HartA Offline
          Al Hart
          last edited by

          @chrisglasier said:

          Sorry I just want this topic to appear in "Your posts" - i.e mine

          I don't understand the statement above ^^^

          Did you alter this thread in some way?

          [Edit: Ah I see - you added a post to the thread so you could follow it easier. It might be better to just add a nice comment - like - "Thank you all, this is usefull information", or you could subscribe to the thread instead.}

          Al Hart

          http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
          IRender nXt from Render Plus

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

            No, but now he can find it by looking at his profile and listing all his posts. And so can I.....but I'm not really involved with layers at this point. Good luck!

            Chris

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

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

              @didier bur said:

              Hi TIG,
              I was just considering the same feature for the new release of my Layer Manager. I thought it could work (from the user point of view) just like AutoCad did (some versions ago), so it asks wether you want to:

              • delete the entire content of the layer before deleting the layer,
              • move the entities to default or another layer.
                it would have to scan for groups containing objects on the layer to delete, and for compos definitions too.
                Before developping it, do you think this feature will be useful for users, assuming that there will be other tools in the Layer Manager to easily move entities from one layer to another ?
                Thanks in advance,

              Didier
              Please feel free to use my ideas in your upgraded Layer Manager... I think it could be useful...
              As presently configured my code moves any entities on layer_to_go to the default layer [ each...e.layer=nil] BUT instead you could move them to another designated layer [ each...e.layer=another_layer] OR simply delete them [ each...e.erase!] instead, in your suggested additional options... My code already makes 'nil' every entity on layer_to_go in the model AND inside every definition [which includes groups], before removing the layer, using the same method you could change the entity's layer or erase it...
              Note that to ensure the layer goes from the browser you need your code to be inside a start...commit.

              TIG

              1 Reply Last reply Reply Quote 0
              • Didier BurD Offline
                Didier Bur
                last edited by

                Thanks TIG, yur programming is more compact and clever than mine was on this one ! ๐Ÿ‘

                DB

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

                  @al hart said:

                  ... Ah I see - you added a post to the thread so you could follow it easier.

                  Yes sorry Al et al (both for being lazy and somewhat terse) but as you can see I am addicted to putting lots of things in one easily accessible place/machine:

                  Preview device version 2.png

                  Another proposed turn of the interface indicates why I have a big interest in deleting layers containing components rather than dimensions and labels:

                  Preview reform version 2.png

                  • and of course a big thank you to TIG and the others contributing to this topic.

                  My regards

                  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
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    Now with v1.4 deletes layer's geometry with (delete_geometry)==true
                    http://forums.sketchucation.com/viewtopic.php?p=166985#p166985

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • P Offline
                      Pout
                      last edited by

                      @thomthom said:

                      @al hart said:

                      Is there no way to delete a layer directly?

                      Not via the API, erase! method for layers and materials are missing. There's also missing methods to edit names etc... ๐Ÿ˜ž

                      ThomThom,

                      You can edit a layer name with layer.name=
                      Although you will only see the changed layername when reopening the layer window.
                      (I don't know however what is done with SU entities on that layer, since i only rename empty layers in my script)

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

                        Using layer.name="xxx" simply changes that layer name to "xxx" - entities etc aren't affected as they refer to the layer by its id not its name.
                        A simple way to change a layer IF it exists is something like

                        model=Sketchup.active_model
                        model.layers["ABC"].name="XYZ" if model.layers["ABC"]
                        

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • P Offline
                          Pout
                          last edited by

                          Great thx Tig for the extra explanation

                          Now if only this was possible for materials to (without having to duplicate the entities first)

                          BTW Tig, do you know if is possible to refresh the Layer window?

                          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