27 lines
856 B
Go
27 lines
856 B
Go
package model
|
|
|
|
import "time"
|
|
|
|
// Plate describes a print bed with outer dimensions and margins on each side.
|
|
type Plate struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name,omitempty"`
|
|
WidthMM float64 `json:"width_mm"`
|
|
HeightMM float64 `json:"height_mm"`
|
|
MarginTop float64 `json:"margin_top_mm"`
|
|
MarginRight float64 `json:"margin_right_mm"`
|
|
MarginBottom float64 `json:"margin_bottom_mm"`
|
|
MarginLeft float64 `json:"margin_left_mm"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// PrintableWidth returns the usable width inside the margins.
|
|
func (p Plate) PrintableWidth() float64 {
|
|
return p.WidthMM - p.MarginLeft - p.MarginRight
|
|
}
|
|
|
|
// PrintableHeight returns the usable height inside the margins.
|
|
func (p Plate) PrintableHeight() float64 {
|
|
return p.HeightMM - p.MarginTop - p.MarginBottom
|
|
}
|