• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Layer color opacity via Ruby

Scheduled Pinned Locked Moved Developers' Forum
2 Posts 2 Posters 358 Views 2 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.
  • V Offline
    Velutis
    last edited by 7 Sept 2016, 12:30

    Hi, i cant set layer color opacity via Ruby script:
    layer = layers.add "newlayer" layer.color = "red" layer.alpha = 255 //tried 0.1 and other values
    when layer created opacity is always 100. Any thoughts?
    Thanks

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 7 Sept 2016, 13:35

      It's not currently possible.
      Only a layer's color - RGB - is changeable in Ruby.

      Sadly no Alpha [or Textures] are possible.

      One 'trick' is to make a SKP containing all of the Layers you want to use, each with manually assigned colors, and with transparencies and textures if desired.
      Remember to include a guide-point at the origin so it's usable later.
      Now in your Ruby code load that SKP as a component definition.
      If you do it inside a start_operation...commit block and use compdefn.entities.clear! then the loaded component is deleted but its imported layers remain - although later on they'll purge if unused.

      Now you can use these layers by name.
      Depending to what you want to do you can also rename an imported layer if desired...

      TIG

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

      Advertisement