sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Access Opacity

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 177 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.
    • D Offline
      dvonhausen
      last edited by

      I have a component that has a color associated with it. when I have it selected and open "Entity Info" on it then click on the color, a "Choose Paint" panel opens and I can edit the Opacity (set it between 0 and 100). I want to access this value in ruby. I can get the colors for example: "ent.material.color.red". But "ent.material.color.alpha" always returns 1 and not the color of the opacity. Clearly it is stored somewhere but I do I get this opacity value?

      Thanks in advance,
      Dave

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Use
        entity.material.alpha
        to get it, and e.g.
        entity.material.alpha=0.5
        to set it [it's from 0.0 to 1.0 - transparent to opaque]
        A color also has two equivalent alpha methods [a color has [R,G,B,A]] BUT it doesn't change what is displayed for a material, no matter what the color's alpha is set to be. The color.alpha is 0 to 255 NOT 0.0 to 1.0
        From v8+ a color's alpha does affect it's transparency when it's used to color a face made in a method like ' view.draw(GL_POLYGON, coplanar_points_array)', where you have previously made a suitable color object [with alpha for transparency if desired] and then set it using view.drawing_color=color [in previous SUp versions such faces always came out as black' whatever color had been assigned - now it's fixed]...

        TIG

        1 Reply Last reply Reply Quote 0
        • D Offline
          dvonhausen
          last edited by

          Thanks - works perfectly.

          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