blob: f3cbbd7fd04a5657ea60b72c0dc53993de85d85f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
//
// ParamModel.swift
// ShedCalc
//
// Created by Jacky Jack on 01/08/2026.
//
import Combine
import SwiftUI
import Observation
@Observable
class ParamModel {
var width: Double = 3.0
var height: Double = 1.0
var length: Double = 1.0
var beamSpace: Double = 0.6
var OSBSheetPrice: Double = 0.0
var timberBeamPrice: Double = 0.0
var timberLengthSize: Double = 2.4
var feltPrice: Double = 0.0
var feltWidth: Double = 1.0
var feltLength: Double = 10
var claddingPrice: Double = 0.1
var claddingLength: Double = 0.1
var claddingWidth: Double = 0.1
var claddingOverlap: Double = 0.1
func floorArea() -> Double {
return width*length
}
func roofArea() -> Double {
return width*length
}
func dimensions() -> SIMD3<Double> {
return [width,length,height]
}
func widthBeamNum() -> Int {
return Int(width/beamSpace) + 1
}
func lengthBeamNum() -> Int {
return Int(length/beamSpace) + 1
}
func setBeamSpace(_ bs: Double) {
self.beamSpace = bs
}
func totalWallBeams() -> Int {
return 2 * (widthBeamNum() + lengthBeamNum())
}
func totalWallBeamLength() -> Double {
return Double(totalWallBeams()) * self.height
}
func totalJoistBeamLength() -> Double {
return Double(widthBeamNum())*beamSpace
}
}
|