Difference between revisions of "TomDym"

From The Foundry MODO SDK wiki
Jump to: navigation, search
Line 33: Line 33:
 
ppaths = lxu.select.PresetPathSelection().current()
 
ppaths = lxu.select.PresetPathSelection().current()
 
print ppaths
 
print ppaths
 +
</pre>
 +
 +
=== View3dService Example ===
 +
 +
<pre>
 +
import modo, lx
 +
 +
viewSvc = lx.service.View3Dport()
 +
currentView = lx.object.View3D(viewSvc.View(viewSvc.Current()))
 +
 +
for i in range(viewSvc.Count()):
 +
    view = lx.object.View3D(viewSvc.View(i))
 +
 +
    print view.Matrix(0)
 +
    print view.Angles()
 +
    print view.Axis()
 +
    print view.EyeVector()
 +
    lx.out(view.WorkPlane())
 +
    a = view.To3D(150.0,150.0,2000)
 +
    a = view.Center()
 +
    a = view.WorkPlane()
 +
 
</pre>
 
</pre>

Revision as of 10:53, 24 October 2019

DoWhileUserIsIdle

//If you try to execute a script while holding down a modifier like ctrl or shift, it will postpone execution until you release the modifier
#python
import lx, lxifc
 
class visitor(lxifc.Visitor):                  
    def __init__(self):     # The initial setup method 
        pass
 
    def vis_Evaluate(self):                           
        lx.out("Visitor")
pSrv = lx.service.Platform()
vis = visitor()
com_visitor = lx.object.Unknown(vis)
pSrv.DoWhenUserIsIdle(com_visitor, lx.symbol.fUSERIDLE_MODIFIER_KEYS_UP)

//Too cancel it you need to pass exactly the same com object and flags
pSrv.CancelDoWhenUserIsIdle(com_visitor, lx.symbol.fUSERIDLE_MODIFIER_KEYS_UP )

Toggle Command

lx.eval('tool.set falloff.linear ?+')

Path of Selected Preset Item

#!python
ppaths = lxu.select.PresetPathSelection().current()
print ppaths

View3dService Example

import modo, lx

viewSvc = lx.service.View3Dport()
currentView = lx.object.View3D(viewSvc.View(viewSvc.Current()))

for i in range(viewSvc.Count()):
    view = lx.object.View3D(viewSvc.View(i))

    print view.Matrix(0)
    print view.Angles()
    print view.Axis()
    print view.EyeVector()
    lx.out(view.WorkPlane())
    a = view.To3D(150.0,150.0,2000)
    a = view.Center()
    a = view.WorkPlane()