Getting Started with PTC Creo Web.Link

Simulation & CAD | 8 March 2017 | Team EACPDS

Share this

Many PTC Creo users may be surprised to discover that hidden in their Creo file directory, there are two powerful CAD automation tools just waiting to be utilized! Creo Web.Link and Creo J-Link are two API tools that are packaged with all Creo installs; no extra licensing necessary. Both tools provide a way to access and modify your CAD data from a custom User Interface (UI) or a webpage.

The question is, what benefits can you reap from these tools? Perhaps there are technical staff members that don’t know the Creo tool, but they want to generate drawing PDF’s by entering some dimensional and parameter information. Conceivably, customer orders could be retrieved from a database to drive CAD or generate a Point of Departure (PoD). There are many opportunities that may arise where a UI is more efficient than modifying your CAD data directly in Creo. Today, we’ll focus on Web.Link due to its relative simplicity compared to J-Link.

Web.Link utilizes Creo’s embedded browser to reach into your CAD session and touch almost every aspect of a model, assembly, or drawing. A user builds a webpage and connects to the CAD using the JavaScript API. One caveat of Web.Link is that a user MUST use the embedded browser, whereas with J-Link, the program you create can run asynchronously – meaning Creo does not have to be running to use it.

The full functionality of Web.Link is documented in your Creo install directory at ‘[datecode]Common Filesweblinkweblinkug.pdf.’ There is also a searchable API located in the same directory which provides more detailed information on all the available features. The documentation may be a bit overwhelming at first, but here are the basic steps.

Basic Steps of Getting Started with Creo Web.Link

  1. Create a web page with text input, buttons, and anything else that you may use to access or modify your CAD. For example, you may have some dimensions or parameters you may want to modify. You may want to run a macro (mapkey). Or, you may just want to display relevant model information.

    Figure 1
    Figure 1: Basic HTML page
  2. Use the JavaScript objects, classes, methods, etc. to connect everything to CAD.

    Figure 2
    Figure 2: JavaScript function that accesses CAD data and populates the webpage text boxes
  3.  Open the webpage in your Creo embedded browser and try it out! There are prepackaged examples for you to try in the Web.Link directory if you don’t want to jump in the deep end right away. There is also a ‘pfcUtils.js’ file that comes in handy for many of the Web.Link programs you’ll write. It’s a library of useful pre-built functions that many of the examples use.

    Figure 3
    Figure 3: Retrieving model and session information from Creo through the embedded browser

A couple of Items to Note:

  1. Be sure to read the section in the Web.Link User Guide that addresses browser security. Running javascript in an Internet Explorer (IE) browser session typically sets off red flags and you’ll have to configure your IE security to enable the ActiveX scripts. Alternatively, you can use the Mozilla browser, and use a few lines of code in your JavaScript (See Figure 2) to address it.
  2. There are a few configuration options that must be enabled to allow Creo Web.Link to access the CAD session. The relevant configuration options are:
    • WEB_ENABLE_JAVASCRIPT
    • WEB_LINK_FILE_READ
    • WEB_LINK_FILE_WRITE
    • WEB_LINK_PROE_READ
    • WEB_LINK_PROE_WRITE

Creo Web.Link is a simple tool that can make a huge difference in how your company interacts with its CAD data. I encourage you to skim through the Web.Link User Guide and try out some of the examples provided. If you have any questions about Web.Link, please direct them to the comment section. If you have any questions related to CAD Automation services provided by EAC, please contact us! If you need an extra copy of the PTC Creo Web.Link User Guide, click the image below to download.

PTC Creo WebLink User Guide

Categories