Python script toolReset.py for Modo is for resetting tools so you don’t have to manually zero out fields, options, and toolpipe.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# python
# toolReset, reset any active tool with one script. current active tool detected with lx.test
# some tools can be reset using the pipeline, others might need manual resetting of all values

# Modo check
# These all return 1 or 0 based on the first item in the list and if Modo is in that mode. For instance testPoly, first item is polygon if Modo is in Polygons then it will return 1.
testPoly = lx.eval ("select.typeFrom polygon;edge;vertex;item;pivot;center;ptag ?")
testEdge = lx.eval ("select.typeFrom edge;vertex;polygon;item;pivot;center;ptag ?")
testVert = lx.eval ("select.typeFrom vertex;edge;polygon;item;pivot;center;ptag ?")

testItem = lx.eval ("select.typeFrom item;pivot;center;edge;polygon;vertex;ptag ?")
testMat = lx.eval ("select.typeFrom ptag;item;pivot;center;edge;polygon;vertex ?")
testPivot = lx.eval ("select.typeFrom pivot;center;item;edge;polygon;vertex;ptag ?")
testCenter = lx.eval ("select.typeFrom center;pivot;item;edge;polygon;vertex;ptag ?")

if testPoly or testEdge or testVert == 1:
    mode = "modePoly"
elif testItem or testMat or testPivot or testCenter == 1:
    mode = "modeItem"

def resetMirror():
    lx.eval("tool.reset gen.mirror")   
    if mode == "modePoly":
        lx.eval("tool.reset effector.clone") # instead of using try/except, check the mode and run the right command
        lx.eval("tool.attr effector.clone flip true")
        lx.eval("tool.attr effector.clone merge true")
    elif mode == "modeItem":
        lx.eval("tool.reset effector.item")

def anotherTool():
    return # return not needed after method/function is setup with reset commands

# probably have to test for any tool that I want reset
if lx.test( "tool.set *.mirror on" ) == True:
    resetMirror()
    lx.out("Mirror tool reset")
# elif lx.test("other tools") == True:
    # anotherToolReset()
    # lx.out("Other Tool reset")
else:
    lx.out("No tool active, or tool isn't set up for reset. Check EW_toolReset")
    print ("No tool active, or tool isn't set up for reset. Check EW_toolReset")