🏢 PlaceMaker | 25% off for February including new Google Earth data imports!
Learn more
[API] Edge.other_vertex unexpected return value
-
<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!
-
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. -
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.
-
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.
Advertisement