sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    I want to be in a specific layer

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 171 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.
    • P Offline
      Pauline01
      last edited by

      hello,

      I work with layer in my plugin.

      I create an object, this object must be put on a layer.

      I want to be in a specific layer, and not just put visible=false or true.
      See in my code after :
      #I have 3 layers:"Layer0", "Batiment" and "Gestion de zones", i hide "Batîment"
      #I want to be in the layer "Gestion de zone" to create my object
      #here "Batiment" is just hidden but i don't arrive to be in the layer "Gestion de zone"

      thx.

      model=Sketchup.active_model
      
              #I have 3 layers;"Layer0", "Batiment" and "Gestion de zones", i hide "Batîment"
              #I want to be in the layer "Gestion de zone" to create my object
              #here "Batiment" is just hidden but i don't arrive to be in the layer "Gestion de zone"
      	layers = model.layers
      	layers.each { |e|
      
      	name=e.name
      	
      	if name.to_s == "Batiment"
      	
      		e.visible=false
      	
      	end
      	
      	if name.to_s == "Gestion des zones"
      	
      		e.visible=true
      		$gestion_zone_activation=1
      	
      	end
      	}
        # Get "handles" to our model and the Entities collection it contains.
        model = Sketchup.active_model
        entities = model.entities
      
        # Create a series of "points", each a 3-item array containing x, y, and z.
        pt1 = [0, 0, 0]
        pt2 = [30, 0, 0]
        pt3 = [30, 0, 17]
        pt4 = [0, 0, 17]
        coordinates = [0, 0, 8.5]
        
        # Call methods on the Entities collection to draw stuff.
        # new_face = entities.add_face pt1, pt2, pt3, pt4
        group = entities.add_group
        point = Geom;;Point3d.new coordinates
        group.entities.add_face(pt1,pt2,pt3,pt4)
      
      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        group.layer = model.layers['myLayerName']

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

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

          I don't know if your function correspond at my question

          Maybe isn't possible, but i have the configuration of my layer like in the screen:


          http://i68.servimg.com/u/f68/14/78/18/60/first_10.jpg

          and i want arrive at:


          http://i68.servimg.com/u/f68/14/78/18/60/second10.jpg

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            Do you mean selecting the active Layer?

            Sketchup.active_model.active_layer = the_layer

            Hi

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

              Are you changing the active layer because you want to put the geometry you create on that layer?

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

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

                It's almost always best to leave the active layer as Layer0 and simply assign other layers to things as you make them...
                You usually wan to leave 'raw geometry' [edges/faces] on Layer0 - you can then set other layers for Groups/Component_Instances/Text etc to control their visibility...

                TIG

                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