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: 

"MOVE / COPY" in the context menu

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
kandennti
549 Views, 5 Replies

"MOVE / COPY" in the context menu

Hi there,

 

Select "MOVE / COPY" in the context menu,
When you move the component, "Position" is displayed on the Toolbar Panel.

1.png

 

In the case of GUI, if you try to execute another command as it is, "Some components have been moved" dialog appears and the user decides the Capture Position? Continue? After selecting, a dialog will appear for the command.

2.png


If you use the API in the state after moving the component, different from the screen state, various information will be obtained in the canceled state. (I think this is because the movement has not been finalized)

 

Is it possible to call this "Some components have been moved" dialog with the API?
Or is there a way to forcefully fix the position?

 

I hope you will be able to provide the information.

5 REPLIES 5
Message 2 of 6
goyals
in reply to: kandennti

Move copy command is refactored recently but API is not updated yet to use this new behaviour. We will create a ticket to track this work.  Thanks.



Shyam Goyal
Sr. Software Dev. Manager
Message 3 of 6
kandennti
in reply to: goyals

@goyals .

 

Thank you very much.
The other day I realized that this is the reason why it is not processed properly.

Message 4 of 6
kandennti
in reply to: goyals

First of all, I decided to use the display of ToolbarPanel and give a warning to the user.

import adsk.core, adsk.fusion, traceback

def run(context):
    try:
        if isPositionUndetermined():
            msg = 'Undetermined'
        else:
            msg = 'Determination'

        ui = adsk.core.Application.get().userInterface
        ui.messageBox('Component Position ' + msg)

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

def isPositionUndetermined() -> bool:
    ui = adsk.core.Application.get().userInterface
    pnl = ui.allToolbarPanels.itemById('SnapshotPanel')
    return pnl.isVisible

There may be a better way ...

Message 5 of 6
BrianEkins
in reply to: kandennti

There is a very good way.  In your command created event handler, set the isPositionDependent property of the Command object that's passed in to True.  If the assembly has been moved and not saved with a snapshot, the dialog you showed above will be shown.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 6 of 6
kandennti
in reply to: BrianEkins

@BrianEkins .

 

Thank you very much.

This is what I was looking for. By incorporating it in CommandCreatedEventHandler, it will continue processing.
it is perfect.

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

Post to forums