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: 

Fusion360 palette interaction

3 REPLIES 3
Reply
Message 1 of 4
akonovalenko
675 Views, 3 Replies

Fusion360 palette interaction

Hello everyone!

I have trying to develop Fuion360 add-in base on palette and this sample. I general my application should be able to send data from Fusion to the website, which is loaded in palette, and send data in opposite direction from website to Fuion360. 

But unfortunately I have encountered an issue of determining a moment of time when pallete finished initialization.
With out it any requests from JS code to Fusion360 fails with error

 

adsk.fusionSendData('send', data);
Uncaught ReferenceError: adsk is not defined
    at sendInfoToFusion (palette.html:20)

Screenshot_1.png

I was trying to wait for ADSK object initialization by simple JS script

 

 

window.onload = function () {
		var adskWaiter = setInterval(function () {
			console.log('wait for adsk object');
			if (window.adsk) {
				clearInterval(adskWaiter);
				adsk.fusionSendData('send', '{"arg1":"Sample argument 1","arg2":"Sample argument 2"}');
			};
		}, 500);
	}

And some times it works, but in most cases ADSK became available only after I opened devTools

Screenshot_2.pngScreenshot_3.png

 

Could anyone suggest how to force adsk object initialization, and catch moment when in finished?

PS: I have tested on Windows version of Fusioon360 build number 2.0.5103 with PalleteTest.zip


 

Tags (2)
3 REPLIES 3
Message 2 of 4
goyals
in reply to: akonovalenko

adsk object initialisation is done when url is loaded in palette so I think the time page is fully loaded in palette, it can be assumed adsk object is initialised. I tried the script attached with the query but did not notice any problem.



Shyam Goyal
Sr. Software Dev. Manager
Message 3 of 4
akonovalenko
in reply to: goyals

The script works on MAC version of Fusion and don't work on Windows version 😞

Message 4 of 4
goyals
in reply to: akonovalenko

Well a defect is already created on our side to track it. The one possible workaround is to load the URL again in the palette which can be done using property htmlFileURL. It is like refreshing the page. I understand it might not be right thing but just give a try in case it helps. Thanks



Shyam Goyal
Sr. Software Dev. Manager

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