Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example Pricing Scripts to Illustrate Concepts

Table of Contents
minLevel3

Constant Pricing

If a fee or part should be priced the same for all users and for all orders, that can be input a single number into the script. Examples might be a fixed processing cost, a handling fee or a fixed price for internal prototyping in your company.

...

Code Block
languagejs
let cost1 = model.volume * 0.0002; // model.volume in cubic mm
let cost2 = model.area * 0.02;     // model.area in square mm
let price = cost1 + cost2;
price;                             // last line contains final price

Comparison and Relational operators

Name

Syntax

Examples

Equality

x == y

1 == 1; true
0 == 1; false

Inequality

x != y

1 != 2; true
1 != 1; false

Greater than operator

x > y

4 > 3; true

Greater than or equal operator

x >= y

4 >= 3; true
3 >= 3; true

Less than operator

x < y

3 < 4; true

Less than or equal operator

x <= y

3 <= 4; true
3 <= 3; true

...

Variable

Description

Unit

Code Block
labour

Costs related to all work done by people when preparing the part for printing.

$ or €

Code Block
platformPreparationCost

Cost of preparing the printer (e.g. of warming up the powder bed).

$ or €

Sample Complete Pricing Formula for FDM

Code Block
languagejs
//material cost
let materialPrice = 80;
let materialDensity = 1.04;
let supportPrice = 80;
let supportDensity = 1.04;
let infill = 0.2;
let supportInfill = 0.2;
let wallThickness = 2;

let materialUsed = Math.max((model.volume - model.area*wallThickness)*infill, 0) +
Math.min(model.area*wallThickness, model.volume);

let totalMaterialPrice = (materialUsed*materialDensity*materialPrice +
support.volume*supportPrice*supportDensity*supportInfill)*0.000001;

// hourly rate
let priceOfMachine = 200000;
let usefulLife = 7;
let maintenance = 40000;
let powerConsumption = 10000;
let roomCost = 4000;
let space = 10;
let spareParts = 2000;
let gasUsage = 0;
let workingHoursPerYear = 3500;

let hourlyRate = ((priceOfMachine + maintenance)/usefulLife + powerConsumption +
roomCost*space + spareParts + gasUsage)/workingHoursPerYear;

// machine time
let lineWidth = 0.1;
let layerHeight = 0.1;
let speed = 45;
let wallThickness = 2;
let exponent;
if( model.volume < 3000){
        exponent = 0.55;
} else {
        exponent = 0.88;
}
let volumeFactor = 0.0010747;
let areaFactor = 0.04317783;
let supportFactor = 0.0003774;

let time = volumeFactor*(0.818182 - lineWidth)*(Math.pow(layerHeight, (-1.07)) +
0.232)*(Math.pow(speed, (-1.08)))*(Math.pow(infill*100, (1.02)))*model.volume +
areaFactor*(1.578431 - lineWidth)*(Math.pow(layerHeight, (-0.98)) + 0.341)*
(Math.pow(wallThickness, exponent) + 0.002)*(Math.pow(speed, (-0.84)) +
0.003)*model.area + supportFactor*supportInfill*support.volume;

let machineTime = time/60;

// other costs
let labour = 15;
let platformPreparationCost = 200;

let otherCosts = labour + platformPreparationCost/item.quantity;

// final unit price
let margin = 0.1;

let price = (totalMaterialPrice + hourlyRate*machineTime + otherCosts)*(1+margin);
price;