@@ -61,15 +61,25 @@ export class CalcApp extends GWebviewApp {
6161 results : document . getElementById ( 'fr-results' ) as HTMLSpanElement ,
6262 } ;
6363
64+ // Populate Chipload Calculator
6465 this . _calcDom . chipLoad = {
6566 btn : document . getElementById ( 'cl-calc-btn' ) as HTMLElement ,
66- ipm : document . getElementById ( 'cl-ipm' ) ?. shadowRoot ?. getElementById ( 'control' ) as HTMLInputElement ,
67+ feedRate : document . getElementById ( 'cl-ipm' ) ?. shadowRoot ?. getElementById ( 'control' ) as HTMLInputElement ,
6768 rpm : document . getElementById ( 'cl-rpm' ) ?. shadowRoot ?. getElementById ( 'control' ) as HTMLInputElement ,
6869 numFlutes : document
6970 . getElementById ( 'cl-num-flutes' )
7071 ?. shadowRoot ?. getElementById ( 'control' ) as HTMLInputElement ,
7172 results : document . getElementById ( 'cl-results' ) as HTMLSpanElement ,
7273 } ;
74+
75+ // Populate MRR Calculator
76+ this . _calcDom . mrr = {
77+ btn : document . getElementById ( 'mrr-calc-btn' ) as HTMLElement ,
78+ axialDepth : document . getElementById ( 'mrr-ap' ) ?. shadowRoot ?. getElementById ( 'control' ) as HTMLInputElement ,
79+ radialDepth : document . getElementById ( 'mrr-ae' ) ?. shadowRoot ?. getElementById ( 'control' ) as HTMLInputElement ,
80+ feedRate : document . getElementById ( 'mrr-fr' ) ?. shadowRoot ?. getElementById ( 'control' ) as HTMLInputElement ,
81+ results : document . getElementById ( 'mrr-results' ) as HTMLSpanElement ,
82+ } ;
7383 }
7484
7585 protected onMsgReceived ( e : MessageEvent < WebviewMsg > ) : void {
@@ -165,20 +175,36 @@ export class CalcApp extends GWebviewApp {
165175
166176 case 'cl-calc-btn' : {
167177 if ( this . _calcDom . chipLoad ) {
168- const ipm = Math . abs ( Number ( this . _calcDom . chipLoad . ipm . value ) ) ;
178+ const feedRate = Math . abs ( Number ( this . _calcDom . chipLoad . feedRate . value ) ) ;
169179 const rpm = Math . abs ( Number ( this . _calcDom . chipLoad . rpm . value ) ) ;
170180 const numFlutes = Math . abs ( Number ( this . _calcDom . chipLoad . numFlutes . value ) ) ;
171181
172- this . _calcDom . chipLoad . ipm . value = ipm ? ipm . toString ( ) : '' ;
182+ this . _calcDom . chipLoad . feedRate . value = feedRate ? feedRate . toString ( ) : '' ;
173183 this . _calcDom . chipLoad . rpm . value = rpm ? rpm . toString ( ) : '' ;
174184 this . _calcDom . chipLoad . numFlutes . value = numFlutes ? numFlutes . toString ( ) : '' ;
175185
176- result = this . _calcChipLoad ( ipm , rpm , numFlutes ) ;
186+ result = this . _calcChipLoad ( feedRate , rpm , numFlutes ) ;
177187
178188 this . _displayResults ( result , this . _calcDom . chipLoad ) ;
179189 }
180190 break ;
181191 }
192+
193+ case 'mrr-calc-btn' : {
194+ if ( this . _calcDom . mrr ) {
195+ const axialDepth = Math . abs ( Number ( this . _calcDom . mrr . axialDepth . value ) ) ;
196+ const radialDepth = Math . abs ( Number ( this . _calcDom . mrr . radialDepth . value ) ) ;
197+ const feedRate = Math . abs ( Number ( this . _calcDom . mrr . feedRate . value ) ) ;
198+
199+ this . _calcDom . mrr . axialDepth . value = axialDepth ? axialDepth . toString ( ) : '' ;
200+ this . _calcDom . mrr . radialDepth . value = radialDepth ? radialDepth . toString ( ) : '' ;
201+ this . _calcDom . mrr . feedRate . value = feedRate ? feedRate . toString ( ) : '' ;
202+
203+ result = this . _calcMRR ( axialDepth , radialDepth , feedRate ) ;
204+
205+ this . _displayResults ( result , this . _calcDom . mrr ) ;
206+ }
207+ }
182208 }
183209 }
184210 }
@@ -245,6 +271,10 @@ export class CalcApp extends GWebviewApp {
245271 private _calcChipLoad ( feedRate : number , rpm : number , numFlutes : number ) : number | undefined {
246272 return feedRate / rpm / numFlutes ;
247273 }
274+
275+ private _calcMRR ( axialDepth : number , radialDepth : number , feedRate : number ) : number | undefined {
276+ return feedRate * radialDepth * axialDepth ;
277+ }
248278}
249279
250280new CalcApp ( ) ;
0 commit comments