Question regarding preview and execute event handlers

Question regarding preview and execute event handlers

doge0161
Participant Participant
338 Views
2 Replies
Message 1 of 3

Question regarding preview and execute event handlers

doge0161
Participant
Participant

Hello. 

 

In my add-in, I'm using a preview event to create a simplified preview of the final result to reduce processing time. 

I know the isValidResult property allows Fusion to reuse the results of the preview event for the execute event, but I would like to use the execute event to build on the preview output to save effectively recalculating the entire preview and the additional operations done by the execute event.

 

I'm sure this is possible with a not-so-elegant mix of global variables and accessing items by IDs, but I'm wondering if there's a simpler or more accepted way of doing this.

 

Thank you very much.  

0 Likes
339 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor

There isn't any standard approach to this. I wouldn't try and re-use some of the preview for the final result and re-calculate it from scratch. I think that would simplify the code overall, and probably not cost that much. I think the user is more tolerant of the time taken when they click OK, than they are for a preview after each setting change in the command dialog.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3

doge0161
Participant
Participant

Thank you very much, Brian!

Just to clarify, would the correct method just be copying-and-pasting the preview code into the execute handler function?

0 Likes