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

Help hiding groups and components from Ruby prompt.

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 2 Posters 680 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.
  • S Offline
    Skastafari
    last edited by 1 Mar 2016, 18:05

    I need to setup a method of hiding certain objects in my scene from ruby command. Said items might be groups or components. I would like to add a custom attribute named "HideThis" to all my models (groups/components) and give it a value either 0 or 1, 1 would be equal to hidden. I was thinking I could grep my active entities and check for HideThis=1, if true then .hidden=true... something like that. That is my idea, I could use some help with syntax/method making that happen. I have no idea as to how to access custom attribute values from ruby. Any direction would be appreciated. Thanks in advance.

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 1 Mar 2016, 18:16

      
      entity.set_attribute('MySection', 'HideThis', true)
      entity.get_attribute('MySection', 'HideThis', false)
      
      

      http://www.sketchup.com/intl/en/developer/docs/ourdoc/entity#get_attribute
      http://www.sketchup.com/intl/en/developer/docs/ourdoc/entity#set_attribute

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • S Offline
        Skastafari
        last edited by 1 Mar 2016, 22:08

        Thanks ThomThom,
        I am quickly realizing that messing with component attributes is a pain in the arse, especially dynamic ones. I will probably rethink this idea a bit.

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 1 Mar 2016, 22:25

          Oh, you where meaning dynamic component attributes?

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • S Offline
            Skastafari
            last edited by 2 Mar 2016, 16:58

            Heh, I opened that can of worms and closed it real quick. I went to an array from a list of model names to hide. I am much happier this way. Thanks 😄

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

            Advertisement