[Code] layer-color= v1.2

[Code] layer-color= v1.2

Postby TIG » Sun Aug 09, 2009 3:50 pm

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.
...
layer-color=.rb
0
Last edited by TIG on Fri Aug 21, 2009 9:38 am, edited 1 time in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Code] layer-color= v1.2

Postby TIG » Fri Aug 21, 2009 9:30 am

Bump...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Code] layer-color= v1.2

Postby MartinRinehart » Fri Oct 30, 2009 8:47 pm

A word of explanation, please. Hard to believe the size of what sounds so simple. The dxf string?
0
Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

MartinRinehart 
 

Re: [Code] layer-color= v1.2

Postby TIG » Sat Oct 31, 2009 2:29 pm

MartinRinehart wrote: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...
0
Last edited by TIG on Mon Nov 02, 2009 11:36 am, edited 1 time in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Code] layer-color= v1.2

Postby tomasz » Mon Nov 02, 2009 11:22 am

TIG wrote: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
0

tomasz 
SU2TH & SU2KT Developer
 

Re: [Code] layer-color= v1.2

Postby pilger » Wed Jul 07, 2010 4:04 pm

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
Code: Select all
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. :thumb:
0
User avatar
pilger 
 

Re: [Code] layer-color= v1.2

Postby TIG » Wed Jul 07, 2010 6:48 pm

Typo corrected in v1.3 in first post... :oops:
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 6 guests