sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Lock a layer

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 11.6k 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.
    • X Offline
      xiobus
      last edited by

      Any one know how to lock a whole layer? I only see in the API ability to lock groups and components and I also don't see a way to easily move entities into a group/component. Perhaps there is an efficient way to "copy, paste and delete" a list of entities or even copy from one group to another preferably based on selection or layer?

      1 Reply Last reply Reply Quote 0
      • M Offline
        MartinRinehart
        last edited by

        @xiobus said:

        ... I also don't see a way to easily move entities into a group/component.

        Tutorial, Chapter 13:

        
        def all()
            model = Sketchup.active_model()
            model.selection().clear()
            ents = []
            for e in model.entities()
                ents.push( e ) if e.layer().visible?()
            end
            model.selection().add( ents )
        end # of all()
        
        

        Same source:

        
        def make_component( entities, name )
        
        =begin
        Given an array of entities and a name, returns a named component 
        containing the entities.
        =end
        
            ents = Sketchup.active_model().entities()
        
            g = ents.add_group( entities ) # group all entities
            inst = g.to_component() # convert group to component instance
            inst.definition().name = name
        
            return inst
        
        end # of make_component()
        
        

        After all model.selection is an entities collection. This is the Ruby equivalent of pressing Ctrl+A and then keyboard G to make component.

        Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

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

          You can only 'Lock' Groups and Instances of Components.
          Sketchup Layers are not like CAD Layers !
          If you want to Lock everything on a particular SUp Layer you need to use Group-Entities-by-Layer - there is a script out there on this Forum to do that - use Search......
          Then you need to Lock that Group.
          This will not Lock Entities on that Layer if they are inside a Definition [i.e. Groups and Components].. but you can use Group-Definition-Entities-by-Layer and then Lock that Group - by iterating through the model.definitions.entities.each{|e|...}

          TIG

          1 Reply Last reply Reply Quote 0
          • Bob JamesB Offline
            Bob James
            last edited by

            In the Help for SU7 it discusses three icons in the Layers Dialog Box:
            Visibility Button
            Lock Button
            Share Button

            But the Dialog Box displayed is not what you get in SU7

            What am I missing?


            Layers.jpg

            i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60

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

              Read the path to the help section - it's for Layout - where you can lock layers !Capture.PNG You can't do it in plain Sketchup !

              TIG

              1 Reply Last reply Reply Quote 0
              • Bob JamesB Offline
                Bob James
                last edited by

                😳

                i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60

                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