Remove layer doesn't work?!
-
hi
sorry if this is a simple query, but it has me stuck.
I've added a layer to my model with
Sketchup.active_model.layers.add("test")which works fine. The API reference says this should remove it,
Sketchup.active_model.layers.remove("test", true)but it errors
Error; #<NoMethodError; undefined method `remove' for #<Sketchup;;Layers;0xc8649c4>> (eval);81anyone got any bright ideas?!
thanks
bob -
Layers.removeis new in SketchUp 2015.
The API docs show the version of SketchUp methods were introduced.Prior to version 15, you need to do it using
Layers.purge_unusedafter moving or deleting any geometry on that Layer.TIG posted some code here: http://sketchucation.com/forums/viewtopic.php?p=166985#p166985
-
thanks Jim, I hadn't spotted the 2015+ in the docs

I have (hopefully) one more layer question. Is it possible to set the layer opacity and then turn on "color by layer"?
thanks again
-
For Color by Layer, see the Rendering Options[1]
Sketchup.active_model.rendering_options['DisplayColorByLayer'] = trueI do not think the transparency can be set from Ruby.
[1] http://www.sketchup.com/intl/en/developer/docs/ourdoc/renderingoptions
-
Jim is correct.
If, via Ruby, you give a layer a color with transparency it is ignored and it renders opaque.
Sp currently you can only change a layer's color through the API - there is no alpha OR texture support within the API, although of course you can do both of those manually...
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