Add entities to a layer
-
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 -
The work flow is more like:
layer = Sketchup.active_model.layers.add "My New Layer" component_entity.layer=layerhttp://www.sketchup.com/intl/en/developer/docs/ourdoc/drawingelement#layer=
Good luck!
-
As Chris says...
You add anentityinto anentities'collection'.
Likemodel.entities,group.entities,definition.entitiesetc.
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... -
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
-
You're welcome!
-
thank you very much for the detailed explanation TIG. It cleared the doubted areas about the layers.
Advertisement