General Rules for Pricing Scripts

All pricing scripts can be written with the JavaScript Programming Language.

You don’t need to be a programmer to understand how to build a pricing script.
Using and modifying the example scripts is actually quite simple.

 

There are four places in the software where pricing scripts can be used:

 

For all scrips the same principles apply:

  • Preset Variables are available to be used for pricing

  • Both Mathematical Expressions and JavaScript Functions can be used in the Pricing Script

  • The Last Line of the script must output the final price

General Examples to Understand Pricing Concepts

In the most general case, the total price consists of three independent parts: material costs, machine costs and additional costs, such as labour, platform preparation cost, and so on. Naively, the formula can be written as follows:

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

At the end of the formula, one needs to write the variable whose value should be returned. Typically, one ends the formula with price; written at the very bottom. If one want to check if the algorithm gives the correct value of other variables, e.g. of machine time, it is necessary to end the formula with the JS name of that variable (machineTime; in this case).

These are general examples to explain the basic concepts of algorithmic pricing.
The respective pages (linked above) have more specific and realistic examples of pricing scripts.

 

Example Pricing Scripts to Illustrate Concepts

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.

20.50 // default prototyping fee

 

Using Variables and Mathematical expressions

Each new variable must be defined with the keyword let. Then the variables can be used with normal arithmetic functions.

let a = 10 + 20; // addition let b = 30 - 5; // subtraction let c = 2 * 5; // multiplication let d = 10 / 2; // division let e = 10 ** 2 // exponentiation a + b + c + d + e; // last line contains final price


Pre-defined Variables from Model Analysis

Depending on the algorithm type (Materials, Post-Processing, Order Fees), there are different sets of variables available within the platform. Those variables will fill in use value pulled from the uploaded and analyzed 3D model.

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

Providing Conditions & Discounts

In order to offer competitive pricing, especially for larger orders or particular customer groups, the if/else functionality can adjust the price based on specific conditions. Additional support variables are available under User-based Pricing.

Accounting for Additional Costs

Additional costs that are generated by your business can also be accounted for, one of the most common being labor costs for preparing build platforms.

Sample Complete Pricing Formula for FDM