<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get face(poly) by face(mesh) in Maxscript in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553809#M11644</link>
    <description>&lt;P&gt;That &lt;EM&gt;can&lt;/EM&gt; be mitigated by checking if the collected poly numberSet is bigger than one, getting the reverseEdge of the invisible edge, and by that the neighbor face, and intersecting with the neighbor candidate polys. Provided that the degree of the poly in question is bigger than three, that is... If not (very low chance of that, of course), this approach still won't work.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Nov 2017 18:31:28 GMT</pubDate>
    <dc:creator>Swordslayer</dc:creator>
    <dc:date>2017-11-17T18:31:28Z</dc:date>
    <item>
      <title>Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7552039#M11639</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having some trouble finding an elegant solution to what IMO should be a simple problem. I'm trying to find what face a face belongs to. The first face being a poly face (polygon), the second being mesh face (triangle). I guess I could lookup which of it's edges is invisible, find that edge in poly and see what polygon uses it, but it seems to me, there must be more straight forward solution to this. Given the fact that some operations returns mesh face even on editable poly, I assume this is a common problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;K.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 08:10:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7552039#M11639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-17T08:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553092#M11640</link>
      <description>&lt;P&gt;Depends, most of the time, you can get the matching poly by the three verts of the face, but there are cases where it will return two different results. If you plan on doing multiple such lookups per one mesh/poly, it's better to make a lookup table to give you the poly index at face index:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;fn getFacePolyTable obj =
(
	local index = 0
	local polyByFace = #()
	for poly = 1 to polyop.getNumFaces obj do
	(
		local numTris = polyop.getFaceDeg obj poly - 2
		for face = index + 1 to index + numTris do polyByFace[face] = poly
		index += numTris
	)
	return polyByFace
)&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Nov 2017 14:38:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553092#M11640</guid>
      <dc:creator>Swordslayer</dc:creator>
      <dc:date>2017-11-17T14:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553220#M11641</link>
      <description>&lt;P&gt;Hi Swordslayer,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the answer. Yeah, getting more than one result is surely a problem. The lookup table should work better, but I've actually found out, that once you convert from mesh to poly it converts the selection. Since I won't be working on highpoly meshes with the tool I'm making, it's a good enough solution for me.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 15:14:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553220#M11641</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-17T15:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553725#M11642</link>
      <description>&lt;P&gt;here is how to get a poly index of poly node by mesh tri index:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;fn getPolyByTri node tri = 
(
	vv = getface node.mesh tri
	pp0 = #{1..node.numfaces}
	
	for k=1 to 3 do
	(
		pp1 = #{}
		v = vv[k]
		for i=1 to node.getVertexFaceCount v do append pp1 (node.getVertexFace v i)
		pp0 *= pp1
	)
	for p in pp0 do return p
)&lt;/PRE&gt;
&lt;P&gt;there are several ways to optimize the code of course, but it's more to just show the algorithm&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 17:58:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553725#M11642</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2017-11-17T17:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553768#M11643</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1634609"&gt;@denisT.MaxDoctor&lt;/a&gt;&amp;nbsp;That will work most of the time, but not always, for example for the face right to the two selected edges:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2017-11-17 at 19.10.28.png" style="width: 367px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/427755i449E99897CEC83EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2017-11-17 at 19.10.28.png" alt="Screen Shot 2017-11-17 at 19.10.28.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will report poly 17 which is to the left of it (you can check in the attached scene). And this is a 'proper' quad-only mesh, happens even more often with imported meshes/booleans with large ngons.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 18:17:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553768#M11643</guid>
      <dc:creator>Swordslayer</dc:creator>
      <dc:date>2017-11-17T18:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553809#M11644</link>
      <description>&lt;P&gt;That &lt;EM&gt;can&lt;/EM&gt; be mitigated by checking if the collected poly numberSet is bigger than one, getting the reverseEdge of the invisible edge, and by that the neighbor face, and intersecting with the neighbor candidate polys. Provided that the degree of the poly in question is bigger than three, that is... If not (very low chance of that, of course), this approach still won't work.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 18:31:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7553809#M11644</guid>
      <dc:creator>Swordslayer</dc:creator>
      <dc:date>2017-11-17T18:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7554208#M11645</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;Swordslayer wrote:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1634609" target="_blank"&gt;@denisT.MaxDoctor&lt;/A&gt;&amp;nbsp;That will work most of the time, but not always, for example for the face right to the two selected edges:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes. You right. The code abode is a translation from my c++ code. It was very easy to fix using c++, but for mxs case&amp;nbsp;I need to think a little.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 21:05:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7554208#M11645</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2017-11-17T21:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7556618#M11646</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes. You right. The code abode is a translation from my c++ code. It was very easy to fix using c++, but for mxs case&amp;nbsp;I need to think a little.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Out of curiosity, what does the fixed c++ version look like, if you don't mind sharing?&lt;/P&gt;</description>
      <pubDate>Sun, 19 Nov 2017 18:04:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7556618#M11646</guid>
      <dc:creator>Swordslayer</dc:creator>
      <dc:date>2017-11-19T18:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7556799#M11647</link>
      <description>&lt;P&gt;# every vertex in MNMesh has list of faces those include this vertex (&lt;STRONG&gt;mesh-&amp;gt;vfac&lt;/STRONG&gt;)&lt;/P&gt;
&lt;P&gt;# MNFace has&amp;nbsp;&lt;STRONG&gt;GetTriangles&lt;/STRONG&gt; method which gives a list of corners in triangulation order&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# MNFace has a list of vertices in corners order (&lt;STRONG&gt;f-&amp;gt;vtx&lt;/STRONG&gt;) and we can make list of mesh vertex indexes&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;all that we need is to find a poly that contains sequence of tri vertices in this list..&lt;/P&gt;
&lt;P&gt;i'm using&amp;nbsp;&lt;STRONG&gt;&lt;SPAN class="pln"&gt;std&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;::&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;search&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Nov 2017 21:22:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7556799#M11647</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2017-11-19T21:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get face(poly) by face(mesh) in Maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7556892#M11648</link>
      <description>&lt;P&gt;the fastest mxs function to get poly by tri is slightly modified&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A id="link_7a3380a7a46ff9" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1275790" target="_self"&gt;Swordslayer&lt;/A&gt;'s method:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;fn getPolyFaceByTri node tri =
(
	local index = 1
	local poly = 0
	local getFaceDeg = polyop.getFaceDeg
	for k = 1 to polyop.getNumFaces node while poly == 0 do
	(
		index += getFaceDeg node k - 2
		if (tri &amp;lt; index) do poly = k
	)
	poly
)&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Nov 2017 23:08:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/get-face-poly-by-face-mesh-in-maxscript/m-p/7556892#M11648</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2017-11-19T23:08:41Z</dc:date>
    </item>
  </channel>
</rss>

