@rulecad/frames 0.0.1 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/catalogue.mjs ADDED
@@ -0,0 +1,268 @@
1
+ // The rule sets @rulecad/frames reads, by name: every profile, slot family, slot nut, bought fitting, rail, V-wheel and eccentric spacer in @rulecad/rules (and the bearings the wheels run on), the rods, linear bearings, lead screws and nuts, couplers, motors and switches a rod guide and its drive read, the threads
2
+ // their bores tap to, the materials they name and the outlines the kit draws itself. Generated from the rules package (one import per set, so a bundler
3
+ // can see them): after adding a set there, add its line here. A test holds the two together.
4
+ import s_al6000_item from '@rulecad/rules/al6000-item.json' with { type: 'json' };
5
+ import s_al6005a_8020 from '@rulecad/rules/al6005a-8020.json' with { type: 'json' };
6
+ import s_al6060_rexroth from '@rulecad/rules/al6060-rexroth.json' with { type: 'json' };
7
+ import s_al6063_t5 from '@rulecad/rules/al6063-t5.json' with { type: 'json' };
8
+ import s_al6063_t66 from '@rulecad/rules/al6063-t66.json' with { type: 'json' };
9
+ import s_al6n01_t5 from '@rulecad/rules/al6n01-t5.json' with { type: 'json' };
10
+ import s_fitting_misumi_hmj5 from '@rulecad/rules/fitting-misumi-hmj5.json' with { type: 'json' };
11
+ import s_fitting_motedis_bracket_20_b6 from '@rulecad/rules/fitting-motedis-bracket-20-b6.json' with { type: 'json' };
12
+ import s_fitting_motedis_end_cap_20_b6 from '@rulecad/rules/fitting-motedis-end-cap-20-b6.json' with { type: 'json' };
13
+ import s_fitting_motedis_foot_m6_d19 from '@rulecad/rules/fitting-motedis-foot-m6-d19.json' with { type: 'json' };
14
+ import s_fitting_motedis_hinge_20 from '@rulecad/rules/fitting-motedis-hinge-20.json' with { type: 'json' };
15
+ import s_fitting_motedis_inner_20_b6 from '@rulecad/rules/fitting-motedis-inner-20-b6.json' with { type: 'json' };
16
+ import s_fitting_motedis_plate_t_20 from '@rulecad/rules/fitting-motedis-plate-t-20.json' with { type: 'json' };
17
+ import s_m10 from '@rulecad/rules/m10.json' with { type: 'json' };
18
+ import s_m12 from '@rulecad/rules/m12.json' with { type: 'json' };
19
+ import s_m1_6 from '@rulecad/rules/m1_6.json' with { type: 'json' };
20
+ import s_m2 from '@rulecad/rules/m2.json' with { type: 'json' };
21
+ import s_m2_5 from '@rulecad/rules/m2_5.json' with { type: 'json' };
22
+ import s_m3 from '@rulecad/rules/m3.json' with { type: 'json' };
23
+ import s_m4 from '@rulecad/rules/m4.json' with { type: 'json' };
24
+ import s_m5 from '@rulecad/rules/m5.json' with { type: 'json' };
25
+ import s_m6 from '@rulecad/rules/m6.json' with { type: 'json' };
26
+ import s_m8 from '@rulecad/rules/m8.json' with { type: 'json' };
27
+ import s_rail_mgn7 from '@rulecad/rules/rail-mgn7.json' with { type: 'json' };
28
+ import s_rail_mgn9 from '@rulecad/rules/rail-mgn9.json' with { type: 'json' };
29
+ import s_rail_mgn12 from '@rulecad/rules/rail-mgn12.json' with { type: 'json' };
30
+ import s_rail_mgn15 from '@rulecad/rules/rail-mgn15.json' with { type: 'json' };
31
+ import s_v_wheel_solid from '@rulecad/rules/v-wheel-solid.json' with { type: 'json' };
32
+ import s_v_wheel_mini from '@rulecad/rules/v-wheel-mini.json' with { type: 'json' };
33
+ import s_eccentric_6_openbuilds from '@rulecad/rules/eccentric-6-openbuilds.json' with { type: 'json' };
34
+ import s_eccentric_mini_6_openbuilds from '@rulecad/rules/eccentric-mini-6-openbuilds.json' with { type: 'json' };
35
+ import s_bearing_625 from '@rulecad/rules/bearing-625.json' with { type: 'json' };
36
+ import s_bearing_mr105 from '@rulecad/rules/bearing-mr105.json' with { type: 'json' };
37
+ import s_profile_1010_8020 from '@rulecad/rules/profile-1010-8020.json' with { type: 'json' };
38
+ import s_profile_1010_makerbeam from '@rulecad/rules/profile-1010-makerbeam.json' with { type: 'json' };
39
+ import s_profile_1020_8020 from '@rulecad/rules/profile-1020-8020.json' with { type: 'json' };
40
+ import s_profile_1515_8020 from '@rulecad/rules/profile-1515-8020.json' with { type: 'json' };
41
+ import s_profile_1515_makerbeam_xl from '@rulecad/rules/profile-1515-makerbeam-xl.json' with { type: 'json' };
42
+ import s_profile_1515_openbeam from '@rulecad/rules/profile-1515-openbeam.json' with { type: 'json' };
43
+ import s_profile_1530_8020 from '@rulecad/rules/profile-1530-8020.json' with { type: 'json' };
44
+ import s_profile_2020_bosch from '@rulecad/rules/profile-2020-bosch.json' with { type: 'json' };
45
+ import s_profile_2020_generic from '@rulecad/rules/profile-2020-generic.json' with { type: 'json' };
46
+ import s_profile_2020_item_5 from '@rulecad/rules/profile-2020-item-5.json' with { type: 'json' };
47
+ import s_profile_2020_misumi_hfs5 from '@rulecad/rules/profile-2020-misumi-hfs5.json' with { type: 'json' };
48
+ import s_profile_2020_motedis_b6 from '@rulecad/rules/profile-2020-motedis-b6.json' with { type: 'json' };
49
+ import s_profile_2020_motedis_i5 from '@rulecad/rules/profile-2020-motedis-i5.json' with { type: 'json' };
50
+ import s_profile_2020_openbuilds from '@rulecad/rules/profile-2020-openbuilds.json' with { type: 'json' };
51
+ import s_profile_2040_bosch from '@rulecad/rules/profile-2040-bosch.json' with { type: 'json' };
52
+ import s_profile_2040_generic from '@rulecad/rules/profile-2040-generic.json' with { type: 'json' };
53
+ import s_profile_2040_item_5 from '@rulecad/rules/profile-2040-item-5.json' with { type: 'json' };
54
+ import s_profile_2040_misumi_hfs5 from '@rulecad/rules/profile-2040-misumi-hfs5.json' with { type: 'json' };
55
+ import s_profile_2040_motedis_i5 from '@rulecad/rules/profile-2040-motedis-i5.json' with { type: 'json' };
56
+ import s_profile_2040_openbuilds from '@rulecad/rules/profile-2040-openbuilds.json' with { type: 'json' };
57
+ import s_profile_2060_misumi_hfs5 from '@rulecad/rules/profile-2060-misumi-hfs5.json' with { type: 'json' };
58
+ import s_profile_2060_openbuilds from '@rulecad/rules/profile-2060-openbuilds.json' with { type: 'json' };
59
+ import s_profile_2080_misumi_hfs5 from '@rulecad/rules/profile-2080-misumi-hfs5.json' with { type: 'json' };
60
+ import s_profile_2080_openbuilds from '@rulecad/rules/profile-2080-openbuilds.json' with { type: 'json' };
61
+ import s_profile_3030_bosch from '@rulecad/rules/profile-3030-bosch.json' with { type: 'json' };
62
+ import s_profile_3030_generic from '@rulecad/rules/profile-3030-generic.json' with { type: 'json' };
63
+ import s_profile_3030_item_6 from '@rulecad/rules/profile-3030-item-6.json' with { type: 'json' };
64
+ import s_profile_3030_item_6l from '@rulecad/rules/profile-3030-item-6l.json' with { type: 'json' };
65
+ import s_profile_3030_misumi_hfs6 from '@rulecad/rules/profile-3030-misumi-hfs6.json' with { type: 'json' };
66
+ import s_profile_3030_motedis_i6 from '@rulecad/rules/profile-3030-motedis-i6.json' with { type: 'json' };
67
+ import s_profile_3060_bosch from '@rulecad/rules/profile-3060-bosch.json' with { type: 'json' };
68
+ import s_profile_3060_item_6 from '@rulecad/rules/profile-3060-item-6.json' with { type: 'json' };
69
+ import s_profile_3060_item_6l from '@rulecad/rules/profile-3060-item-6l.json' with { type: 'json' };
70
+ import s_profile_3060_misumi_hfs6 from '@rulecad/rules/profile-3060-misumi-hfs6.json' with { type: 'json' };
71
+ import s_profile_4040_bosch_l from '@rulecad/rules/profile-4040-bosch-l.json' with { type: 'json' };
72
+ import s_profile_4040_generic from '@rulecad/rules/profile-4040-generic.json' with { type: 'json' };
73
+ import s_profile_4040_item_8 from '@rulecad/rules/profile-4040-item-8.json' with { type: 'json' };
74
+ import s_profile_4040_item_8l from '@rulecad/rules/profile-4040-item-8l.json' with { type: 'json' };
75
+ import s_profile_4040_misumi_hfs8 from '@rulecad/rules/profile-4040-misumi-hfs8.json' with { type: 'json' };
76
+ import s_profile_4040_motedis_b10 from '@rulecad/rules/profile-4040-motedis-b10.json' with { type: 'json' };
77
+ import s_profile_4040_motedis_i8 from '@rulecad/rules/profile-4040-motedis-i8.json' with { type: 'json' };
78
+ import s_profile_4080_bosch_l from '@rulecad/rules/profile-4080-bosch-l.json' with { type: 'json' };
79
+ import s_profile_4080_item_8 from '@rulecad/rules/profile-4080-item-8.json' with { type: 'json' };
80
+ import s_profile_4080_item_8l from '@rulecad/rules/profile-4080-item-8l.json' with { type: 'json' };
81
+ import s_profile_4080_misumi_hfs8 from '@rulecad/rules/profile-4080-misumi-hfs8.json' with { type: 'json' };
82
+ import s_profile_4080_motedis_i8 from '@rulecad/rules/profile-4080-motedis-i8.json' with { type: 'json' };
83
+ import s_profile_4080_openbuilds_cbeam from '@rulecad/rules/profile-4080-openbuilds-cbeam.json' with { type: 'json' };
84
+ import s_profile_4545_bosch_l from '@rulecad/rules/profile-4545-bosch-l.json' with { type: 'json' };
85
+ import s_profile_4545_misumi_hfs8 from '@rulecad/rules/profile-4545-misumi-hfs8.json' with { type: 'json' };
86
+ import s_profile_4590_misumi_hfs8 from '@rulecad/rules/profile-4590-misumi-hfs8.json' with { type: 'json' };
87
+ import s_profile_angle_al_25x25x3 from '@rulecad/rules/profile-angle-al-25x25x3.json' with { type: 'json' };
88
+ import s_profile_angle_steel_30x30x3 from '@rulecad/rules/profile-angle-steel-30x30x3.json' with { type: 'json' };
89
+ import s_profile_angle from '@rulecad/rules/profile-angle.json' with { type: 'json' };
90
+ import s_profile_bar_al_25x5 from '@rulecad/rules/profile-bar-al-25x5.json' with { type: 'json' };
91
+ import s_profile_bar_steel_30x5 from '@rulecad/rules/profile-bar-steel-30x5.json' with { type: 'json' };
92
+ import s_profile_bar from '@rulecad/rules/profile-bar.json' with { type: 'json' };
93
+ import s_profile_channel_al_30x20x2 from '@rulecad/rules/profile-channel-al-30x20x2.json' with { type: 'json' };
94
+ import s_profile_channel from '@rulecad/rules/profile-channel.json' with { type: 'json' };
95
+ import s_profile_custom from '@rulecad/rules/profile-custom.json' with { type: 'json' };
96
+ import s_profile_round_bar_al_10 from '@rulecad/rules/profile-round-bar-al-10.json' with { type: 'json' };
97
+ import s_profile_round_bar_steel_10 from '@rulecad/rules/profile-round-bar-steel-10.json' with { type: 'json' };
98
+ import s_profile_round_bar from '@rulecad/rules/profile-round-bar.json' with { type: 'json' };
99
+ import s_profile_round_tube_al_25x2 from '@rulecad/rules/profile-round-tube-al-25x2.json' with { type: 'json' };
100
+ import s_profile_round_tube_steel_25x2 from '@rulecad/rules/profile-round-tube-steel-25x2.json' with { type: 'json' };
101
+ import s_profile_round_tube from '@rulecad/rules/profile-round-tube.json' with { type: 'json' };
102
+ import s_profile_tube_al_20x20x2 from '@rulecad/rules/profile-tube-al-20x20x2.json' with { type: 'json' };
103
+ import s_profile_tube_al_25x25x2 from '@rulecad/rules/profile-tube-al-25x25x2.json' with { type: 'json' };
104
+ import s_profile_tube_al_40x20x2 from '@rulecad/rules/profile-tube-al-40x20x2.json' with { type: 'json' };
105
+ import s_profile_tube_steel_25x25x2 from '@rulecad/rules/profile-tube-steel-25x25x2.json' with { type: 'json' };
106
+ import s_profile_tube_steel_40x40x2 from '@rulecad/rules/profile-tube-steel-40x40x2.json' with { type: 'json' };
107
+ import s_profile_tube from '@rulecad/rules/profile-tube.json' with { type: 'json' };
108
+ import s_s275 from '@rulecad/rules/s275.json' with { type: 'json' };
109
+ import s_slot_10_bosch_45l from '@rulecad/rules/slot-10-bosch-45l.json' with { type: 'json' };
110
+ import s_slot_10_bosch from '@rulecad/rules/slot-10-bosch.json' with { type: 'json' };
111
+ import s_slot_10_misumi_45 from '@rulecad/rules/slot-10-misumi-45.json' with { type: 'json' };
112
+ import s_slot_10_misumi from '@rulecad/rules/slot-10-misumi.json' with { type: 'json' };
113
+ import s_slot_10_motedis from '@rulecad/rules/slot-10-motedis.json' with { type: 'json' };
114
+ import s_slot_10 from '@rulecad/rules/slot-10.json' with { type: 'json' };
115
+ import s_slot_3_makerbeam_xl from '@rulecad/rules/slot-3-makerbeam-xl.json' with { type: 'json' };
116
+ import s_slot_3_makerbeam from '@rulecad/rules/slot-3-makerbeam.json' with { type: 'json' };
117
+ import s_slot_3_openbeam from '@rulecad/rules/slot-3-openbeam.json' with { type: 'json' };
118
+ import s_slot_5_item from '@rulecad/rules/slot-5-item.json' with { type: 'json' };
119
+ import s_slot_5_motedis from '@rulecad/rules/slot-5-motedis.json' with { type: 'json' };
120
+ import s_slot_6_8020 from '@rulecad/rules/slot-6-8020.json' with { type: 'json' };
121
+ import s_slot_6_bosch from '@rulecad/rules/slot-6-bosch.json' with { type: 'json' };
122
+ import s_slot_6_item_light from '@rulecad/rules/slot-6-item-light.json' with { type: 'json' };
123
+ import s_slot_6_item from '@rulecad/rules/slot-6-item.json' with { type: 'json' };
124
+ import s_slot_6_misumi from '@rulecad/rules/slot-6-misumi.json' with { type: 'json' };
125
+ import s_slot_6_motedis_i from '@rulecad/rules/slot-6-motedis-i.json' with { type: 'json' };
126
+ import s_slot_6_motedis from '@rulecad/rules/slot-6-motedis.json' with { type: 'json' };
127
+ import s_slot_6_openbuilds from '@rulecad/rules/slot-6-openbuilds.json' with { type: 'json' };
128
+ import s_slot_6 from '@rulecad/rules/slot-6.json' with { type: 'json' };
129
+ import s_slot_8_8020 from '@rulecad/rules/slot-8-8020.json' with { type: 'json' };
130
+ import s_slot_8_bosch from '@rulecad/rules/slot-8-bosch.json' with { type: 'json' };
131
+ import s_slot_8_i from '@rulecad/rules/slot-8-i.json' with { type: 'json' };
132
+ import s_slot_8_item_light from '@rulecad/rules/slot-8-item-light.json' with { type: 'json' };
133
+ import s_slot_8_item from '@rulecad/rules/slot-8-item.json' with { type: 'json' };
134
+ import s_slot_8_misumi from '@rulecad/rules/slot-8-misumi.json' with { type: 'json' };
135
+ import s_slot_8_motedis_i from '@rulecad/rules/slot-8-motedis-i.json' with { type: 'json' };
136
+ import s_slot_8 from '@rulecad/rules/slot-8.json' with { type: 'json' };
137
+ import s_slot_nut_6_bosch_m3_roll_in from '@rulecad/rules/slot-nut-6-bosch-m3-roll-in.json' with { type: 'json' };
138
+ import s_slot_nut_6_bosch_m4_drop_in from '@rulecad/rules/slot-nut-6-bosch-m4-drop-in.json' with { type: 'json' };
139
+ import s_slot_nut_6_bosch_m4_roll_in from '@rulecad/rules/slot-nut-6-bosch-m4-roll-in.json' with { type: 'json' };
140
+ import s_slot_nut_6_bosch_m4_slide_in from '@rulecad/rules/slot-nut-6-bosch-m4-slide-in.json' with { type: 'json' };
141
+ import s_slot_nut_6_bosch_m5_roll_in from '@rulecad/rules/slot-nut-6-bosch-m5-roll-in.json' with { type: 'json' };
142
+ import s_slot_nut_6_bosch_m5_slide_in from '@rulecad/rules/slot-nut-6-bosch-m5-slide-in.json' with { type: 'json' };
143
+ import s_slot_nut_6_misumi_m3_drop_in from '@rulecad/rules/slot-nut-6-misumi-m3-drop-in.json' with { type: 'json' };
144
+ import s_slot_nut_6_misumi_m3_roll_in from '@rulecad/rules/slot-nut-6-misumi-m3-roll-in.json' with { type: 'json' };
145
+ import s_slot_nut_6_misumi_m3_slide_in from '@rulecad/rules/slot-nut-6-misumi-m3-slide-in.json' with { type: 'json' };
146
+ import s_slot_nut_6_misumi_m3_square from '@rulecad/rules/slot-nut-6-misumi-m3-square.json' with { type: 'json' };
147
+ import s_slot_nut_6_misumi_m4_drop_in from '@rulecad/rules/slot-nut-6-misumi-m4-drop-in.json' with { type: 'json' };
148
+ import s_slot_nut_6_misumi_m4_roll_in from '@rulecad/rules/slot-nut-6-misumi-m4-roll-in.json' with { type: 'json' };
149
+ import s_slot_nut_6_misumi_m4_slide_in from '@rulecad/rules/slot-nut-6-misumi-m4-slide-in.json' with { type: 'json' };
150
+ import s_slot_nut_6_misumi_m4_square from '@rulecad/rules/slot-nut-6-misumi-m4-square.json' with { type: 'json' };
151
+ import s_slot_nut_6_misumi_m5_roll_in from '@rulecad/rules/slot-nut-6-misumi-m5-roll-in.json' with { type: 'json' };
152
+ import s_slot_nut_6_misumi_m5_slide_in from '@rulecad/rules/slot-nut-6-misumi-m5-slide-in.json' with { type: 'json' };
153
+ import s_slot_nut_6_misumi_m5_square from '@rulecad/rules/slot-nut-6-misumi-m5-square.json' with { type: 'json' };
154
+ import s_slot_nut_6_motedis_m4_hammer from '@rulecad/rules/slot-nut-6-motedis-m4-hammer.json' with { type: 'json' };
155
+ import s_slot_nut_6_motedis_m5_hammer from '@rulecad/rules/slot-nut-6-motedis-m5-hammer.json' with { type: 'json' };
156
+ import s_slot_nut_6_motedis_m5_slide_in from '@rulecad/rules/slot-nut-6-motedis-m5-slide-in.json' with { type: 'json' };
157
+ import s_slot_nut_6_motedis_m5_square from '@rulecad/rules/slot-nut-6-motedis-m5-square.json' with { type: 'json' };
158
+ import s_slot_nut_6_openbuilds_m5_drop_in from '@rulecad/rules/slot-nut-6-openbuilds-m5-drop-in.json' with { type: 'json' };
159
+ import s_slot_nut_8_bosch_m4_drop_in from '@rulecad/rules/slot-nut-8-bosch-m4-drop-in.json' with { type: 'json' };
160
+ import s_slot_nut_8_bosch_m4_roll_in from '@rulecad/rules/slot-nut-8-bosch-m4-roll-in.json' with { type: 'json' };
161
+ import s_slot_nut_8_bosch_m4_slide_in from '@rulecad/rules/slot-nut-8-bosch-m4-slide-in.json' with { type: 'json' };
162
+ import s_slot_nut_8_bosch_m5_drop_in from '@rulecad/rules/slot-nut-8-bosch-m5-drop-in.json' with { type: 'json' };
163
+ import s_slot_nut_8_bosch_m5_roll_in from '@rulecad/rules/slot-nut-8-bosch-m5-roll-in.json' with { type: 'json' };
164
+ import s_slot_nut_8_bosch_m5_slide_in from '@rulecad/rules/slot-nut-8-bosch-m5-slide-in.json' with { type: 'json' };
165
+ import s_slot_nut_8_bosch_m6_drop_in from '@rulecad/rules/slot-nut-8-bosch-m6-drop-in.json' with { type: 'json' };
166
+ import s_slot_nut_8_bosch_m6_roll_in from '@rulecad/rules/slot-nut-8-bosch-m6-roll-in.json' with { type: 'json' };
167
+ import s_slot_nut_8_bosch_m6_slide_in from '@rulecad/rules/slot-nut-8-bosch-m6-slide-in.json' with { type: 'json' };
168
+ import s_slot_nut_8_bosch_m6_t_bolt from '@rulecad/rules/slot-nut-8-bosch-m6-t-bolt.json' with { type: 'json' };
169
+ import s_slot_nut_8_bosch_m8_roll_in from '@rulecad/rules/slot-nut-8-bosch-m8-roll-in.json' with { type: 'json' };
170
+ import s_slot_nut_8_bosch_m8_slide_in from '@rulecad/rules/slot-nut-8-bosch-m8-slide-in.json' with { type: 'json' };
171
+ import s_slot_nut_8_i_motedis_m4_hammer from '@rulecad/rules/slot-nut-8-i-motedis-m4-hammer.json' with { type: 'json' };
172
+ import s_slot_nut_8_i_motedis_m4_roll_in from '@rulecad/rules/slot-nut-8-i-motedis-m4-roll-in.json' with { type: 'json' };
173
+ import s_slot_nut_8_i_motedis_m5_hammer from '@rulecad/rules/slot-nut-8-i-motedis-m5-hammer.json' with { type: 'json' };
174
+ import s_slot_nut_8_i_motedis_m5_roll_in from '@rulecad/rules/slot-nut-8-i-motedis-m5-roll-in.json' with { type: 'json' };
175
+ import s_slot_nut_8_i_motedis_m6_hammer from '@rulecad/rules/slot-nut-8-i-motedis-m6-hammer.json' with { type: 'json' };
176
+ import s_slot_nut_8_i_motedis_m6_roll_in from '@rulecad/rules/slot-nut-8-i-motedis-m6-roll-in.json' with { type: 'json' };
177
+ import s_slot_nut_8_i_motedis_m8_roll_in from '@rulecad/rules/slot-nut-8-i-motedis-m8-roll-in.json' with { type: 'json' };
178
+ import s_slot_nut_8_misumi_m3_drop_in from '@rulecad/rules/slot-nut-8-misumi-m3-drop-in.json' with { type: 'json' };
179
+ import s_slot_nut_8_misumi_m3_roll_in from '@rulecad/rules/slot-nut-8-misumi-m3-roll-in.json' with { type: 'json' };
180
+ import s_slot_nut_8_misumi_m3_slide_in from '@rulecad/rules/slot-nut-8-misumi-m3-slide-in.json' with { type: 'json' };
181
+ import s_slot_nut_8_misumi_m4_drop_in from '@rulecad/rules/slot-nut-8-misumi-m4-drop-in.json' with { type: 'json' };
182
+ import s_slot_nut_8_misumi_m4_roll_in from '@rulecad/rules/slot-nut-8-misumi-m4-roll-in.json' with { type: 'json' };
183
+ import s_slot_nut_8_misumi_m4_slide_in from '@rulecad/rules/slot-nut-8-misumi-m4-slide-in.json' with { type: 'json' };
184
+ import s_slot_nut_8_misumi_m4_square from '@rulecad/rules/slot-nut-8-misumi-m4-square.json' with { type: 'json' };
185
+ import s_slot_nut_8_misumi_m5_drop_in from '@rulecad/rules/slot-nut-8-misumi-m5-drop-in.json' with { type: 'json' };
186
+ import s_slot_nut_8_misumi_m5_roll_in from '@rulecad/rules/slot-nut-8-misumi-m5-roll-in.json' with { type: 'json' };
187
+ import s_slot_nut_8_misumi_m5_slide_in from '@rulecad/rules/slot-nut-8-misumi-m5-slide-in.json' with { type: 'json' };
188
+ import s_slot_nut_8_misumi_m5_square from '@rulecad/rules/slot-nut-8-misumi-m5-square.json' with { type: 'json' };
189
+ import s_slot_nut_8_misumi_m6_drop_in from '@rulecad/rules/slot-nut-8-misumi-m6-drop-in.json' with { type: 'json' };
190
+ import s_slot_nut_8_misumi_m6_roll_in from '@rulecad/rules/slot-nut-8-misumi-m6-roll-in.json' with { type: 'json' };
191
+ import s_slot_nut_8_misumi_m6_slide_in from '@rulecad/rules/slot-nut-8-misumi-m6-slide-in.json' with { type: 'json' };
192
+ import s_slot_nut_8_misumi_m6_square from '@rulecad/rules/slot-nut-8-misumi-m6-square.json' with { type: 'json' };
193
+ import s_slot_nut_8_motedis_m4_hammer from '@rulecad/rules/slot-nut-8-motedis-m4-hammer.json' with { type: 'json' };
194
+ import s_slot_nut_8_motedis_m4_roll_in from '@rulecad/rules/slot-nut-8-motedis-m4-roll-in.json' with { type: 'json' };
195
+ import s_slot_nut_8_motedis_m5_hammer from '@rulecad/rules/slot-nut-8-motedis-m5-hammer.json' with { type: 'json' };
196
+ import s_slot_nut_8_motedis_m5_roll_in from '@rulecad/rules/slot-nut-8-motedis-m5-roll-in.json' with { type: 'json' };
197
+ import s_slot_nut_8_motedis_m6_hammer from '@rulecad/rules/slot-nut-8-motedis-m6-hammer.json' with { type: 'json' };
198
+ import s_slot_nut_8_motedis_m6_roll_in from '@rulecad/rules/slot-nut-8-motedis-m6-roll-in.json' with { type: 'json' };
199
+ import s_slot_nut_8_motedis_m8_roll_in from '@rulecad/rules/slot-nut-8-motedis-m8-roll-in.json' with { type: 'json' };
200
+ import s_unc_10_24 from '@rulecad/rules/unc_10_24.json' with { type: 'json' };
201
+ import s_unc_1_4_20 from '@rulecad/rules/unc_1_4_20.json' with { type: 'json' };
202
+ import s_unc_3_8_16 from '@rulecad/rules/unc_3_8_16.json' with { type: 'json' };
203
+ import s_unc_4_40 from '@rulecad/rules/unc_4_40.json' with { type: 'json' };
204
+ import s_unc_5_16_18 from '@rulecad/rules/unc_5_16_18.json' with { type: 'json' };
205
+ import s_unc_6_32 from '@rulecad/rules/unc_6_32.json' with { type: 'json' };
206
+ import s_unc_8_32 from '@rulecad/rules/unc_8_32.json' with { type: 'json' };
207
+ import s_unf_10_32 from '@rulecad/rules/unf_10_32.json' with { type: 'json' };
208
+ import s_rod_8 from '@rulecad/rules/rod-8.json' with { type: 'json' };
209
+ import s_lm8uu from '@rulecad/rules/lm8uu.json' with { type: 'json' };
210
+ import s_lm8luu from '@rulecad/rules/lm8luu.json' with { type: 'json' };
211
+ import s_t8_nut from '@rulecad/rules/t8-nut.json' with { type: 'json' };
212
+ import s_t8_screw from '@rulecad/rules/t8-screw.json' with { type: 'json' };
213
+ import s_bearing_608 from '@rulecad/rules/bearing-608.json' with { type: 'json' };
214
+ import s_coupler_5_8 from '@rulecad/rules/coupler-5-8.json' with { type: 'json' };
215
+ import s_endstop_10t85 from '@rulecad/rules/endstop-10t85.json' with { type: 'json' };
216
+ import s_28byj48 from '@rulecad/rules/28byj48.json' with { type: 'json' };
217
+ import s_nema14 from '@rulecad/rules/nema14.json' with { type: 'json' };
218
+ import s_nema17 from '@rulecad/rules/nema17.json' with { type: 'json' };
219
+ import o_profile_custom from '@rulecad/rules/outlines/profile-custom.json' with { type: 'json' };
220
+ import vocabulary from '@rulecad/rules/vocabulary.json' with { type: 'json' };
221
+
222
+ /** The names a profile, a slot and a slot nut are written in: the fields of vocabulary.json. @type {Record<string, { unit?: string, choice?: string[], list?: boolean, says: string }>} */
223
+ export const FIELDS = vocabulary.fields;
224
+ /** Every rule set frames knows, by its name. @type {Record<string, { name: string, part?: string, rules: Record<string, any> }>} */
225
+ export const SETS = Object.fromEntries([
226
+ s_al6000_item, s_al6005a_8020, s_fitting_misumi_hmj5, s_fitting_motedis_bracket_20_b6, s_fitting_motedis_end_cap_20_b6, s_fitting_motedis_foot_m6_d19, s_fitting_motedis_hinge_20, s_fitting_motedis_inner_20_b6, s_fitting_motedis_plate_t_20,
227
+ s_al6060_rexroth, s_al6063_t5, s_al6063_t66, s_al6n01_t5, s_m10, s_m12,
228
+ s_m1_6, s_m2, s_m2_5, s_m3, s_m4, s_m5, s_m6, s_m8, s_profile_1010_8020, s_profile_1010_makerbeam, s_profile_1020_8020,
229
+ s_profile_1515_8020, s_profile_1515_makerbeam_xl, s_profile_1515_openbeam, s_profile_1530_8020, s_profile_2020_bosch,
230
+ s_profile_2020_generic, s_profile_2020_item_5, s_profile_2020_misumi_hfs5, s_profile_2020_motedis_b6,
231
+ s_profile_2020_motedis_i5, s_profile_2020_openbuilds, s_profile_2040_bosch, s_profile_2040_generic, s_profile_2040_item_5,
232
+ s_profile_2040_misumi_hfs5, s_profile_2040_motedis_i5, s_profile_2040_openbuilds, s_profile_2060_misumi_hfs5,
233
+ s_profile_2060_openbuilds, s_profile_2080_misumi_hfs5, s_profile_2080_openbuilds, s_profile_3030_bosch,
234
+ s_profile_3030_generic, s_profile_3030_item_6, s_profile_3030_item_6l, s_profile_3030_misumi_hfs6, s_profile_3030_motedis_i6,
235
+ s_profile_3060_bosch, s_profile_3060_item_6, s_profile_3060_item_6l, s_profile_3060_misumi_hfs6, s_profile_4040_bosch_l,
236
+ s_profile_4040_generic, s_profile_4040_item_8, s_profile_4040_item_8l, s_profile_4040_misumi_hfs8, s_profile_4040_motedis_b10,
237
+ s_profile_4040_motedis_i8, s_profile_4080_bosch_l, s_profile_4080_item_8, s_profile_4080_item_8l, s_profile_4080_misumi_hfs8,
238
+ s_profile_4080_motedis_i8, s_profile_4080_openbuilds_cbeam, s_profile_4545_bosch_l, s_profile_4545_misumi_hfs8,
239
+ s_profile_4590_misumi_hfs8, s_profile_angle_al_25x25x3, s_profile_angle_steel_30x30x3, s_profile_angle,
240
+ s_profile_bar_al_25x5, s_profile_bar_steel_30x5, s_profile_bar, s_profile_channel_al_30x20x2, s_profile_channel,
241
+ s_profile_custom, s_profile_round_bar_al_10, s_profile_round_bar_steel_10, s_profile_round_bar, s_profile_round_tube_al_25x2,
242
+ s_profile_round_tube_steel_25x2, s_profile_round_tube, s_profile_tube_al_20x20x2, s_profile_tube_al_25x25x2,
243
+ s_profile_tube_al_40x20x2, s_profile_tube_steel_25x25x2, s_profile_tube_steel_40x40x2, s_profile_tube,
244
+ s_rail_mgn7, s_rail_mgn9, s_rail_mgn12, s_rail_mgn15, s_v_wheel_solid, s_v_wheel_mini, s_eccentric_6_openbuilds, s_eccentric_mini_6_openbuilds, s_bearing_625, s_bearing_mr105, s_rod_8, s_lm8uu, s_lm8luu, s_t8_nut, s_t8_screw, s_bearing_608, s_coupler_5_8, s_endstop_10t85, s_28byj48, s_nema14, s_nema17, s_s275, s_slot_10_bosch_45l, s_slot_10_bosch, s_slot_10_misumi_45, s_slot_10_misumi, s_slot_10_motedis,
245
+ s_slot_10, s_slot_3_makerbeam_xl, s_slot_3_makerbeam, s_slot_3_openbeam, s_slot_5_item, s_slot_5_motedis,
246
+ s_slot_6_8020, s_slot_6_bosch, s_slot_6_item_light, s_slot_6_item, s_slot_6_misumi, s_slot_6_motedis_i,
247
+ s_slot_6_motedis, s_slot_6_openbuilds, s_slot_6, s_slot_8_8020, s_slot_8_bosch, s_slot_8_i, s_slot_8_item_light,
248
+ s_slot_8_item, s_slot_8_misumi, s_slot_8_motedis_i, s_slot_8, s_slot_nut_6_bosch_m3_roll_in, s_slot_nut_6_bosch_m4_drop_in,
249
+ s_slot_nut_6_bosch_m4_roll_in, s_slot_nut_6_bosch_m4_slide_in, s_slot_nut_6_bosch_m5_roll_in, s_slot_nut_6_bosch_m5_slide_in,
250
+ s_slot_nut_6_misumi_m3_drop_in, s_slot_nut_6_misumi_m3_roll_in, s_slot_nut_6_misumi_m3_slide_in, s_slot_nut_6_misumi_m3_square,
251
+ s_slot_nut_6_misumi_m4_drop_in, s_slot_nut_6_misumi_m4_roll_in, s_slot_nut_6_misumi_m4_slide_in, s_slot_nut_6_misumi_m4_square,
252
+ s_slot_nut_6_misumi_m5_roll_in, s_slot_nut_6_misumi_m5_slide_in, s_slot_nut_6_misumi_m5_square, s_slot_nut_6_motedis_m4_hammer,
253
+ s_slot_nut_6_motedis_m5_hammer, s_slot_nut_6_motedis_m5_slide_in, s_slot_nut_6_motedis_m5_square, s_slot_nut_6_openbuilds_m5_drop_in,
254
+ s_slot_nut_8_bosch_m4_drop_in, s_slot_nut_8_bosch_m4_roll_in, s_slot_nut_8_bosch_m4_slide_in, s_slot_nut_8_bosch_m5_drop_in,
255
+ s_slot_nut_8_bosch_m5_roll_in, s_slot_nut_8_bosch_m5_slide_in, s_slot_nut_8_bosch_m6_drop_in, s_slot_nut_8_bosch_m6_roll_in,
256
+ s_slot_nut_8_bosch_m6_slide_in, s_slot_nut_8_bosch_m6_t_bolt, s_slot_nut_8_bosch_m8_roll_in, s_slot_nut_8_bosch_m8_slide_in,
257
+ s_slot_nut_8_i_motedis_m4_hammer, s_slot_nut_8_i_motedis_m4_roll_in, s_slot_nut_8_i_motedis_m5_hammer,
258
+ s_slot_nut_8_i_motedis_m5_roll_in, s_slot_nut_8_i_motedis_m6_hammer, s_slot_nut_8_i_motedis_m6_roll_in,
259
+ s_slot_nut_8_i_motedis_m8_roll_in, s_slot_nut_8_misumi_m3_drop_in, s_slot_nut_8_misumi_m3_roll_in, s_slot_nut_8_misumi_m3_slide_in,
260
+ s_slot_nut_8_misumi_m4_drop_in, s_slot_nut_8_misumi_m4_roll_in, s_slot_nut_8_misumi_m4_slide_in, s_slot_nut_8_misumi_m4_square,
261
+ s_slot_nut_8_misumi_m5_drop_in, s_slot_nut_8_misumi_m5_roll_in, s_slot_nut_8_misumi_m5_slide_in, s_slot_nut_8_misumi_m5_square,
262
+ s_slot_nut_8_misumi_m6_drop_in, s_slot_nut_8_misumi_m6_roll_in, s_slot_nut_8_misumi_m6_slide_in, s_slot_nut_8_misumi_m6_square,
263
+ s_slot_nut_8_motedis_m4_hammer, s_slot_nut_8_motedis_m4_roll_in, s_slot_nut_8_motedis_m5_hammer, s_slot_nut_8_motedis_m5_roll_in,
264
+ s_slot_nut_8_motedis_m6_hammer, s_slot_nut_8_motedis_m6_roll_in, s_slot_nut_8_motedis_m8_roll_in, s_unc_10_24,
265
+ s_unc_1_4_20, s_unc_3_8_16, s_unc_4_40, s_unc_5_16_18, s_unc_6_32, s_unc_8_32, s_unf_10_32
266
+ ].map((s) => [s.name, s]));
267
+ /** The kit's own outlines, by the name of the set each belongs to (rules/outlines/<name>.json). @type {Record<string, { name?: string, source: string, licence: string, loops: number[][][] }>} */
268
+ export const OUTLINES = { "profile-custom": o_profile_custom };
package/cutlist.d.mts ADDED
@@ -0,0 +1,88 @@
1
+ /**
2
+ * The beams by mark: beams that are the same (one profile, one material, one length and the same operations at the
3
+ * same places) share one, A, B, C and on, in order of profile and then the longest first.
4
+ * @param {object[]} beams beams' models (beamModel), or { id, beam } with an item's name
5
+ * @returns {{ mark: string, beam: object, items: string[], count: number }[]}
6
+ */
7
+ export function beamMarks(beams: object[]): {
8
+ mark: string;
9
+ beam: object;
10
+ items: string[];
11
+ count: number;
12
+ }[];
13
+ /**
14
+ * Pieces packed into bars of the lengths sold, first-fit decreasing: every cut takes a kerf (the last one too, which
15
+ * parts the piece from the offcut), and the first end of each bar is trimmed square. A piece longer than a bar can give
16
+ * is left out, in unpacked.
17
+ * @param {{ length: number }[]} pieces each with its length, and anything else to keep (its mark, its item)
18
+ * @param {number[]} lengths the lengths sold, mm
19
+ * @param {{ kerf?: number, trim?: number }} [o] mm (CUT_DEFAULTS' kerf and trim where left out)
20
+ * @returns {{ bars: { length: number, cuts: object[], offcut: number }[], buy: { length: number, count: number }[], unpacked: object[], bought: number, offcut: number }}
21
+ * each cut carries at, where it starts from the bar's trimmed end (mm from the bar's first end)
22
+ */
23
+ export function packBars(pieces: {
24
+ length: number;
25
+ }[], lengths: number[], o?: {
26
+ kerf?: number;
27
+ trim?: number;
28
+ }): {
29
+ bars: {
30
+ length: number;
31
+ cuts: object[];
32
+ offcut: number;
33
+ }[];
34
+ buy: {
35
+ length: number;
36
+ count: number;
37
+ }[];
38
+ unpacked: object[];
39
+ bought: number;
40
+ offcut: number;
41
+ };
42
+ /**
43
+ * A frame's cut list: each mark (beams that are the same) with its count, mass and operations, and for each profile the
44
+ * bars to buy, the cut order on each and its offcut, with the checks frame.cut makes (a beam longer than any sold length,
45
+ * lengths the cut tolerance cannot hold apart, beams that must match). Weighed by the maker's sheet where it gives a mass
46
+ * per metre, else by the drawn section.
47
+ * @param {object[]} beams beams' models (beamModel), or { id, beam } with an item's name
48
+ * @param {{ kerf?: number, trim?: number, tolerance?: number, stock?: number }} [o] mm, a workshop's own; CUT_DEFAULTS' where left out
49
+ * stock: each profile's { profile, supply ('sold', 'cut' by the maker, or 'assumed'), lengths, cuts (each length to cut and how
50
+ * many), bars, buy, unpacked, bought, offcut, kerf, trim, tolerance }
51
+ * @returns {{ marks: object[], stock: object[], rules: object, totals: { beams: number, grams: number, bars: number, bought: number, offcut: number }, findings: object[] }}
52
+ */
53
+ export function cutList(beams: object[], o?: {
54
+ kerf?: number;
55
+ trim?: number;
56
+ tolerance?: number;
57
+ stock?: number;
58
+ }): {
59
+ marks: object[];
60
+ stock: object[];
61
+ rules: object;
62
+ totals: {
63
+ beams: number;
64
+ grams: number;
65
+ bars: number;
66
+ bought: number;
67
+ offcut: number;
68
+ };
69
+ findings: object[];
70
+ };
71
+ /**
72
+ * The cut list as lines of text: the marks, then each profile's bars to buy and the cuts on each.
73
+ * @param {ReturnType<typeof cutList>} c @returns {string[]}
74
+ */
75
+ export function cutListText(c: ReturnType<typeof cutList>): string[];
76
+ /**
77
+ * The rules the cut list packs and checks by, each with what it rests on. A workshop that knows its own saw gives its
78
+ * own: cutList(beams, { kerf: 2.4, trim: 5 }).
79
+ * @type {Record<'kerf' | 'trim' | 'tolerance' | 'stock', { value: number, unit: string, rule: string, kind: string, source: string, checked: string }>}
80
+ */
81
+ export const CUT_DEFAULTS: Record<"kerf" | "trim" | "tolerance" | "stock", {
82
+ value: number;
83
+ unit: string;
84
+ rule: string;
85
+ kind: string;
86
+ source: string;
87
+ checked: string;
88
+ }>;
package/cutlist.mjs ADDED
@@ -0,0 +1,199 @@
1
+ // The cut list: a frame's beams by profile and length, each kind of beam with its mark, and the bars to buy. Beams that
2
+ // are the same (one profile, one material, one length and the same operations at the same places) share a mark, A, B,
3
+ // C and on, and one cut-and-drill sheet. Each profile's beams are packed into the lengths it is sold in, with the saw's
4
+ // kerf taken at every cut and a trim allowance off the first end of every bar: the bars to buy, the cut order on each,
5
+ // and what is left of each, the offcut.
6
+ //
7
+ // The packing is first-fit decreasing, a simple rule that is not always the fewest bars: the longest beam first, each on
8
+ // the first bar with room for it, else on a new bar. It is run with each sold length as the length of a new bar (and
9
+ // once with the shortest that holds the beam), each bar then cut down to the shortest sold length that holds what is on
10
+ // it, and the plan that buys the least metal kept (then the fewest bars). Units: mm, grams.
11
+
12
+ const isNum = (x) => typeof x === 'number' && Number.isFinite(x);
13
+ const shown = (v) => { const s = v === undefined ? 'nothing' : JSON.stringify(v) ?? String(v); return s.length > 80 ? `${s.slice(0, 77)}...` : s; };
14
+ const mm = (x) => String(+Number(x).toFixed(2));
15
+ const d1 = (x) => Number(x).toFixed(1);
16
+ const EPS = 1e-9;
17
+ const CHECKED = '2026-11-15';
18
+
19
+ /**
20
+ * The rules the cut list packs and checks by, each with what it rests on. A workshop that knows its own saw gives its
21
+ * own: cutList(beams, { kerf: 2.4, trim: 5 }).
22
+ * @type {Record<'kerf' | 'trim' | 'tolerance' | 'stock', { value: number, unit: string, rule: string, kind: string, source: string, checked: string }>}
23
+ */
24
+ export const CUT_DEFAULTS = {
25
+ kerf: { value: 3, unit: 'mm', rule: 'The width of metal a cut takes, taken at every cut on a bar: a 250 mm carbide blade for aluminium and other non-ferrous metals (80 teeth, 30 mm bore) cuts 3.0 mm on a 2.2 mm plate. A mitre or chop saw for aluminium extrusion commonly takes a blade of this size; give your own saw\'s', kind: 'default', source: 'Popular Tools NF2503080 non-ferrous saw blade, 250 mm x 80T TCG, sold by Carbide Processors, https://carbideprocessors.com/non-ferrous-cutting-saw-blade-250mm-x-80t-tcg-popular-tools-nf2503080', checked: CHECKED },
26
+ trim: { value: 10, unit: 'mm', rule: 'Cut off the first end of every bar to square it before the first beam is measured: a mill end can be bruised, burred or out of square from the extruder\'s saw. A working allowance, not taken from a supplier: no figure for it was found', kind: 'estimate', source: 'workshop practice, not checked against a supplier', checked: CHECKED },
27
+ tolerance: { value: 0.5, unit: 'mm', rule: 'How far a cut length may be from the length asked, either way, where the profile\'s set gives no cut_tolerance: MISUMI\'s for its cut lengths of extrusion, taken for any saw cut against a stop. A hand saw to a pencil line does worse', kind: 'estimate', source: 'MISUMI FA Mechanical Standard Components catalogue 2014, page 2-527, https://my.misumi-ec.com/pdf/fa/2014/p2_527.pdf ("L Dimension Tolerance ±0.5mm"), taken for other saws without a check', checked: CHECKED },
28
+ stock: { value: 6000, unit: 'mm', rule: 'The bar length a profile is packed into where its set gives no lengths and no cut-to-length range: 6 m, the length Bosch Rexroth and item sell their profiles in (their sets in @rulecad/rules). Taken for a generic section without a check: ask your supplier', kind: 'estimate', source: 'the lengths rules of profile-2020-bosch and profile-2020-item-5 in @rulecad/rules, taken for other profiles without a check', checked: CHECKED },
29
+ };
30
+
31
+ const OPTIONS = ['kerf', 'trim', 'tolerance', 'stock'];
32
+
33
+ // The rules as used: the defaults, or what was given (a workshop's own, so kind measured)
34
+ function rulesOf(o, what) {
35
+ if (!o || typeof o !== 'object' || Array.isArray(o)) throw new Error(`${what}: the options are { ${OPTIONS.join(', ')} }, each a number in mm (got ${shown(o)})`);
36
+ for (const k of Object.keys(o)) if (!OPTIONS.includes(k)) throw new Error(`${what}: no option "${k}": it takes ${OPTIONS.join(', ')}, each a number in mm`);
37
+ return Object.fromEntries(OPTIONS.map((k) => {
38
+ if (o[k] == null) return [k, { ...CUT_DEFAULTS[k] }];
39
+ const v = o[k], min = k === 'stock' ? EPS : 0;
40
+ if (!(isNum(v) && v >= min)) throw new Error(`${what}: ${k} is a number in mm, ${k === 'stock' ? 'above' : 'at least'} 0 (got ${shown(v)})`);
41
+ return [k, { value: v, unit: 'mm', rule: `${CUT_DEFAULTS[k].rule.split(':')[0]}: given`, kind: 'measured', source: 'given to cutList', checked: CHECKED }];
42
+ }));
43
+ }
44
+
45
+ // The beams as { id, beam }: a list of those, or of beam models (named 1, 2, 3 in order)
46
+ function beamsOf(list, what) {
47
+ if (!Array.isArray(list)) throw new Error(`${what}: give a list of beams, each a beam's model (beamModel) or { id, beam } (got ${shown(list)})`);
48
+ return list.map((x, i) => {
49
+ const b = x?.kind === 'beam' ? x : x?.beam, id = x?.kind === 'beam' ? String(i + 1) : x?.id;
50
+ if (b?.kind !== 'beam') throw new Error(`${what}: beams[${i}] is a beam's model (beamModel) or { id, beam } (got ${shown(x)})`);
51
+ if (typeof id !== 'string' || !id) throw new Error(`${what}: beams[${i}]'s id is a name, such as x1 (got ${shown(id)})`);
52
+ return { id, beam: b };
53
+ });
54
+ }
55
+
56
+ // A, B, ... Z, AA, AB, ...
57
+ const letters = (n) => { let s = ''; for (let k = n + 1; k > 0; k = Math.floor((k - 1) / 26)) s = String.fromCharCode(65 + ((k - 1) % 26)) + s; return s; };
58
+ // What makes two beams the same: profile, material, length and every operation's line (each says where and how big)
59
+ const keyOf = (b) => JSON.stringify([b.profile.name, b.material?.name ?? null, +b.length.toFixed(2), b.ops.map((o) => o.line)]);
60
+
61
+ /**
62
+ * The beams by mark: beams that are the same (one profile, one material, one length and the same operations at the
63
+ * same places) share one, A, B, C and on, in order of profile and then the longest first.
64
+ * @param {object[]} beams beams' models (beamModel), or { id, beam } with an item's name
65
+ * @returns {{ mark: string, beam: object, items: string[], count: number }[]}
66
+ */
67
+ export function beamMarks(beams) {
68
+ const list = beamsOf(beams, 'beamMarks'), by = new Map();
69
+ for (const { id, beam } of list) { const k = keyOf(beam), g = by.get(k) ?? { beam, items: [], key: k }; g.items.push(id); by.set(k, g); }
70
+ return [...by.values()].sort((p, q) => p.beam.profile.name.localeCompare(q.beam.profile.name) || q.beam.length - p.beam.length || p.key.localeCompare(q.key))
71
+ .map((g, i) => ({ mark: letters(i), beam: g.beam, items: g.items, count: g.items.length }));
72
+ }
73
+
74
+ // One plan: first-fit decreasing, new bars of open(piece) long, each then cut down to the shortest sold length that holds it
75
+ function firstFit(pieces, sold, open, kerf, trim) {
76
+ const bars = [];
77
+ for (const p of pieces) {
78
+ const need = p.length + kerf;
79
+ let bar = bars.find((b) => b.free >= need - EPS);
80
+ if (!bar) { const L = open(p); bar = { length: L, free: L - trim, cuts: [] }; bars.push(bar); }
81
+ bar.cuts.push(p); bar.free -= need;
82
+ }
83
+ for (const b of bars) { const used = b.length - b.free, L = sold.find((s) => s >= used - EPS); b.free += L - b.length; b.length = L; }
84
+ return bars;
85
+ }
86
+
87
+ /**
88
+ * Pieces packed into bars of the lengths sold, first-fit decreasing: every cut takes a kerf (the last one too, which
89
+ * parts the piece from the offcut), and the first end of each bar is trimmed square. A piece longer than a bar can give
90
+ * is left out, in unpacked.
91
+ * @param {{ length: number }[]} pieces each with its length, and anything else to keep (its mark, its item)
92
+ * @param {number[]} lengths the lengths sold, mm
93
+ * @param {{ kerf?: number, trim?: number }} [o] mm (CUT_DEFAULTS' kerf and trim where left out)
94
+ * @returns {{ bars: { length: number, cuts: object[], offcut: number }[], buy: { length: number, count: number }[], unpacked: object[], bought: number, offcut: number }}
95
+ * each cut carries at, where it starts from the bar's trimmed end (mm from the bar's first end)
96
+ */
97
+ export function packBars(pieces, lengths, o = {}) {
98
+ const what = 'packBars';
99
+ if (!Array.isArray(pieces) || pieces.some((p) => !(isNum(p?.length) && p.length > 0))) throw new Error(`${what}: pieces is a list of { length }, each above 0 mm (got ${shown(pieces)})`);
100
+ if (!Array.isArray(lengths) || !lengths.length || lengths.some((l) => !(isNum(l) && l > 0))) throw new Error(`${what}: lengths is a list of the lengths sold, each above 0 mm (got ${shown(lengths)})`);
101
+ const r = rulesOf({ ...(o.kerf != null ? { kerf: o.kerf } : {}), ...(o.trim != null ? { trim: o.trim } : {}) }, what), kerf = r.kerf.value, trim = r.trim.value;
102
+ const sold = [...new Set(lengths)].sort((a, b) => a - b), longest = sold.at(-1), room = longest - trim;
103
+ const sorted = [...pieces].sort((a, b) => b.length - a.length), fits = sorted.filter((p) => p.length + kerf <= room + EPS), unpacked = sorted.filter((p) => p.length + kerf > room + EPS);
104
+ let best = [];
105
+ if (fits.length) {
106
+ const opens = [(p) => sold.find((s) => s - trim >= p.length + kerf - EPS), ...sold.map((s) => (p) => (s - trim >= p.length + kerf - EPS ? s : longest))];
107
+ const plans = opens.map((open) => firstFit(fits, sold, open, kerf, trim)), total = (bars) => bars.reduce((t, b) => t + b.length, 0);
108
+ best = plans.reduce((a, b) => (total(b) < total(a) - EPS || (Math.abs(total(b) - total(a)) <= EPS && b.length < a.length) ? b : a));
109
+ }
110
+ // each bar's cut order: the trim, then the longest first, as packed
111
+ const bars = best.sort((a, b) => b.length - a.length || b.cuts.length - a.cuts.length).map((b) => {
112
+ let at = trim;
113
+ const cuts = b.cuts.map((p) => { const c = { ...p, at: +at.toFixed(6) }; at += p.length + kerf; return c; });
114
+ return { length: b.length, cuts, offcut: +(b.length - at).toFixed(6) };
115
+ });
116
+ const buy = sold.map((l) => ({ length: l, count: bars.filter((b) => b.length === l).length })).filter((x) => x.count).reverse();
117
+ return { bars, buy, unpacked, bought: bars.reduce((t, b) => t + b.length, 0), offcut: +bars.reduce((t, b) => t + b.offcut, 0).toFixed(6), kerf, trim };
118
+ }
119
+
120
+ // An operation in a few words for the list
121
+ function opWords(o) {
122
+ const at = o.end ? `at ${o.end}` : `at ${o.place}@${d1(o.distance)}`;
123
+ if (o.op === 'mitre') return `mitre ${mm(o.angle)}° about ${o.about} ${at}`;
124
+ if (o.op === 'tap') return `tap ${o.thread} x ${mm(o.depth)} ${at}`;
125
+ if (o.op === 'access' || o.op === 'drill') return `${o.op} ${o.thread && o.kind === 'tap' ? o.thread : `Ø${mm(o.diameter)}`} ${at}`;
126
+ if (o.op === 'counterbore') return `counterbore Ø${mm(o.seat.diameter)} ${at}`;
127
+ if (o.op === 'pocket') return `pocket ${o.size ? `${mm(o.size[0])} x ${mm(o.size[1])}` : 'by outline'} ${at}`;
128
+ if (o.op === 'notch') return `notch ${mm(o.length)} ${at}`;
129
+ return `${o.op} ${at}`;
130
+ }
131
+
132
+ /**
133
+ * A frame's cut list: each mark (beams that are the same) with its count, mass and operations, and for each profile the
134
+ * bars to buy, the cut order on each and its offcut, with the checks frame.cut makes (a beam longer than any sold length,
135
+ * lengths the cut tolerance cannot hold apart, beams that must match). Weighed by the maker's sheet where it gives a mass
136
+ * per metre, else by the drawn section.
137
+ * @param {object[]} beams beams' models (beamModel), or { id, beam } with an item's name
138
+ * @param {{ kerf?: number, trim?: number, tolerance?: number, stock?: number }} [o] mm, a workshop's own; CUT_DEFAULTS' where left out
139
+ * stock: each profile's { profile, supply ('sold', 'cut' by the maker, or 'assumed'), lengths, cuts (each length to cut and how
140
+ * many), bars, buy, unpacked, bought, offcut, kerf, trim, tolerance }
141
+ * @returns {{ marks: object[], stock: object[], rules: object, totals: { beams: number, grams: number, bars: number, bought: number, offcut: number }, findings: object[] }}
142
+ */
143
+ export function cutList(beams, o = {}) {
144
+ const what = 'cutList', rules = rulesOf(o, what), marks = beamMarks(beamsOf(beams, what)), findings = [];
145
+ const kerf = rules.kerf.value, trim = rules.trim.value;
146
+ const lines = marks.map(({ mark, beam: b, items, count }) => {
147
+ const mitre = b.ops.find((x) => x.op === 'mitre' && x.shortLength != null), grams = b.weight?.sheet ?? b.mass;
148
+ return { mark, profile: b.profile.name, material: b.material?.name ?? null, length: b.length, ...(mitre ? { shortLength: Math.min(...b.ops.filter((x) => x.op === 'mitre').map((x) => x.shortLength)) } : {}),
149
+ count, items, grams: grams != null ? +grams.toFixed(1) : null, weighedBy: b.weight?.sheet != null ? 'sheet' : b.mass != null ? 'section' : null,
150
+ ops: b.ops.filter((x) => !x.implied).map(opWords), beam: b };
151
+ });
152
+ const profiles = [...new Set(lines.map((l) => l.profile))], stock = [];
153
+ for (const name of profiles) {
154
+ const ls = lines.filter((l) => l.profile === name), p = ls[0].beam.profile, s = p.supply, tol = s.cutTolerance ?? rules.tolerance.value;
155
+ const tolRule = s.cutTolerance != null ? 'cut_tolerance' : 'cut tolerance (CUT_DEFAULTS)';
156
+ const pieces = ls.flatMap((l) => l.items.map((item) => ({ mark: l.mark, item, length: l.length })));
157
+ let entry;
158
+ if (s.lengths.length || s.cutMax == null) {
159
+ const sold = s.lengths.length ? s.lengths : [rules.stock.value], r = packBars(pieces, sold, { kerf, trim });
160
+ entry = { profile: name, supply: s.lengths.length ? 'sold' : 'assumed', lengths: [...sold].sort((a, b) => a - b), tolerance: tol, ...r };
161
+ const room = Math.max(...sold) - trim - kerf;
162
+ for (const u of r.unpacked) findings.push({ level: 'fail', code: 'frame.cut', text: `${u.item}: ${mm(u.length)} mm of ${name} is longer than any length it is ${s.lengths.length ? 'sold' : 'taken to come'} in (${entry.lengths.map(mm).join(', ')} mm): a bar gives ${mm(room)} mm after a ${mm(trim)} mm trim and a ${mm(kerf)} mm cut. Join two lengths along it, or buy it cut to length`, values: { length: u.length, room }, refs: { item: u.item, mark: u.mark, profile: name, rule: s.lengths.length ? 'lengths' : 'stock' } });
163
+ } else {
164
+ // no sold lengths, but the maker cuts to length: each beam is bought at its length, no saw of ours
165
+ const bars = pieces.filter((x) => x.length <= s.cutMax + EPS).map((x) => ({ length: x.length, cuts: [{ ...x, at: 0 }], offcut: 0 })), unpacked = pieces.filter((x) => x.length > s.cutMax + EPS);
166
+ const buy = [...new Set(bars.map((b) => b.length))].sort((a, b) => b - a).map((l) => ({ length: l, count: bars.filter((b) => b.length === l).length }));
167
+ entry = { profile: name, supply: 'cut', lengths: [], cutMin: s.cutMin, cutMax: s.cutMax, tolerance: tol, bars, buy, unpacked, bought: bars.reduce((t, b) => t + b.length, 0), offcut: 0, kerf: 0, trim: 0 };
168
+ for (const u of unpacked) findings.push({ level: 'fail', code: 'frame.cut', text: `${u.item}: ${mm(u.length)} mm of ${name} is longer than the ${mm(s.cutMax)} mm the maker cuts it to: join two lengths along it`, values: { length: u.length, cutMax: s.cutMax }, refs: { item: u.item, mark: u.mark, profile: name, rule: 'cut_length_max' } });
169
+ }
170
+ // the lengths to cut, longest first, however many marks share one
171
+ entry.cuts = [...new Set(pieces.map((x) => +x.length.toFixed(2)))].sort((a, b) => b - a).map((l) => ({ length: l, count: pieces.filter((x) => Math.abs(x.length - l) < 0.005).length }));
172
+ stock.push(entry);
173
+ // lengths the cut tolerance cannot hold apart: two marks nearer than two cuts' tolerance
174
+ const byLength = [...ls].sort((a, b) => a.length - b.length);
175
+ for (let i = 0; i + 1 < byLength.length; i++) {
176
+ const a = byLength[i], b = byLength[i + 1], gap = b.length - a.length;
177
+ if (gap > 1e-6 && gap < 2 * tol - EPS) findings.push({ level: 'warn', code: 'frame.cut', text: `${name}: mark ${a.mark} (${a.items.join(', ')}) at ${mm(a.length)} mm and mark ${b.mark} (${b.items.join(', ')}) at ${mm(b.length)} mm differ by ${mm(gap)} mm, less than two cuts at ±${mm(tol)} mm can hold apart: make them one length if they should match, or cut them against one stop`, values: { a: a.length, b: b.length, gap, tolerance: tol }, refs: { marks: [a.mark, b.mark], profile: name, rule: tolRule } });
178
+ }
179
+ for (const l of ls) if (l.count > 1 && tol > 0) findings.push({ level: 'info', code: 'frame.cut', text: `mark ${l.mark} (${l.items.join(', ')}): ${l.count} beams of ${mm(l.length)} mm, each cut to ±${mm(tol)} mm, may differ by up to ${mm(2 * tol)} mm: where they must match (opposite sides of a frame), cut them against one stop`, values: { length: l.length, count: l.count, tolerance: tol }, refs: { mark: l.mark, items: l.items, profile: name, rule: tolRule } });
180
+ }
181
+ const totals = { beams: lines.reduce((t, l) => t + l.count, 0), grams: +lines.reduce((t, l) => t + (l.grams ?? 0) * l.count, 0).toFixed(1), bars: stock.reduce((t, s) => t + s.bars.length, 0), bought: stock.reduce((t, s) => t + s.bought, 0), offcut: +stock.reduce((t, s) => t + s.offcut, 0).toFixed(3) };
182
+ return { marks: lines, stock, rules, totals, findings };
183
+ }
184
+
185
+ /**
186
+ * The cut list as lines of text: the marks, then each profile's bars to buy and the cuts on each.
187
+ * @param {ReturnType<typeof cutList>} c @returns {string[]}
188
+ */
189
+ export function cutListText(c) {
190
+ const out = [];
191
+ for (const l of c.marks) out.push([` ${l.mark.padEnd(3)}${String(l.count).padStart(3)} ×`, `${l.profile} x ${mm(l.length)} mm${l.shortLength != null ? ` (short side ${mm(l.shortLength)})` : ''}`, l.grams != null ? `${mm(l.grams)} g each` : 'mass not given', l.ops.length ? l.ops.join('; ') : 'cut square', l.items.join(', ')].join(' '));
192
+ for (const s of c.stock) {
193
+ out.push(` ${s.profile}: ${s.cuts.length} length${s.cuts.length === 1 ? '' : 's'}, ${s.cuts.map((x) => `${x.count} × ${mm(x.length)}`).join(', ')} mm`);
194
+ if (s.supply === 'cut') { out.push(` ${s.profile}: cut to length by the maker (${mm(s.cutMin ?? 0)} to ${mm(s.cutMax)} mm): ${s.buy.map((b) => `${b.count} × ${mm(b.length)} mm`).join(', ')}`); continue; }
195
+ out.push(` ${s.profile}: buy ${s.buy.map((b) => `${b.count} × ${mm(b.length)} mm`).join(', ')}${s.supply === 'assumed' ? ` (no sold length in its set: ${mm(s.lengths[0])} mm assumed)` : ''}; kerf ${mm(s.kerf)}, trim ${mm(s.trim)}; ${mm(s.offcut)} mm left over`);
196
+ s.bars.forEach((b, i) => out.push(` bar ${i + 1}, ${mm(b.length)} mm: trim ${mm(s.trim)}, ${b.cuts.map((x) => `${x.mark} ${mm(x.length)} (${x.item})`).join(', ')}; offcut ${mm(b.offcut)}`));
197
+ }
198
+ return out;
199
+ }
package/cutsheet.d.mts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A beam's cut-and-drill sheet, to scale: its section from end a with the faces named, a view of each face with work
3
+ * on it (that face up), each operation dimensioned from end a to 0.1 mm, and the operations listed in order, each tap
4
+ * with its thread and depth.
5
+ * @param {object} b a beam's model (beamModel)
6
+ * @param {{ mark?: string, items?: string[], grams?: number | null }} [o] the beam's mark on the cut list, the items it is, its mass each
7
+ * @returns {{ svg: string, scale: number, faces: string[], dimensions: { op: number, distance: number, text: string }[] }}
8
+ * scale: the beam is drawn 1:scale; faces: the views drawn; dimensions: each operation's figure from end a, as on the sheet
9
+ */
10
+ export function beamSheet(b: object, o?: {
11
+ mark?: string;
12
+ items?: string[];
13
+ grams?: number | null;
14
+ }): {
15
+ svg: string;
16
+ scale: number;
17
+ faces: string[];
18
+ dimensions: {
19
+ op: number;
20
+ distance: number;
21
+ text: string;
22
+ }[];
23
+ };