MENU

MAXScript: turn multiple diagonals

turndiagonals

TurnDiagonals.mcr in action

This is a short, helpful maxscript snippet I wrote a few months back.

turnfaces

3dsmax’s built in “turn” tool

Without a script like this, the Max UI only exposes a face’s Diagonal through the “Turn” and “edit triangulation” tools, both of which offer cumbersome, multi click interfaces to turn edges.

Often an artist will need to turn quads’ diagonals quickly, so I wrote this script to quickly and easily toggle the diagonal rotation of every currently selected face.

 

fn turnDiagonals =
(
    local exitcode
    if(classof (modPanel.getCurrentObject()) == Editable_Poly) then
    (
        selectedArray = (polyop.getFaceSelection $) as array
        if (selectedArray.count >= 1) then
        (    
            undo "turn selected faces" on
            (
                for f = 1 to selectedArray.count do
                (
                    -- Formula to get the number of diagonals --
                    diagCount = (polyop.getFaceEdges $ selectedArray[f]).count - 3
                    --Turn every diagonal in the face --
                    for d = 1 to diagCount do
                    (
                    $.TurnDiagonal selectedArray[f] d
                    )
                )
            )
            local exitcode = (selectedArray.count as string) + " Face(s) turned"
        )
        else (exitcode = "Please select one or more faces.")
        )
    else (exitcode = "Please select a single editable poly")
    print exitcode
)
turnDiagonals()

 

[HERE] is the script in .MCR format if you’d like to bind it to a hotkey or add it to your UI. It should show up under “Js_misc”.