-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.html
42 lines (41 loc) · 1.34 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo Palette</title>
</head>
<body>
<p id='p1'>Click the button below or use the "Send info to HTML" command in the ADD-INS panel.</p>
<button type='button' onclick='sendInfoToFusion()'>Click to send info to Fusion</button>
<br /><br />
<p id='message'>Send a Message from Fusion 360 here by clicking Fusion Palette Send Command</p>
<br /><br />
</body>
<script>
function sendInfoToFusion(){
var args = {
arg1 : "Sample argument 1",
arg2 : "Sample argument 2"
};
adsk.fusionSendData('send', JSON.stringify(args));
}
window.fusionJavaScriptHandler = {handle: function(action, data){
try {
if (action == 'send') {
// Update a paragraph with the data passed in.
document.getElementById('message').innerHTML = data;
}
else if (action == 'debugger') {
debugger;
}
else {
return 'Unexpected command type: ' + action;
}
} catch (e) {
console.log(e);
console.log('exception caught with command: ' + action + ', data: ' + data);
}
return 'OK';
}};
</script>
</html>