Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update texts when Fusion 360 "Configuration" is changed #56

Closed
jmlg10 opened this issue Jul 25, 2023 · 10 comments
Closed

Update texts when Fusion 360 "Configuration" is changed #56

jmlg10 opened this issue Jul 25, 2023 · 10 comments
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@jmlg10
Copy link

jmlg10 commented Jul 25, 2023

Hello,

When editing a shape with "configurations" table...
it looks like the value of a parametric text don't regenerate.
the sketch needs to be re-edited , and the script re-invoked.
Is it by design?
I guess that the value was updated automatically some version before...

@jmlg10 jmlg10 added the bug Something isn't working label Jul 25, 2023
@thomasa88
Copy link
Owner

Hi, can you describe the process step by step? I don't fully understand what is going wrong.

@jmlg10
Copy link
Author

jmlg10 commented Jul 27, 2023 via email

@thomasa88
Copy link
Owner

Aha, I think I understand now. This seems to be a preview feature not available to hobbyists.

But we might be able to solve the problem anyway. ParametricText usually detect a change by noticing when a command in Fusion finishes. I expect this happens for configurations as well.

Please do as follows:
Edit ParametricText.py to print all finished commands (you can find the path in the Addins dialog) by uncommenting the print in command_terminated_handler:

def command_terminated_handler(args: adsk.core.ApplicationCommandEventArgs):
    print(f"{NAME} terminate: {args.commandId}, reason: {args.terminationReason}")
    if args.terminationReason != adsk.core.CommandTerminationReason.CompletedTerminationReason:
        return

https://github.com/thomasa88/ParametricText/blob/master/ParametricText.py#L1268C18-L1268C18

Reload the add-in.

Trigger the print outputs by opening the console (Ctrl+Alt+C ? ) in Fusion, selecting "Py" and writing "1" and pressing enter (any input will do).

Now open the configurations window, do a change and close it. Observe what is printed in the console.

Please paste the console output here.

@jmlg10
Copy link
Author

jmlg10 commented Jul 31, 2023 via email

@thomasa88
Copy link
Owner

I think DesignConfigurationActivateRowCmd, reason: 1 could be used to trigger an update of the texts. Does it seem like a good place or should the add-in wait until the configurations window is closed (if there is such a window)?

To test it out with DesignConfigurationActivateRowCmd update the following code

from

    if args.commandId in ['ChangeParameterCommand',
                          'SketchEditDimensionCmdDef']:
        # User (might have) changed a parameter
        update_texts_async()

to

    if args.commandId in ['ChangeParameterCommand',
                          'SketchEditDimensionCmdDef',
                          'DesignConfigurationActivateRowCmd']:  # Configuration changed
        # User (might have) changed a parameter
        update_texts_async()

And then reload the add-in.

@jmlg10
Copy link
Author

jmlg10 commented Aug 4, 2023 via email

@thomasa88 thomasa88 changed the title Updating value in last version of Fusion (V2.0.16753) Update texts when Fusion 360 "Configuration" is changed Aug 6, 2023
@thomasa88 thomasa88 added the enhancement New feature or request label Aug 6, 2023
@thomasa88 thomasa88 added this to the v2.3+ milestone Aug 6, 2023
@thomasa88
Copy link
Owner

Thanks for testing the code change. It should appear in the next version of ParametricText.

@jmlg10
Copy link
Author

jmlg10 commented Aug 6, 2023 via email

@thomasa88
Copy link
Owner

In release v2.3.1. Submitted to Autodesk for publication.

@jmlg10
Copy link
Author

jmlg10 commented Sep 16, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants