How to Automatically Add Dimensions Using Web.Link
Hi everyone,
I am new to Creo Web.Link and currently working on automating the process of adding dimensions to a drawing view. My goal is to:
Check if the current model is a drawing.
Allow the user to select a view in the drawing.
Retrieve model annotations (dimensions) from the selected view and display them.
I am trying to use the Web.Link API, but I am facing issues with retrieving and displaying the dimensions. Here’s the function I have so far:
function addDimension() {
if (pfcIsMozilla())
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
try {
var session = pfcGetProESession();
var drawing = session.CurrentModel;
if (drawing.Type !== pfcCreate("pfcModelType").MDL_DRAWING) {
alert("Current model is not a drawing.");
return;
}
alert("Drawing detected. Please select a view.");
// Allow user to select a view
var selectedView = drawing.SelectView("Select a view to retrieve dimensions:");
if (!selectedView) {
alert("No view selected.");
return;
}
alert("View selected: " + selectedView.Name);
// Retrieve dimensions from the selected view
var annotations = selectedView.ListAnnotations();
if (annotations.length === 0) {
alert("No annotations found in this view.");
return;
}
alert("Number of dimensions found: " + annotations.length);
// Display the annotations (for testing)
for (var i = 0; i < annotations.length; i++) {
alert("Annotation " + (i + 1) + ": " + annotations[i].Text);
}
} catch (error) {
alert("Error: " + error.message);
}
}
Issues I am Facing:
How can I retrieve and display dimensions properly?
Is there a way to automatically add dimensions if they don’t exist?
Am I missing any required Web.Link methods?

