How to catch the end of the function swiftloop


#1

Hi everyone! Does anyone know how to catch the end of the function swiftloop (right mouse click)


#2

it all goes through the CommandModeCallback mechanism … As far as I know, it is not published for MXS (it may be in the most recent MAX versions (2020, 2021) but not documented).
So I don’t see a way to catch the command mode change event through pure MXS. With SDK it’s sure possible.


#3

To keep it simple you can use timer and on each tick check whether
windows.getChildHWND #max "Mouse Tool"
returns anything meaningful. But of course it works in English gui version only.
( anoher method to access status bar message:(dotNetClass "Autodesk.Max.GlobalInterface").Instance.coreinterface10.prompt )

otherwise you can check the ID of current command mode like this
for SwiftLoop it is 91169 (I guess this number is unique and corresponds to a single command mode)

g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
format "%\n" (g.coreinterface14.CommandMode.Id)

Also c# sdk provides Autodesk.Max.Plugins.CommandModeChangedCallback abstract class that you can derive from to catch the event