mechanical-tolerance-calculator 1.0.1 → 1.0.3
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/README.md +212 -0
- package/Tolerances.json +1534 -0
- package/index.js +138 -3
- package/package.json +1 -1
- package/Readme.md +0 -91
package/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Mechanical Tolerance Calculator
|
|
2
|
+
|
|
3
|
+
Calculates international standard specifications and tolerances for bores, round bars, and metallic mechanical units.
|
|
4
|
+
Supports standard engineering fits and tolerance grades such as `H7`, `H8`, `H9`, `h6`, `h8`, `h9`, and `IT5`/`IT6` based on ISO tolerance systems.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install mechanical-tolerance-calculator
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
// CommonJS
|
|
20
|
+
const { getAllTolerancesFor } = require("mechanical-tolerance-calculator");
|
|
21
|
+
|
|
22
|
+
// ES module
|
|
23
|
+
// import { getAllTolerancesFor } from "mechanical-tolerance-calculator";
|
|
24
|
+
|
|
25
|
+
// Example: Housing Bore Toelrances
|
|
26
|
+
const housingTolerances = getAllTolerancesFor("housing");
|
|
27
|
+
console.log(housingTolerances["housingBoresTolerances"]);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
### `getAllTolerancesFor(materialType: String)`
|
|
35
|
+
|
|
36
|
+
**Parameters**
|
|
37
|
+
|
|
38
|
+
- `materialType` (`string`) — Type of material to check tolerances for (e.g. `"housing"`, `"shaft"`, `"shell"`).
|
|
39
|
+
|
|
40
|
+
**Returns**
|
|
41
|
+
|
|
42
|
+
An object with the following shape (example):
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"type": "housing bore" | "shaft" | "shell bore",
|
|
47
|
+
"specifications": {
|
|
48
|
+
"H6": [
|
|
49
|
+
{
|
|
50
|
+
"minimum_diameter": 0,
|
|
51
|
+
"maximum_diameter": 3,
|
|
52
|
+
"upper_deviation": 0.006,
|
|
53
|
+
"lower_deviation": 0,
|
|
54
|
+
"IT6": 0.006,
|
|
55
|
+
"IT5": 0.004
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"minimum_diameter": 3,
|
|
59
|
+
"maximum_diameter": 6,
|
|
60
|
+
"upper_deviation": 0.008,
|
|
61
|
+
"lower_deviation": 0,
|
|
62
|
+
"IT6": 0.008,
|
|
63
|
+
"IT5": 0.005
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
"H7": [
|
|
68
|
+
{
|
|
69
|
+
"minimum_diameter": 0,
|
|
70
|
+
"maximum_diameter": 3,
|
|
71
|
+
"upper_deviation": 0.01,
|
|
72
|
+
"lower_deviation": 0,
|
|
73
|
+
"IT7": 0.01,
|
|
74
|
+
"IT6": 0.006,
|
|
75
|
+
"IT5": 0.004
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"minimum_diameter": 3,
|
|
79
|
+
"maximum_diameter": 6,
|
|
80
|
+
"upper_deviation": 0.012,
|
|
81
|
+
"lower_deviation": 0,
|
|
82
|
+
"IT7": 0.012,
|
|
83
|
+
"IT6": 0.008,
|
|
84
|
+
"IT5": 0.005
|
|
85
|
+
},
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- `type`: `"housing bore"` or `"shaft"` or `"shell bore"` inferred from the materialType parameter.
|
|
92
|
+
- `specifications`: ISO or ANSI fit/tolerance designation associated with the entry (e.g., H7, h6, etc.).
|
|
93
|
+
|
|
94
|
+
- `maximum_diameter`: The upper bound of the nominal diameter range (in millimetres) for which the tolerance values apply.
|
|
95
|
+
- `minimum_diameter`: The upper bound of the nominal diameter range (in millimetres) for which the tolerance values apply.
|
|
96
|
+
- `upper_deviation` / `lower_deviation`: The positive / negative deviation limit from the basic size (in millimetres).
|
|
97
|
+
- `IT5` / `IT6` / `IT8`, etc: International Tolerance (IT) grades defining standard tolerance magnitudes for each grade level.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Example Output
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"type": "housing bore",
|
|
106
|
+
"specifications": {
|
|
107
|
+
"H6": [
|
|
108
|
+
{
|
|
109
|
+
"minimum_diameter": 0,
|
|
110
|
+
"maximum_diameter": 3,
|
|
111
|
+
"upper_deviation": 0.006,
|
|
112
|
+
"lower_deviation": 0,
|
|
113
|
+
"IT6": 0.006,
|
|
114
|
+
"IT5": 0.004
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"minimum_diameter": 3,
|
|
118
|
+
"maximum_diameter": 6,
|
|
119
|
+
"upper_deviation": 0.008,
|
|
120
|
+
"lower_deviation": 0,
|
|
121
|
+
"IT6": 0.008,
|
|
122
|
+
"IT5": 0.005
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
|
|
126
|
+
"H7": [
|
|
127
|
+
{
|
|
128
|
+
"minimum_diameter": 0,
|
|
129
|
+
"maximum_diameter": 3,
|
|
130
|
+
"upper_deviation": 0.01,
|
|
131
|
+
"lower_deviation": 0,
|
|
132
|
+
"IT7": 0.01,
|
|
133
|
+
"IT6": 0.006,
|
|
134
|
+
"IT5": 0.004
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"minimum_diameter": 3,
|
|
138
|
+
"maximum_diameter": 6,
|
|
139
|
+
"upper_deviation": 0.012,
|
|
140
|
+
"lower_deviation": 0,
|
|
141
|
+
"IT7": 0.012,
|
|
142
|
+
"IT6": 0.008,
|
|
143
|
+
"IT5": 0.005
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Features
|
|
153
|
+
|
|
154
|
+
- Compute ISO/ANSI tolerance limits and deviations for common designations.
|
|
155
|
+
- Support for both bores (holes) and shafts (round bars).
|
|
156
|
+
- Returns IT grade, upper/lower deviations, tolerance range, and absolute limits.
|
|
157
|
+
- Lightweight, zero external dependencies.
|
|
158
|
+
- Suitable for design tools, validation scripts, CAD/CAM pipelines, and educational purposes.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Reference Standards
|
|
163
|
+
|
|
164
|
+
- ISO 286-1: Geometrical Product Specifications (GPS) — Limits and Fits
|
|
165
|
+
- ANSI B4.2: Preferred Metric Limits and Fits
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Examples / Typical Use Cases
|
|
170
|
+
|
|
171
|
+
- Engineering tolerance calculators and utilities
|
|
172
|
+
- Automated checks in CAD/CAM export workflows
|
|
173
|
+
- Manufacturing inspection tooling and QA scripts
|
|
174
|
+
- Educational examples for mechanical engineering courses
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Development
|
|
179
|
+
|
|
180
|
+
Clone the repository or use the module directly after installing.
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
git clone <repo-url>
|
|
184
|
+
cd mechanical-tolerance-calculator
|
|
185
|
+
npm install
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Contributing
|
|
191
|
+
|
|
192
|
+
Contributions and bug reports are welcome. Please open issues or pull requests on the project repository and follow the repository CONTRIBUTING guidelines if present.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Author
|
|
197
|
+
|
|
198
|
+
Ajay Ghimire
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
MIT © 2025 Ajay Ghimire
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Keywords (suggested for package.json)
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
mechanical tolerance, ISO 286, limits and fits, H7, h6, IT5, IT6, bore, shaft, tolerances, engineering
|
|
212
|
+
```
|