[3ds max script] Reduce navigation mesh


Hi everyone!

As some 3D artists I’m newbie in max scripting but I really want to get more familiar with it. And need help. I’m not a native english speaking, so pardon for possible screw-ups.

The situation is that I have a navigation mesh imported from another software (which is actually triangulated plane with unique form) and for my interactive walkthrough I need to reduce outer borders of this mesh. I’m able to get the mesh border vertices with the code below
if $.name == “NavMesh” then
if ModifierList != undefined then deleteModifier $ $.modifiers[1]
convertTo $ Editable_Poly
subObjectLevel = 1
$.SetSelection #Vertex #{1…(getNumVerts($))}
polyop.weldVertsByThreshold $ #{1…(getNumVerts($))}
$.EditablePoly.ConvertSelection #Vertex #Border
$.EditablePoly.ConvertSelection #Border #Vertex

but the problem is that I don’t have to delete vertices causing deleting the only faces on thin areas (see image below)

And I’m stuck with this task. I hope my problem explanation is rather straightforward.

Could someone help me to find solution of this task?

Many thanks in advance!