Calculations Reference - Migz93/3dq GitHub Wiki
3DQ uses a series of calculations to determine the cost of 3D printing jobs. This reference guide explains all the formulas used in the application.
The cost of filament used in a print is calculated based on the weight used and the price per kilogram:
filament_cost = (grams_used / 1000) * price_per_kg
Where:
-
grams_used
is the amount of filament used in grams -
price_per_kg
is the price of the filament per kilogram
For example, if you use 100g of filament that costs £25/kg:
filament_cost = (100 / 1000) * 25 = £2.50
Printer depreciation accounts for the gradual wear and tear on your printer over time:
depreciation_per_hour = (price + service_cost) / depreciation_time
depreciation_cost = print_time * depreciation_per_hour
Where:
-
price
is the purchase price of the printer -
service_cost
is the estimated maintenance costs over the printer's lifetime. 10% of the cost of the printer itself can be used as a rough average for service cost. -
depreciation_time
is the expected lifetime of the printer in hours -
print_time
is the duration of the print in hours
For example, if your printer cost £1099, with service costs at 10% of that (£109.90), and a 5000-hour lifetime, and your print takes 5 hours:
depreciation_per_hour = (1099 + 109.90) / 5000 = £0.24/hour
depreciation_cost = 5 * 0.24 = £1.20
Power cost accounts for the electricity used during printing:
power_cost = print_time * power_usage * electricity_cost_per_kwh / 1000
Where:
-
print_time
is the duration of the print in hours -
power_usage
is the printer's power consumption in watts -
electricity_cost_per_kwh
is the cost of electricity per kilowatt-hour - Division by 1000 converts watts to kilowatts
For example, if your printer uses 100W, electricity costs £0.2166/kWh, and your print takes 5 hours:
power_cost = 5 * 100 * 0.2166 / 1000 = £0.1083
Labour cost accounts for the time spent on design, preparation, post-processing, and other tasks:
total_minutes = design_minutes + preparation_minutes + post_processing_minutes + other_minutes
labour_cost = (total_minutes / 60) * labour_rate_per_hour
Where:
-
design_minutes
,preparation_minutes
,post_processing_minutes
, andother_minutes
are the time spent on each task -
labour_rate_per_hour
is the hourly rate for labor
For example, if you spend 30 minutes on design, 10 minutes on preparation, 15 minutes on post-processing, and your labor rate is £13/hour:
total_minutes = 30 + 10 + 15 + 0 = 55 minutes
labour_cost = (55 / 60) * 13 = £10.17
Hardware cost is simply the unit price multiplied by the quantity:
hardware_cost = unit_price * quantity
The total cost of a print job is calculated as follows:
# Per-unit costs
per_unit_subtotal = filament_cost + hardware_cost + power_cost + depreciation_cost + labour_cost
# Apply quantity
subtotal = per_unit_subtotal * quantity
# Apply markup, discount, and tax
markup = subtotal * (markup_percent / 100)
total_before_discount = subtotal + markup
discount = total_before_discount * (discount_percent / 100)
total_after_discount = total_before_discount - discount
tax = total_after_discount * (tax_rate / 100) # If tax rate > 0
final_total = total_after_discount + tax
Where:
-
markup_percent
is the percentage markup applied to the subtotal -
discount_percent
is the percentage discount applied to the total after markup -
tax_rate
is the percentage tax rate applied to the total after discount (if configured)
For example, with a per-unit subtotal of £20, quantity of 3, 75% markup, 10% discount, and 20% tax:
per_unit_subtotal = £20
subtotal = £20 * 3 = £60
markup = £60 * (75 / 100) = £45
total_before_discount = £60 + £45 = £105
discount = £105 * (10 / 100) = £10.50
total_after_discount = £105 - £10.50 = £94.50
tax = £94.50 * (20 / 100) = £18.90
final_total = £94.50 + £18.90 = £113.40