[Code] layer-color= v1.2
-
This adds a new Method to Sketchup's Layer Class
layer.color= arg
where 'arg' is used in several ways.
Usage of 'arg':
as a 3 Integer Array [red, greeen, blue]
layer.color=[255, 0, 0] - e.g. == 'Red'
as a Sketchup::Material
layer.color=material
as a built-in Color, by name
layer.color="Blue"
as a Model.material, by name
layer.color="Brick1"
Limitations:
Can't change the Color for the default Layer=nil, e.g. 'Layer0':
you must change Color manually.
Won't include the Texture-image from a textured Material -
only its Color is used: you must add a Texture manually.
v1.0 20090809
v1.1 20090819 Any Attribute Dictionaries copied to re-colored Layer.
v1.2 20090821 Error with attrdicts==nil fixed
v1.3 20100707 Typo with attrdicts fixed.
...Put in Plugins folder... -
Bump...
-
A word of explanation, please. Hard to believe the size of what sounds so simple. The dxf string?
-
@tig said:
It was the only way I could get something to work !!!
It is almost like a black-ruby
TIG, is there a way to read layer's material. The API doesn't give such a method.
Tomasz
-
@martinrinehart said:
A word of explanation, please. Hard to believe the size of what sounds so simple. The dxf string?
It was the only way I could get something to work !!!
I could have written a shorter dxf string but just used one I exported from CAD as it was quicker... -
I recently noticed that the colours "randomly" assigned to the layers consist of just a handfull of colours and not really random ones. Which left my model with a bunch of geometry in the same colour.
I have a question on how this plugin (which seems to be the root of resolving my problem) works from the inside. I'm a bit worried on how does it work on heavy models.
Does it export everything to a dxf (including geometry) and import it back or does it just export and import empty dxf with layer information!?
EDIT
I'm also getting an ugly
Error; #<NameError; undefined local variable or method `definition1_attrdicts' for #<Sketchup;;Layer;0x13919c30>> C;/PROGRA~2/Google/GOOGLE~2/Plugins/layer-color=.rb;120;in `color='
Any thoughts?
POST-EDIT
Removing the "definition1_" from line 120 seems to have solved the problem. Since it would take me hell long to go through all Jim's script and see if that change affects something else, i'll leave that to him. But it's working fairly good here. -
Typo corrected in v1.3 in first post...
Advertisement