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...
Advertisement