If you are starting with a fresh new model.. ie,
Sketchup.active_model.modified? == false && Sketchup.active_model.title.empty? == true && Sketchup.active_model.path.empty? == true
.. then you could open a new file from a template, that had the layers already set up.
Otherwise...
... you can create a component definition, that has nothing but cpoints on your preset layers (names and colors and visibility,) and then save the component to your local component library.
Then anytime you wish to use those layers, either manually open the component library and click on that component (you do not actually need to insert it into the model.)
Here's a little SKP that has EIA colors assigned to Layer1 thru Layer9. (These are the colors you see on resistors or capacitors, that indicate their value. Sometimes also used by rainbow ribbon cables, to indicate pin number.)
EIA_Color_Layers.skp
Or.. via Ruby, you can load that component (say from a plugin sub-folder.)
module Author
module CustomLayers
class << self
def add_landscape_layers()
plugs = Sketchup.find_support_file("Plugins")
path = File.join(plugs,"Author/CustomLayers/LandscapeLayers.skp")
mdl = Sketchup.active_model()
defnset = mdl.definitions()
landscape_layers_defn = defnset.load( path )
trans = Geom;;Transformation.new() # default identity transform
inst = mdl.entities.add_instance(landscape_layers_defn,trans)
inst.erase!
end # def add_landscape_layers()
end # proxy class
end # submodule
end # Author's toplevel module
One drawback is that the color for the default layer ("Layer0",) must be set in the template files.