Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

onExecute fired when moved project, I want to cancel processing

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Daisuke.Inokuma1
243 Views, 2 Replies

onExecute fired when moved project, I want to cancel processing

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,

Labels (2)
2 REPLIES 2
Message 2 of 3

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

 

Try setting cmd.isExecutedWhenPreEmpted = False

 

Message 3 of 3

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!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report