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

    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

      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
      • thomthomT Offline
        thomthom
        last edited by

        
        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

          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
          • thomthomT Offline
            thomthom
            last edited by

            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

              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
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement