在網頁中嵌入 Autodesk Inventor View

應用程式開發介面 (API) 包含數個可在網頁中使用的性質與方法。

您可以使用 <參數> 標籤來設定性質,或者您可以利用腳本編寫語言 (例如 Visual Basic Script) 來使用 API 性質和方法。 您也可以利用 C++ 與 Visual Basic 等程式設計語言來使用 API 建立應用程式。

您可以使用 <物件> 標籤,在 HTML 檔中嵌入 Inventor View 並參考零件。您可以從網際網路或企業網路檢視零件。

註: 要求使用 Microsoft Internet Explorer 5.01 或更高版本。
  1. 像通常一樣建立一個 HTML 檔案。
  2. 使用 HTML <參數> 標籤設置控制。此動作設定自訂按鈕 (用於變更控制視窗大小的按鈕、變更顯示模式的按鈕,以及開啟檔案的按鈕) 的性質。
    註: 建議您使用 <參數> 標籤來設定性質,而不是將它們附加到 URL 或路徑。 在某些情況下,瀏覽器可能會移除附加的參數。
  3. 使用 <物件> 標籤的「classid」參數,在檔案中嵌入 Inventor View。HTML 檔案中必須使用以下內容:

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

  4. 設定 API 性質,以控制 Web 頁面中的檔案。
  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

5ViewerControl1.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>