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!
    🚨 Skimp | 25% Off until March 30 Buy Now

    Add entities to a layer

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 205 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.
    • S Offline
      sachi
      last edited by

      Dear all,

      i want to control the visibility of several components in my model. to do that i add a new layer to the model. now i want to assign those components to newly added layer(new_layer). how could i assign those components to the new layer?
      theoretically there should be something like
      new_layer.add component_entity
      help me.thanks in advance

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

        The work flow is more like:

        layer = Sketchup.active_model.layers.add "My New Layer" component_entity.layer=layer

        http://www.sketchup.com/intl/en/developer/docs/ourdoc/drawingelement#layer=

        Good luck!

        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

          As Chris says...
          You add an entity into an entities 'collection'.
          Like model.entities, group.entities, definition.entities etc.
          An entity can then be assigned a layer: entity.layer=my_layer
          It's advisable NOT to assign layers to 'raw geometry.'
          This will lead to confusion...

          Assigning a .layer= is the same as you do to assign a .material=, .hidden=[true/false] and so on.
          Layers are used to control objects' visibility, not to separate geometry - that separation is done using a 'container' like a group or definition, the container can then have a layer assigned too...

          TIG

          1 Reply Last reply Reply Quote 0
          • S Offline
            sachi
            last edited by

            thank you very much.it worked.i tested it for a simple program.now i'm going to apply it to my original code.
            thanks again πŸ‘

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

              You're welcome!

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

              1 Reply Last reply Reply Quote 0
              • S Offline
                sachi
                last edited by

                thank you very much for the detailed explanation TIG. It cleared the doubted areas about the layers.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better πŸ’—

                Register Login
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement