Update texts when Fusion 360 "Configuration" is changed
Closed this issue · 11 comments
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...
Hi, can you describe the process step by step? I don't fully understand what is going wrong.
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.
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.
Thanks for testing the code change. It should appear in the next version of ParametricText.
In release v2.3.1. Submitted to Autodesk for publication.
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.