I want to be in a specific layer
-
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) -
group.layer = model.layers['myLayerName'] -
-
Do you mean selecting the active Layer?
Sketchup.active_model.active_layer = the_layer
-
Are you changing the active layer because you want to put the geometry you create on that layer?
-
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...
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 LoginAdvertisement

