将 Autodesk Inventor View 嵌入网页中的步骤

应用程序编程接口 (API) 包含一些可在网页中使用的特性和方法。

可以使用 <param> 标签设置特性,也可以通过脚本语言(例如,Visual Basic Script)使用 API 特性和方法。还可以通过 C++ 和 Visual Basic 等编程语言,使用 API 来创建应用程序。

可以使用 <object> 标签在 HTML 文件中嵌入 Inventor View 并在文件中参考零件。可以从 Internet 或企业内部网查看零件。

注: 必须具有 Microsoft Internet Explorer 5.01 或更高版本。
  1. 像平常一样创建 HTML 文件。
  2. 使用 HTML <param> 标签设置控件。这会设置一些特性,而这些特性将自定义一些按钮,用于更改控件窗口的大小和显示模式,以及用于打开文件。
    注: 建议您使用 <param> 标签设置特性,而不要将其附加到 URL 或路径。有时候,浏览器会删除附加的参数。
  3. 使用 <object> 标签的“classid”参数将 Inventor View 嵌入文件中。必须在该 HTML 文件中使用以下内容:

    <object classid="CLSID:A6336AB8-D3E1-489A-8186-EE40F2E027FE" id=ViewerControl1>

  4. 设置 API 特性,以便在网页中控制该文件。
  5. 在 HTML 页面中设置高度和宽度参数时,建议使用绝对值,而不要使用百分比。如果使用百分比,则在调整浏览器窗口的大小时,会导致文件的打印效果失真。

HTML 样例

<HTML>

<HEAD><TITLE>测试查看器控件</TITLE></HEAD>

<BODY>

<FORM ID="TestForm" LANGUAGE="VBScript">

<table style-class="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 border=1><tr><td>

<blockquote>

<BOLD>文件:</BOLD>

<input type="file" size="40" NAME="BrowseFile"></td></tr>

<tr><td align=right><INPUT NAME="OpenButton" TYPE="Button" VALUE="Open"></td></tr>

<tr><td><INPUT NAME="PerspectiveButton" TYPE="Button" Value ="Perspective">

<INPUT NAME="LargerButton" TYPE="Button" VALUE="Larger">

<INPUT NAME="SmallerButton" TYPE="Button" VALUE="Smaller"> <INPUT name="cbInteractive" value ="Interactive" type="CheckBox">交互</td></tr>

<tr><td><INPUT NAME="ShadedButton" TYPE="Radio">着色视图

<INPUT NAME="HiddenButton" TYPE="Radio">隐藏线

<INPUT NAME="WireframeButton" TYPE="Radio">线框</td></tr></table></blockquote>

</FORM>

<object classid="CLSID:A6336AB8-D3E1-489A-8186-EE40F2E027FE" id=ViewerControl1 width=400 height=300>

<param name="_Version" value=65536> <param name="_ExtentX" value=13229>

<param name="_ExtentY" value=7938> <param name="_StockProps" value=0>

</object>

<SCRIPT LANGUAGE="VBScript">

Sub PerspectiveButton_OnClick()

  Dim TheForm

  Set TheForm = Document.Forms("TestForm")

  If ViewerControl1.Perspective Then

    TheForm.PerspectiveButton.Value = "Orthographic"

    ViewerControl1.Perspective = False

  Else

    TheForm.PerspectiveButton.Value = "Perspective"

    ViewerControl1.Perspective = True

  End If

End Sub

Sub LargerButton_OnClick()

   ViewerControl1.Width = ViewerControl1.Width * 1.1

   ViewerControl1.Height = ViewerControl1.Height * 1.1

End Sub

Sub SmallerButton_OnClick()

   ViewerControl1.Width = ViewerControl1.Width * 0.9

   ViewerControl1.Height = ViewerControl1.Height * 0.9

End Sub

Sub OpenButton_OnClick()

   Dim TheForm

   Set TheForm = Document.Forms("TestForm")

   ViewerControl1.Filename = TheForm.BrowseFile.Value

   TheForm.ShadedButton.checked = true

   TheForm.cbInteractive.checked = true

End Sub

Sub ShadedButton_OnClick()

   Dim TheForm

   Set TheForm = Document.Forms("TestForm")

   TheForm.HiddenButton.checked = False

   TheForm.WireframeButton.checked = False

   ViewerControl1.DisplayMode = 8708

End Sub

Sub HiddenButton_OnClick()

   Dim TheForm

   Set TheForm = Document.Forms("TestForm")

   TheForm.ShadedButton.checked = False

   TheForm.WireframeButton.checked = False

   ViewerControl1.DisplayMode = 8707

End Sub

Sub WireframeButton_OnClick()

   Dim TheForm

   Set TheForm = Document.Forms("TestForm")

   TheForm.ShadedButton.checked = False

   TheForm.HiddenButton.checked = False

   ViewerControl1.DisplayMode = 8706

End Sub

Sub cbInteractive_OnClick()

   Dim TheForm

   Set TheForm = Document.Forms("TestForm")

   if TheForm.cbInteractive.checked = False then

     ViewerControl1.Interactive = false

   else

     ViewerControl1.Interactive = true

   end if

End Sub

</SCRIPT>

</BODY></HTML>