thomasa88 / ParametricText

Fusion 360™ add-in for creating Text Parameters in sketches.
MIT License
83 stars 5 forks source link

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

Closed jmlg10 closed 1 year ago

jmlg10 commented 1 year ago

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

thomasa88 commented 1 year ago

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

jmlg10 commented 1 year ago

Hello,

I've an extrusion based on a sketch using your plug-in. I've a part using the new "configurations" feature of Fusion.

If I edit the part using this configuration, and if the parameter is the one edited by the plug-in the sketch don't update… And you have to active the configuration. Call the "parametric text" plugin to activate it and update the sketch.

You will find the part as attachment

Many Thanks

@.*** Cordialement / Best Regards

Jean-Michel LE GOFF | Responsable Recherches Numériques | Louis Vuitton Malletier – Direction Technique | 2, Rue du Pont-Neuf, 75001 Paris, France | Phone: +33 155803048 | Mobile : +33 664405492 | Email address: @.**@./>

De : Thomas Axelsson @.> Envoyé : jeudi 27 juillet 2023 10:10 À : thomasa88/ParametricText @.> Cc : Jean-Michel LE GOFF @.>; Author @.> Objet : Re: [thomasa88/ParametricText] Updating value in last version of Fusion (V2.0.16753) (Issue #56)

WARNING: This Message Is From an External Sender. Should you have any doubt, click on the report button in Outlook.


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

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/thomasa88/ParametricText/issues/56*issuecomment-1653111596__;Iw!!Lt0KOR8!U0fWNDMAnJ1zZ2MiDtXTkjo8mFm3KN0VW9yEzcmzVWUFY60NLq1xoDlpSFbYCIfREc5bDCU7gTbgtCZUHTXsaFpkoYg-uiLWOEQPMQ$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AICVIRWYHRYUZIXJCO7O5NDXSIO37ANCNFSM6AAAAAA2XCHUW4__;!!Lt0KOR8!U0fWNDMAnJ1zZ2MiDtXTkjo8mFm3KN0VW9yEzcmzVWUFY60NLq1xoDlpSFbYCIfREc5bDCU7gTbgtCZUHTXsaFpkoYg-uiL0YphEgQ$. You are receiving this because you authored the thread.Message ID: @.**@.>>

thomasa88 commented 1 year ago

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 commented 1 year ago

Hi,

Thanks for coming back to me.

I'm trying your debug workflow…

After switching configuration I get this:

ParametricText terminate: SelectCommand, reason: 4 ParametricText terminate: DesignConfigurationActivateRowCmd, reason: 1 1

Cordialement / Best Regards

Jean-Michel LE GOFF | Responsable Recherches Numériques | Louis Vuitton Malletier – Direction Technique | 2, Rue du Pont-Neuf, 75001 Paris, France | Phone: +33 155803048 | Mobile : +33 664405492 | Email address: @.**@./>

De : Thomas Axelsson @.> Envoyé : samedi 29 juillet 2023 07:50 À : thomasa88/ParametricText @.> Cc : Jean-Michel LE GOFF @.>; Author @.> Objet : Re: [thomasa88/ParametricText] Updating value in last version of Fusion (V2.0.16753) (Issue #56)

WARNING: This Message Is From an External Sender. Should you have any doubt, click on the report button in Outlook.


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-L1268C18https://urldefense.com/v3/__https:/github.com/thomasa88/ParametricText/blob/master/ParametricText.py*L1268C18-L1268C18__;Iw!!Lt0KOR8!X3j09MUu7UajuWNy8BdFReebvK47uFdM_cHX1SYnNCPqWw1_6zL_eP1Xa8aurdUoZJIuKQOSAP_qMVxau6cz4VhxQNHnFpYBro8SCw$

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.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/thomasa88/ParametricText/issues/56*issuecomment-1656566754__;Iw!!Lt0KOR8!X3j09MUu7UajuWNy8BdFReebvK47uFdM_cHX1SYnNCPqWw1_6zL_eP1Xa8aurdUoZJIuKQOSAP_qMVxau6cz4VhxQNHnFpYnitO-JQ$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AICVIRQ3CZZB3XIGU2OUF43XSSQBPANCNFSM6AAAAAA2XCHUW4__;!!Lt0KOR8!X3j09MUu7UajuWNy8BdFReebvK47uFdM_cHX1SYnNCPqWw1_6zL_eP1Xa8aurdUoZJIuKQOSAP_qMVxau6cz4VhxQNHnFpZQBnm8Gg$. You are receiving this because you authored the thread.Message ID: @.**@.>>

thomasa88 commented 1 year ago

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 commented 1 year ago

Hi Thomas,

Yes, it's working...

It take 1 or 2 seconds latency, but it update now… that's cool

Many thanks for your help,

Cordialement / Best Regards

Jean-Michel LE GOFF | Responsable Recherches Numériques | Louis Vuitton Malletier – Direction Technique | 2, Rue du Pont-Neuf, 75001 Paris, France | Phone: +33 155803048 | Mobile : +33 664405492 | Email address: @.**@./>

De : Thomas Axelsson @.> Envoyé : jeudi 3 août 2023 15:10 À : thomasa88/ParametricText @.> Cc : Jean-Michel LE GOFF @.>; Author @.> Objet : Re: [thomasa88/ParametricText] Updating value in last version of Fusion (V2.0.16753) (Issue #56)

WARNING: This Message Is From an External Sender. Should you have any doubt, click on the report button in Outlook.


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.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/thomasa88/ParametricText/issues/56*issuecomment-1663957831__;Iw!!Lt0KOR8!RQhmXN1028ZhbdpgB28vlvZeJWJOQBqmKO4qlcXIXRx94Dwf7SfGUsoy-8mLq4RFj5orntr7cajyq1_8zvbgicMMkepPnjLxuKO3Bg$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AICVIRVS2O2MS2HOKBT3NY3XTOPL5ANCNFSM6AAAAAA2XCHUW4__;!!Lt0KOR8!RQhmXN1028ZhbdpgB28vlvZeJWJOQBqmKO4qlcXIXRx94Dwf7SfGUsoy-8mLq4RFj5orntr7cajyq1_8zvbgicMMkepPnjLh3Yq-Ww$. You are receiving this because you authored the thread.Message ID: @.**@.>>

thomasa88 commented 1 year ago

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

jmlg10 commented 1 year ago

Ok,

That’s sounding good.

Many thanks

Cordialement

Jean-Michel LE GOFF | Responsable Recherches Numériques | Louis Vuitton Malletier |+33664405492

Le 6 août 2023 à 16:40, Thomas Axelsson @.***> a écrit :

 WARNING: This Message Is From an External Sender. Should you have any doubt, click on the report button in Outlook.


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

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/thomasa88/ParametricText/issues/56*issuecomment-1666882145__;Iw!!Lt0KOR8!QkWF5HIo2TcJeSuj0mEkgiW9QL2zTRqAZ0ay--p6r5kxyWkhZ4sXiv7LdvuWjZ64F6RySj5F5HZk28pFcHKKAMSfYfNRlpPysrKL7g$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AICVIRTY3CFVPKKINOJ2ZB3XT6UGDANCNFSM6AAAAAA2XCHUW4__;!!Lt0KOR8!QkWF5HIo2TcJeSuj0mEkgiW9QL2zTRqAZ0ay--p6r5kxyWkhZ4sXiv7LdvuWjZ64F6RySj5F5HZk28pFcHKKAMSfYfNRlpM2XO9rBw$. You are receiving this because you authored the thread.Message ID: @.***>

thomasa88 commented 1 year ago

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

jmlg10 commented 1 year ago

Many thanks

Cordialement

Jean-Michel LE GOFF | Responsable Recherches Numériques | Louis Vuitton Malletier |+33664405492


De : Thomas Axelsson @.> Envoyé : Saturday, September 16, 2023 10:33:51 AM À : thomasa88/ParametricText @.> Cc : Jean-Michel LE GOFF @.>; Author @.> Objet : Re: [thomasa88/ParametricText] Update texts when Fusion 360 "Configuration" is changed (Issue #56)

WARNING: This Message Is From an External Sender. Should you have any doubt, click on the report button in Outlook.


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

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/thomasa88/ParametricText/issues/56*issuecomment-1722177157__;Iw!!Lt0KOR8!S1oIMnPuIPGKp-0qLCI-BIHTuJ0Rk6xnggpri_ukGbQDgRbRAGJWxh9kkz9X0eFmcg_UUYhmsDsN7rCmFQpbk4er_T9W5I75eUoTcg$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AICVIRVLAEQFVXGFKZK2GZTX2VP67ANCNFSM6AAAAAA2XCHUW4__;!!Lt0KOR8!S1oIMnPuIPGKp-0qLCI-BIHTuJ0Rk6xnggpri_ukGbQDgRbRAGJWxh9kkz9X0eFmcg_UUYhmsDsN7rCmFQpbk4er_T9W5I73Cdjbqg$. You are receiving this because you authored the thread.Message ID: @.***>

AndireasB commented 4 months ago

Hi Thomas,

First of all, thank you very much for the add in! Your work is much appreciated! It adds a whole lot of functionality and is very useful!

I also work with configurations and parametric text is pretty useful in this case. When changing/activating different configurations in the GUI the text updates just fine. However, if I want to generate new configurations through the API the text doesn't update. Even activating the configurations with .activate(), wait for Fusion adsk.doEvents(), as well as refreshing the viewport with app.activeViewport.refresh() didn't help.

When I click through the API generated configurations the text updates fine. But I want to automate exporting each configuration with an individual text on it. And right now the parametric text doesn't update and all exported configurations show the same text.

Do you have an idea on how to fix this issue?

Thank you in advance for your investigation. Let me know if I can help you.