• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

[Solved] Need help with a simple one

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 3 Posters 188 Views 3 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.
  • P Offline
    Pixero
    last edited by Pixero 19 Jun 2009, 07:38

    How do I iterate through a selections definitions?
    The [0] is only the first in the selection. I need to get them all.

    sel.each {|e|
    # Ignore items in the selection that are not components. 
    		next if not (e.is_a? Sketchup;;ComponentInstance)   
    		behavior = model.definitions[0].behavior 
    		status = behavior.always_face_camera = false
    	}
    
    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 19 Jun 2009, 07:50

      sel.each {|**e**|
      Notice the e there that's the current entity from the selection.

      So change the code to behavior = e.definition.behavior

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

      1 Reply Last reply Reply Quote 0
      • P Offline
        Pixero
        last edited by 19 Jun 2009, 07:54

        Thanks. I tried that and was so close, I had an s to much in definitions.
        Simple it was.

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 19 Jun 2009, 09:22

          sel.each{|e|e.definition.behavior.always_face_camera=false if e.is_a?(Sketchup;;ComponentInstance)}
          

          as a one-liner

          TIG

          1 Reply Last reply Reply Quote 0
          • P Offline
            Pixero
            last edited by 19 Jun 2009, 15:46

            Even better. 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