Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Efficiently updating preview on changed input

1 REPLY 1
Reply
Message 1 of 2
m0d0
116 Views, 1 Reply

Efficiently updating preview on changed input

Hi everyone,

 

I am currently running into the following problem:

I am working on an addin where I am building up a model "incrementally" based on the state of the inputs.

However, based on the way the executePreview handler is working, I have to rebuild the whole model even if there is only a minor change due to changed input.

As parts of my model can have significantly complexity the executePreview event takes too much time to use the addin in a pleasant way since the whole model needs to be recreated every time.

To give an example which might make my problem a bit more understandable:

Assume an addin with N checkboxes, where each checkbox corresponds to a different and highly complex body being created.

If I now check one more checkbox I have to rebuild all the bodies of the previously selected checkboxes, although actually I would have to build only one more body.   

 

I am wondering if there is a more efficient way to preview the current state of the model without deleting it on every update.

Until now I only found a workaround calling the 

command.doExecute(False)

method from the input changed handler which, I guess, is not the intended use case for this method. The problem with this workaround is that it apparently crashes Fusion from time to time (due to different handlers being active on the same time ?).   

 

It would be nice to hear if anyone has a solution to this or if this can be seen as a limitation of the Fusion API.

 

Thanks 🙂

Labels (3)
1 REPLY 1
Message 2 of 2
kandennti
in reply to: m0d0

Hi @m0d0 .

 

Perhaps the executePreview event is all rolled back in the transaction processing.
Unfortunately, I can't think of a direct workaround.

 

I also created an add-in that took a long time to process creating a shape, but only showed the state of the process in progress during preview, and only what could be sized and imaged.

https://github.com/kantoku-code/Fusion360_Two-turn_Mobius_strip 


Perhaps I could use palettes and three.js to display them on a dialog, but it would be a lot of work, almost as much as creating another application.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report