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

Trying to retrieve face using ComponentInstance.glued_to

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 3 Posters 187 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.
  • L Offline
    lothcat
    last edited by 27 May 2011, 22:24

    I'm having some trouble. I'm trying to figure out which direction a window on my house is facing. I have the direction saved as an attribute in the face, rather than a group or component. The trouble seems to be with getting that face. I'm trying to use componentinstance.glued_to, but it's throwing a syntax error.

    Here's my snippet:

            if entity.typename == "ComponentInstance"
              cell_data.push(entity.definition.name)
    			if(entity.definition.name == "Window _1")
    				wall = entity.glued_to
    				if(wall.get_attribute("hathmore_attributes", "type") == "AGW"
    					cell_data.push(wall.get_attribute("agw_attributes", "direction_facing"))
    				else
    					cell_data.push('-')
    				end
    			end
    		else
              cell_data.push('-')
            end
    

    I feel like the problem is staring at me, I just can't seem to find it.

    Thank you in advance for whatever you can do to help.

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 27 May 2011, 22:31

      Exactly what does the error say?

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

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 28 May 2011, 00:42


        FYI: There is a missing ) in line 5 of the snippet.


        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • L Offline
          lothcat
          last edited by 28 May 2011, 02:15

          @dan rathbun said:


          FYI: There is a missing ) in line 5 of the snippet.


          D'oh! Thank you! I was so sure I was using this wrong that I didn't even look for actual coding errors.

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dan Rathbun
            last edited by 28 May 2011, 04:02

            @lothcat said:

            @dan rathbun said:


            FYI: There is a missing ) in line 5 of the snippet.


            D'oh! Thank you! I was so sure I was using this wrong that I didn't even look for actual coding errors.

            Usually the Ruby error tells you what line of the code that the error is in, and echos that erroneous line.
            Also it may print an extra line beneath the erroneous line with a caret symbol pointing at where it thinks the error is. Not always helpful, as it may just point at the end of the code line if the parser doesn't really know, for instance, where the missing ")" symbol should go.

            And.. a syntax error IS a coding error, most often missing delimiters, brackets, etc.

            I'm not here much anymore.

            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