ScriptSpot

Forum topic · General Scripting

get polygon by triangle

By Knedlo · 2017-11-17

Description

Hi there,

I have a simple problem, but can't find a simple solution. MeshProjIntersect.ClosestFace returns mesh face (triangle). Now since I'm working with editable poly, I need a poly face (polygon). Any idea how can I get that?

Comments (1)

.

jahman · 2017-11-28

Mesh triangle consists of three verts.
Given three vert indexes we can get polyfaces related to each of these verts.
Then we simply check which face is related to all of these three.


mfIndex = 42
mfVerts = getface meshObj mfIndex
pfIndex = (polyop.getFacesUsingVert polyObj mfVerts[1]) * (polyop.getFacesUsingVert polyObj mfVerts[2]) * (polyop.getFacesUsingVert polyObj mfVerts[3])