Hi guys, I'm trying to find the normal of a face that i have selected in my model I thought something similar to this script shown below might do the trick but alas it hasn't. The ruby console says I have an undefined method e. With my limited ruby brain I though this might be helped by making e = [] or e = 0 which of course it did not. I have used similar script to this below for finding areas. Any help or advice is greatly appreciated. Thanks
<span class="syntaxdefault">model </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br />ents </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities<br />sel </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection<br />mat </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">sel</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">material </span><span class="syntaxcomment"># selected items with material we are interested in<br /></span><span class="syntaxdefault">normal_vector </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">0<br /></span><span class="syntaxcomment"># go through all the entities<br /></span><span class="syntaxdefault">ents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each </span><span class="syntaxkeyword">do |</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|<br />if </span><span class="syntaxdefault">e is_a</span><span class="syntaxkeyword">? </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Face </span><span class="syntaxcomment"># if e is a face<br /></span><span class="syntaxkeyword">if </span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">material</span><span class="syntaxkeyword">==</span><span class="syntaxdefault">mat </span><span class="syntaxcomment">#if e material is the material of the selected entity<br /><br /># normal equals initial normal vector plus the new normal vector<br />#this returns the normal of the selected face<br /></span><span class="syntaxdefault">normal_vector </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">normal_vector </span><span class="syntaxkeyword">+ </span><span class="syntaxdefault">face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">normal<br /><br />end </span><span class="syntaxcomment">#end if<br /></span><span class="syntaxdefault">end </span><span class="syntaxcomment">#end if<br /></span><span class="syntaxdefault">end </span><span class="syntaxcomment">#end loop<br /><br /></span><span class="syntaxdefault">puts normal_vector</span>