Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Translate the entire conversation x

Listing Components FeatureIDs

FC_12816895
2-Explorer

Listing Components FeatureIDs

Hello PTC Community,

I hope this message finds you well.

I am working on a project where I need to generate a list of all components and datum planes via WebLink. The list should have three columns:

Column 1: Component name /Datum Plane name

Column 2: All available featureIDs for each component (I have attempted this with pwlMdlFeaturesGet but haven't been successful)

Column 3: Identification of whether it is a datum plane, prt, or asm

 

Here is my current code:

<script language="JavaScript">

try
{
  if (pfcIsMozilla())
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  
  wpwl = pfcGetScript ();
  document.pwl = wpwl;
  wpwlc = wpwl.GetPWLConstants ();
  document.pwlc = wpwlc;
  wpwlf = wpwl.GetPWLFeatureConstants ();
  document.pwlf = wpwlf;
}
catch (err)
{
  alert ("Exception caught: "+pfcGetExceptionType (err));
}


function WlModelGetBOM() {
    var table = document.getElementById("bomTable");
    table.innerHTML = ""; // Clear previous content
    
    var ret = document.pwl.pwlMdlCurrentGet();
    if (!ret) {
        alert("Error retrieving current model");
        return;
    }
    
    var modelNameExt = ret.MdlNameExt;

    var retDeps = document.pwl.pwlMdlDependenciesGet(modelNameExt);
    if (!retDeps.Status) {
        alert("pwlMdlDependenciesGet failed (" + retDeps.ErrorCode + ")");
        return;
    }

    // Create table header
    var headerRow = table.insertRow();
    var modelNameCell = headerRow.insertCell(0);
    modelNameCell.innerHTML = "<b>Model Name</b>";
    var FeatureIDCell = headerRow.insertCell(1);
    FeatureIDCell.innerHTML = "<b>Feature ID</b>";
    var FeatureCell = headerRow.insertCell(2);
    FeatureCell.innerHTML = "<b>Feature</b>";
    
    var models = [];
    for (var i = 0; i < retDeps.NumMdls; i++) {
        var modelName = retDeps.MdlNameExt.Item(i);
        var FeatureID = "FeatureID";
		var Feature = "Datum/ASM/PRT";


        models.push([modelName, FeatureID, Feature]);
    }

    // Sort models (by model name)
    models.sort(function(a, b) {
        return a[0].localeCompare(b[0]);
    });

    // Add models to table
    for (var i = 0; i < models.length; i++) {
        var row = table.insertRow();
        var cell1 = row.insertCell(0);
        var cell2 = row.insertCell(1);
		var cell3 = row.insertCell(2);
        cell1.innerHTML = models[i][0];
        cell2.innerHTML = models[i][1];
		cell3.innerHTML = models[i][2];
    }
}

</script>


I would greatly appreciate any guidance or suggestions on how to achieve this.

Thank you in advance for your support!

 

Best regards,

Fred

0 REPLIES 0
Announcements

Top Tags