Versions Compared

Key

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

...

Code Block
languagejs
let materialPrice = ;
let materialDensity = ;
let supportPrice = ;
let supportDensity = ;
let infill = ;
let supportInfill = ;
let wallThickness = ;

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;
Warning

Do To ensure a proper calculation, do not change the final two lines of code:

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;

...