-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
91 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# machinistcalc | ||
|
||
MachinistCalc: a Python3 Machinist Calculator for doing plenty of machining and fabricating calculations. | ||
|
||
# Features | ||
|
||
- Bolt Circle calculator | ||
- Lathe Speed & Feed calculator | ||
- Milling Speed & Feed calculator | ||
- Punch Press / Punch tonnage calculator | ||
- Sheet Metal Usage calculator | ||
- Gear calculator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
# __init__.py | ||
|
||
# Importing modules from the package | ||
from app.bendcalc import bend_calc | ||
from app.lathecalc import lathe_calc | ||
from app.millingcalc import milling_calc | ||
from app.punchtonnage import punch_tonnage | ||
from app.sheetmetalcalc import sheetmetal_calc | ||
from app.speedfeed import speed_feed | ||
from app.boltcircle import bolt_circle |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,54 @@ | ||
import math | ||
from typing import Tuple | ||
|
||
def lathe_calc(): | ||
# Prompt the user for inputs | ||
rpm = float(input("Enter the RPM: ")) | ||
ipr = float(input("Enter the inches per revolution: ")) | ||
diameter = float(input("Enter the workpiece diameter before machining: ")) | ||
feed_rate = float(input("Enter the feed rate: ")) | ||
depth_of_cut = float(input("Enter the depth of cut: ")) | ||
metal_removal_rate = float(input("Enter the metal removal rate: ")) | ||
spindle_rpm = input("Enter the available spindle rpm range: ") | ||
surface_finish_unit = input("Enter the unit, UM or RA, for surface finish (µm or Ra): ").upper() | ||
tooling_material = input("Enter the tooling material: ") | ||
calculated_feed_per_rev = calculate_feed_per_rev(ipr, rpm) | ||
|
||
def lathe_calc(diameter, surface_speed, feed_rate, number_of_teeth): | ||
# Calculate spindle speed | ||
spindle_speed = (surface_speed * 12) / (math.pi * diameter) | ||
# Calculate sfpm | ||
sfpm = calculate_sfpm(diameter, rpm) | ||
|
||
# Calculate cutting speed | ||
cutting_speed = spindle_speed * math.pi * diameter | ||
# Prompt for surface finish value based on user preference | ||
if surface_finish_unit == "UM": | ||
surface_finish = float(input("Enter the required surface finish in micrometers (µm): ")) | ||
print(f"Using micrometers (µm) for surface finish.") | ||
elif surface_finish_unit == "RA": | ||
surface_finish = float(input("Enter the required surface finish (Ra): ")) | ||
print(f"Using Roughness Average (Ra) for surface finish.") | ||
else: | ||
print(f"Invalid unit entered. Please enter 'µm' or 'Ra'.") | ||
# Handle the case where the user enters an invalid unit | ||
|
||
# Calculate feed rate | ||
feed_rate = feed_rate * spindle_speed * number_of_teeth | ||
# Calculate ipm (if needed) | ||
ipm = calculate_ipm(sfpm, calculated_feed_per_rev) | ||
|
||
# Calculate chip load | ||
chip_load = feed_rate / (number_of_teeth * spindle_speed) | ||
# Print the results | ||
print(f"Calculated feed rate: {feed_rate}") | ||
print(f"Calculated spindle RPM: {spindle_rpm}") | ||
print(f"Calculated material removal rate: {metal_removal_rate}") | ||
print(f"Calculated Inches per Revolution: {ipr:.2f}") | ||
print(f"Calculated Surface Feet per Minute: {sfpm:.2f}") | ||
print(f"Calculated Inches per Minute: {ipm:.2f}") # Print ipm only if calculated | ||
print(f"Calculated Feed per Revolution: {calculated_feed_per_rev:.2f}") | ||
|
||
# Print results | ||
print("Spindle speed: {:.2f} RPM".format(spindle_speed)) | ||
print("Cutting speed: {:.2f} feet per minute".format(cutting_speed)) | ||
print("Feed rate: {:.4f} inches per minute".format(feed_rate)) | ||
print("Chip load: {:.4f} inches per tooth".format(chip_load)) | ||
|
||
def calculate_sfpm(diameter, rpm): | ||
sfpm = (diameter * math.pi * rpm) / 12 | ||
return sfpm | ||
|
||
def calculate_ipm(sfpm, feed_per_rev): | ||
ipm = sfpm * feed_per_rev | ||
return ipm | ||
|
||
def calculate_feed_per_rev(ipr, rpm): | ||
feed_per_rev = ipr * rpm | ||
return feed_per_rev |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def milling_calc(): | ||
pass |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
black | ||
flake8 | ||
pytest | ||
pylint | ||
black | ||
flake8 | ||
pytest | ||
pylint | ||
pycache | ||
pyright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import pytest | ||
from machinistcalc.app.speedfeed import calculate_speed, calculate_feed | ||
|
||
def test_calculate_speed(): | ||
result = calculate_speed(1000, 2) | ||
expected = 500 | ||
assert result == expected | ||
|
||
def test_calculate_feed(): | ||
result = calculate_feed(1000, 2) | ||
expected = 2000 | ||
assert result == expected | ||
import pytest | ||
from app.lathecalc import calculate_sfpm, calculate_feed, calculate_speed | ||
|
||
def test_calculate_speed(): | ||
result = calculate_speed(1000, 2) | ||
expected = 500 | ||
assert result == expected | ||
|
||
def test_calculate_feed(): | ||
result = calculate_feed(1000, 2) | ||
expected = 2000 | ||
assert result == expected |