ScriptSpot

Forum topic · General Scripting

Edit_Poly triangulation

By SamT · 2013-09-09

Description

Hi everybody,

I'm facing a problem, in order to build an Edit_Poly triangulation script( without Edit_mesh or Patch conversion) I would like to access to the faces triangulation by script (the diagonals of a face I can see by clicking on "Edit triangulation" on one of the Editable_Poly Modify panel's roll out).

Can somebody learn it to me ?

Thanx by advance.

Sam

Comments (3)

barigazy · 2013-09-09

Try this

p = convertToPoly(Plane isselected:on)
polyop.setFaceSelection p #{6..7, 10..11}
max modify mode
subobjectlevel = 4
p.toggleCommandMode #EditTriangulation

SamT · 2013-09-09

Thank you for your fast answer. In fact I don't want to toggle the edit mode by code but rather to obtain an array of indexes representing the vertices of diagonals. I continued to try some different solutions, but the only thing that worked is something like :


convertObjectToEditableMesh obj
if (classof obj == Editable_Mesh) do (
    print ( "Triangulating " + obj.name + " " + (classof obj) as string)
    if(obj.numverts > 0 ) do (
        local edges = meshop.getEdgesUsingVert obj  #{1..obj.numverts}
        meshop.autoEdge obj edges 0.0 type:#SetClear
    )
)
convertObjectToEditablePoly obj

But I would like not to convert my edit poly to edit_mesh then to convert it back to edit_poly