• Login
sketchucation logo sketchucation
  • Login
ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

[Code] layer-color= v1.2

Scheduled Pinned Locked Moved Developers' Forum
7 Posts 4 Posters 2.2k Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    TIG Moderator
    last edited by TIG 9 Aug 2009, 14:50

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

    TIG

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 21 Aug 2009, 08:30

      Bump...

      TIG

      1 Reply Last reply Reply Quote 0
      • M Offline
        MartinRinehart
        last edited by 30 Oct 2009, 19:47

        A word of explanation, please. Hard to believe the size of what sounds so simple. The dxf string?

        Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

        1 Reply Last reply Reply Quote 0
        • T Offline
          tomasz
          last edited by 2 Nov 2009, 10:22

          @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

          Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

          1 Reply Last reply Reply Quote 0
          • T Offline
            TIG Moderator
            last edited by 2 Nov 2009, 10:36

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

            TIG

            1 Reply Last reply Reply Quote 0
            • P Offline
              pilger
              last edited by 7 Jul 2010, 15:04

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

              1 Reply Last reply Reply Quote 0
              • T Offline
                TIG Moderator
                last edited by 7 Jul 2010, 17:48

                Typo corrected in v1.3 in first post... 😳

                TIG

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement