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

    [API] Edge.other_vertex unexpected return value

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 59 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.
    • thomthomT Offline
      thomthom
      last edited by

      <span class="syntaxdefault"><br />edge1</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">vertices<br /></span><span class="syntaxcomment">#=> [#<Sketchup;;Vertex;0xef6b57c>, #<Sketchup;;Vertex;0xeef8ce8>]<br /><br /></span><span class="syntaxdefault">edge2</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">vertices<br /></span><span class="syntaxcomment">#=> [#<Sketchup;;Vertex;0xef3821c>, #<Sketchup;;Vertex;0xeea2eb0>]<br /><br /></span><span class="syntaxdefault">edge2</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">other_vertex</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> edge1</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start </span><span class="syntaxkeyword">)<br /></span><span class="syntaxcomment">#<Sketchup;;Vertex;0xef3821c><br /></span><span class="syntaxdefault"></span>
      

      😲

      No errors raised. Not even Nil returned.

      Beware!

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

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        Wait, what? I tihnk I'm mis-reading what you've written. It looks like the 3rd line of code edge2.other_vertex( edge1.start ) returned a vertex object #<Sketchup::Vertex:0xef3821c>, which is the expected behavior. ❓

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          Ahh, I see it now. you passed edge2 one of edge1's vertices, so it should not have found the partner to that vertex on edge2. Yikes! Good catch.

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Aye!

            If you are dealing with vertices, and you create a bug where you mix up your vertex references you might not notice it immediately as this method happily returns the first vertex in the edge which isn't the one pass in the argument. Garbage in - garbage out.

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

            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