By Xiaodong Liang
One of our ADN customers reported an issue of ActiveX application in IE11. Finally she found the problem is: IE11 does not support VBS in standard mode. This MSDN discussion tells more.
So, in standard mode in IE11, you will need to swtich to Javascript. Like other ActiveX control, Navisworks control supports JS, too.
I wrote a small skeleton of control + JS. The sample applies to any version of IE. It can open a model, switch saved views and drive an animation. It uses the Redistrubitable control of 2015. Please replace the GUID to that of the control you have installed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<TITLE>
Autodesk Navisworks Redistributable ActiveX Control
</TITLE>
<STYLE TYPE="text/css">
p {
font-size : 18px ;
font-family : Verdana ;
}
tr.header {
background: black;
color: white;
}
tr.header td {
padding: 5px;
text-align: center;
font-size: 16pt;
font-weight: bold;
}
tr.footer {
background: black;
color: white;
}
tr.footer td {
padding: 5px;
font-size: 12pt;
text-align: center;
}
td.body {
text-align: center;
width: 586px;
height: 550px;
}
td.heading {
background: gray;
color: white;
text-align: center;
}
tr.buttons {
height: 2.5em;
}
tr.buttons td {
text-align: center;
}
</STYLE>
<script type="text/javascript">
function initializeViewer() {
//get viewer
var nwviewer = document.getElementById("NWControl01");
//open file
var btn_open = document.getElementById("btnOpen");
btn_open.onclick = function(){
nwviewer.src = "gatehouse.nwd";
}
//swtich to saved view1
var btn_view1 = document.getElementById("btnView1");
btn_view1.onclick = function(){
var state = nwviewer.state;
var savedviewscount = state.SavedViews().count;
if(savedviewscount >0 )
{
var first_savedview = state.SavedViews().Item(1);
if(first_savedview.Type == state.GetEnum("eSavedViewType_View") )
{
state.ApplyView(first_savedview);
}
}
}
//swtich to saved view2
var btn_view2 = document.getElementById("btnView2");
btn_view2.onclick = function(){
var state = nwviewer.state;
var savedviewscount = state.SavedViews().count;
if(savedviewscount >0 )
{
var second_savedview = state.SavedViews().Item(2);
if(second_savedview.Type == state.GetEnum("eSavedViewType_View") )
{
state.ApplyView(second_savedview);
}
}
}
//drive the animation1
var btn_animation = document.getElementById("btnAnmation");
btn_animation.onclick = function(){
var state = nwviewer.state;
var savedviewscount = state.SavedViews().count;
for(var i=1; i <= savedviewscount;i++ ){
var eachView = state.SavedViews().Item(i);
if(eachView.Type == state.GetEnum("eSavedViewType_Anim") )
{
state.CurrentAnimation = eachView;
var flags;
var xx = state.GetEnum("eCmd_Play");
NWControl01.AnimationCommand(xx);
break;
}
}
}
}
</script>
</HEAD>
<body onload="initializeViewer();">
<p align=center>
<table border="0" width="850">
<tr class="header">
<td colspan="3">Autodesk Navisworks ActiveX Control</td>
</tr>
<tr>
<td class="body" rowspan="21">
<OBJECT ID="NWControl01"
CLASSID="CLSID:BE3C084F-E049-44EF-968B-438F768906FB"
CODEBASE="..\..\..\bin\Navisworks ActiveX Redistributable x86 Setup.exe">
<PARAM NAME="_cx" VALUE="14000">
<PARAM NAME="_cy" VALUE="12000">
<PARAM NAME="SRC" VALUE="">
</OBJECT>
</td>
<td>
<input type=button STYLE="WIDTH:115" id="btnOpen" value="Open File">
<br />
<input type=button STYLE="WIDTH:115" id="Button2" value="View1">
<br />
<input type=button STYLE="WIDTH:115" id="Button3" value="View2" >
<br />
<input type=button STYLE="WIDTH:115" id="Button4" value="Animation" >
</td>
</tr>
</body>
</table>
</HTML>