Tech Tip: How to Build a Custom Table Using FeatureScript

preview_player
Показать описание
Onshape’s FeatureScript programming language gives you the power to create your own built-in features. In this Tech Tip, we will build a basic Custom Table using FeatureScript capabilities to list the part name, description, volume, and vendor for all the parts in a Part Studio – in just three steps!

FOLLOW US

#CAD #Onshape #Cloud #3DDesign
Рекомендации по теме
Комментарии
Автор

Can you build a table with Part Name, Length, Width, Thickness. A basic Cut List?

AlwaysHopeful
Автор

FeatureScript 2656;
import(path : "onshape/std/table.fs", version : "2656.0");

annotation { "Table Type Name" : "Part Info" }
export const partInfo = defineTable(function(context is Context, definition is map) returns Table
precondition
{
// Define the parameters of the table type
}
{
var columnDefinitions = [tableColumnDefinition("name", "Part Name")];


var rows = [];

for (var part in evaluateQuery(context, qAllModifiableSolidBodies()))
{

var partName = getProperty(context,
{
"entity" : part,
"propertyType" : PropertyType.NAME
});

}

rows = append(rows, tableRow ({"name" : partName }));
// Compute the table

return table("Part Information", columnDefinitions, rows);
});

Got an error that says, "Variable partName not found" in the 'rows = append...' line. Any help?

AlwaysHopeful
welcome to shbcf.ru