WebLink is one of the two free API's (JLink being the other) provided by PTC to create Pro/Engineer applications. According to PTC's documentation, WebLink is a Javascript based library for use within the embedded web browser.

That's sounds great, but it's about as accurate as describing a car as a pothole creator. Well, here in Detroit that's more true than not, especially on Van Dyke ... but I digress.

Truthfully, WebLink isn't really Javascript based at all. It's based on Microsoft's COM/ActiveX/OLE objects on Windows, and Mozilla's XP-COM on Unix. You don't even need to use Javascript. On Windows, you can use VBScript, Perl, Python, or any one of your favorite languages that can access COM objects.

Here's an example of using VBScript in a WebLink application:

<HTML><BODY> <SCRIPT type="text/vbscript"> function HitMe () dim mdlname Set pfccomglob = CreateObject("pfc.MpfcCOMGlobal") mdlname = pfccomglob.GetProESession.CurrentModel.FileName Document.getElementById("mdlname").innerHTML = "Name: " & mdlname msgbox("Name: " & mdlname) end function </SCRIPT> <form name="f"> <INPUT name="a" type=button value="Hit me!" onclick="HitMe()"> <div id="mdlname"></div> </form></BODY></HTML>To make matters worse, you don't even need to use the web browser! A Pro/Toolkit DLL can access the WebLink COM objects using C/C++ and can do so completely outside the confines of the web browser. The Pro/Toolkit DLL could also go as far as hosting your favorite scripting engine. The web browser is just one of many environments in which a WebLink application can run.

Here's the same example using Perl to access WebLink COM Objects from within a Pro/Toolkit DLL:

use Win32;use Win32::OLE;$pfccomglob = Win32::OLE->new('pfc.MpfcCOMGlobal');$mdlName = $pfccomglob->GetProESession->CurrentModel->FileName;Win32::MsgBox("Name: $mdlName");To summarize, WebLink requires neither Javascript nor a web browser. That clears things up, right? Why is it called "WebLink"? Well, you can use it in a web browser, and all PTC software has to have the word "Link", as a result: WebLink!

Can you imagine the response had they called it Pro/COM, or ActiveXLink, or COM.Link? A resounding "huh?" would have echoed through the halls on Kendrick Street. I think the marketing guys got it right this time.

Anyway, using whatever language in whatever environment you desire, the huge benefit to WebLink is that it's a rapid prototyping system for Pro/Engineer applications. The code-test-code-test cycle can be repeated as quickly as you can refresh the web browser. Whether you intend to migrate the application to JLink, or leave it in the web browser, you can get a complex application written very, very quickly. That's what makes WebLink very powerful.