"MOVE / COPY" in the context menu

"MOVE / COPY" in the context menu

kandennti
Mentor Mentor
1,596 Views
5 Replies
Message 1 of 6

"MOVE / COPY" in the context menu

kandennti
Mentor
Mentor

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.

0 Likes
Accepted solutions (1)
1,597 Views
5 Replies
Replies (5)
Message 2 of 6

goyals
Autodesk
Autodesk

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
Mentor
Mentor

@goyals .

 

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

0 Likes
Message 4 of 6

kandennti
Mentor
Mentor

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 ...

0 Likes
Message 5 of 6

BrianEkins
Mentor
Mentor
Accepted solution

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
Mentor
Mentor

@BrianEkins .

 

Thank you very much.

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

0 Likes