onExecute fired when moved project, I want to cancel processing

onExecute fired when moved project, I want to cancel processing

Daisuke.Inokuma1
Participant Participant
679 Views
2 Replies
Message 1 of 3

onExecute fired when moved project, I want to cancel processing

Daisuke.Inokuma1
Participant
Participant

I noticed onExecute event fired when I move a project with taking out command GUI.

 

When I pushed the OK button, I want to run [OK] processing.
When I movied project, I want to run [cancel] processing.

However, I think that I cannot distinguish me with the argument of onExecute.

 

eventArgs_when_[OK]pressed.pngeventArgs_when_moved_project.png

(The left image is OK pressed eventArgs, the right when moved project. I think same two)

 

class CommandCreatedHandler(adsk.core.CommandCreatedEventHandler):

    def __init__(self):
        super().__init__()

    def notify(self, args):
        cmd = adsk.core.Command.cast(args.command)

        onExecute = ExecuteHandler()
        cmd.execute.add(onExecute)
        _handlers.append(onExecute)

        # omit other code

class ExecuteHandler(adsk.core.CommandEventHandler):

    def __init__(self):
        super().__init__()

    def notify(self, args):
        eventArgs = adsk.core.CommandEventArgs.cast(args)  # <- Dump this

        # [OK] processing
        # omit other code

 

What should I do?

 

Regards,

0 Likes
Accepted solutions (1)
680 Views
2 Replies
Replies (2)
Message 2 of 3

thomasa88
Advocate
Advocate
Accepted solution

What do you mean by "move project"? Can you exemplify how you do this?

 

Try setting cmd.isExecutedWhenPreEmpted = False

 

0 Likes
Message 3 of 3

Daisuke.Inokuma1
Participant
Participant

Sorry to noisy word.
In other word, changing current project.

 

rapture_20200803154952.png

 

> Try setting cmd.isExecutedWhenPreEmpted = False

 

I tried it and solved it.


Thank you for your valuable answer!