diff --git a/.vscode/browse.vc.db b/.vscode/browse.vc.db index badb0ed..bb83416 100644 Binary files a/.vscode/browse.vc.db and b/.vscode/browse.vc.db differ diff --git a/.vscode/browse.vc.db-shm b/.vscode/browse.vc.db-shm index 628e3ca..ff4d95c 100644 Binary files a/.vscode/browse.vc.db-shm and b/.vscode/browse.vc.db-shm differ diff --git a/.vscode/browse.vc.db-wal b/.vscode/browse.vc.db-wal index e69de29..0d3eab6 100644 Binary files a/.vscode/browse.vc.db-wal and b/.vscode/browse.vc.db-wal differ diff --git a/CMakeLists.txt b/CMakeLists.txt index c364d53..e971f66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,36 +1,41 @@ cmake_minimum_required(VERSION 3.13.4) -project(BendCalc) +project(BendCalc +VERSION 1.0.0 +DESCRIPTION "An application for " +HOMEPAGE_URL "https://gitea.eventhorizonstudio.io/gbowne1/BendCalc" +LANGUAGES CXX) + +include(CTest) +enable_testing() # Set C++ standard set(CMAKE_CXX_STANDARD 11) +set(CMAKE_BUILD_TYPE Debug) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_VERBOSE_MAKEFILE ON) +add_compile_options(-g -Wall -Wextra -Werror -pedantic) + set(CMAKE_CXX_COMPILER /usr/bin/g++) -set(CMAKE_CXX_FLAGS -g -Wall -Wextra -Werror -pedantic) -# Include directories -include_directories(include) -target_include_directories(include) # Source files set(SOURCES src/main.cpp src/Tonnage.cpp - src/Setback.cpp - src/Serializer.cpp - src/Kfactor.cpp - src/Deserializer.cpp - src/DataSave.cpp - src/DataLoad.cpp - include/Tonnage.h - include/Setback.h - include/Serializer.h - include/Kfactor.h - include/Deserializer.h - include/DataSave.h - include/DataLoad.h + src/Setback.cpp + src/Serializer.cpp + src/Kfactor.cpp + src/Deserializer.cpp + src/DataSave.cpp + src/DataLoad.cpp + src/BendDeduction.cpp + src/FormingTool.cpp ) # Create executable -add_executable(bend_calc ${SOURCES}) +add_executable(bendcalc ${SOURCES}) + +# Include directories +target_include_directories(bendcalc PUBLIC include) \ No newline at end of file diff --git a/README.md b/README.md index 1dbef1c..ba98dda 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,11 @@ A C++ Bend calculator for sheet metal bending and forming calculations used in the sheet metal and forming and fabrication trades +This calculators features include: + +- Calculating K-factor +- Calculating bend allowance(s) +- Saving and Loading bend history/historical data for review and analysis, including to and from the machine (if applicable) +- Calculating the required press tonnage required to complete bends and forming operations +- Tool library. Store tool data including a tool library +- \ No newline at end of file diff --git a/docs/BendAllowance.md b/docs/BendAllowance.md new file mode 100644 index 0000000..7139636 --- /dev/null +++ b/docs/BendAllowance.md @@ -0,0 +1,14 @@ +# Calculating Bend Allowance + +Calculating bend allowance involves considering several key factors: + + Bend Angle (α): The angle at which the sheet metal is bent. + Inside Radius (R): The radius of the bend where the material is not deformed. + Material Thickness (T): The thickness of the sheet metal being bent. + K-factor (K): A value that represents the position of the neutral axis (where the material is neither stretched nor compressed) relative to the material thickness. It varies based on the material properties and the bending radius + +The formula for calculating bend allowance (BA) is given as: + +[ BA = \alpha \times (\pi \times R + \frac{K \times T}{2}) ] + +This formula takes into account the bend angle, the inside radius, the thickness of the material, and the K-factor to determine the arc length of bending measured along the neutral axis of the metal plate 14. Once the bend allowance is calculated, it is added to the flat length to determine the required sheet metal length needed to form the desired workpiece diff --git a/docs/BendDeduction.md b/docs/BendDeduction.md new file mode 100644 index 0000000..c450dbb --- /dev/null +++ b/docs/BendDeduction.md @@ -0,0 +1,25 @@ +# Bend Deduction + +Bend Deduction Calculation + +The V die opening is used to calculate the bend deduction, which is the reduction in size of the workpiece due to the bending process. This calculation involves the V die opening to ensure that the workpiece's size is reduced appropriately for the intended application. + +[ BD = \frac{2 \times \tan(\frac{\theta}{2}) \times R \times T}{1 - \cos(\theta)} ] + +Where: + + ( BD ) is the bend deduction. + ( \theta ) is the bend angle in radians. + ( R ) is the inside radius of the bend. + ( T ) is the thickness of the material. + +Calculating bend deduction involves several factors: + + Bend Angle (α): The angle at which the sheet metal is bent. + Inside Radius (R): The radius of the bend where the material is not deformed. + Material Thickness (T): The thickness of the sheet metal being bent. + K-factor (K): A value representing the position of the neutral axis relative to the material thickness. It varies based on the material properties and the bending radius 2. + +The K-factor is used to calculate the bend allowance and is also relevant when calculating bend deduction. It helps determine the length of the metal plate stretched during the bending process and is a fundamental value for determining the bending allowance and bending deduction + +Additionally, when calculating bend deduction, it's important to note that the neutral axis shifts towards the inside surface of the bend during the bending process. This shift, combined with the material's properties and the bending radius, affects the amount of elongation that occurs during bending, which is taken into account when calculating bend deduction diff --git a/docs/KFactor.md b/docs/KFactor.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/Tonnage.md b/docs/Tonnage.md index 62309e0..d5da119 100644 --- a/docs/Tonnage.md +++ b/docs/Tonnage.md @@ -1,12 +1,33 @@ -// Inputs for Bend Angle Tonnage required -// Material Type:L A -// Tensile Strength (if known) in Mpa -// Material Thickness -// K-Factor -// V die opening (print suggested v opening of 8x material thickness) -// Radius -// Minimum Flange -// {[(575 × Material thickness squared) / Die width] / 12} × Material factor +# Inputs for calculating the Bend Angle Tonnage required -// Outputs for Bend Angle Tonnage -// P in kN/mt and convert to Tons (lb^2/i) \ No newline at end of file +- Material Type: Aluminum or Steel + +- Tensile Strength (if known) in Mpa + +- Material Thickness in inches, The material thickness plays a significant role in determining the internal radius, especially in air forming where the radius is produced as a percentage of the die opening width. For example, with 0.125-in.-thick material, the minimum inside bend radius is 63 percent of the material thickness, which would be 0.063 in. + +- K-Factor + +- V die opening (print suggested v opening of 8x material thickness) in inches + + The V die opening is typically described by its width and height, but for calculations involving tonnage and bend angles, both the width and height are considered. It affects the tonnage of the press brake, which is the maximum amount of metal that the press brake can handle at once without overheating or damaging the machine. Tonnage calculations take into account the V die opening size to ensure that the press brake can safely accommodate the workload + + Width (V-die width): This is the horizontal dimension of the V die opening. It affects the bend radius and the amount of material removed from the radius. The V-die width is used in calculations such as the 20 percent rule, which states that the inside radius produced is equal to a percentage of the V-die opening factored by material type + + Height (V-die height): This is the vertical dimension of the V die opening. It affects the tonnage of the press brake and the force required to bend the material. A larger V-die height indicates a greater tonnage requirement, which can affect the strength of the press brake and the time required to complete the bending operation. + +- Desired bend radii/radius + + When determining the internal radius of a bend, the V die opening is essential. It helps to calculate the internal radius produced by the press brake, which is often a percentage of the V die opening factored by material type. The internal radius is often determined as a percentage of the V die opening width, with the percentage varying depending on the material type. For instance, for 304 stainless steel, it might be 20-22 percent of the die opening. + +- Minimum flange dimensions width and length + + The V die opening is also used to determine the minimum flange, which is the smallest diameter of the corner radius that can be achieved by the press brake. The V die opening size helps to define the limits of the press brake's capabilities + +## Formula for tonnage + +{[(575 × Material thickness squared) / Die width] / 12} × Material factor + +## Conversion output + +- P in kN/mt and convert to Tons (lb^2/i) diff --git a/include/BendAllowance.h b/include/BendAllowance.h index e69de29..d5c3431 100644 --- a/include/BendAllowance.h +++ b/include/BendAllowance.h @@ -0,0 +1,4 @@ +/* + * This file is the header file for the BendAllowance.cpp + * + */ \ No newline at end of file diff --git a/include/FormingTool.h b/include/FormingTool.h index e69de29..8e8650e 100644 --- a/include/FormingTool.h +++ b/include/FormingTool.h @@ -0,0 +1,4 @@ +/* + * + * + */ \ No newline at end of file diff --git a/include/Setback.h b/include/Setback.h index e69de29..153f0d0 100644 --- a/include/Setback.h +++ b/include/Setback.h @@ -0,0 +1,15 @@ +In the context of sheet metal forming and pressing, setback refers to the distance between the edge of the sheet and the tangent point of the bend radius. There are two types of setback: inside setback and outside setback. + +The factors involved in calculating setback include: + +- Bend Angle (α): The angle at which the sheet metal is bent. Changes in the bend angle will affect the setback +- Inside Radius (R): The radius of the bend where the material is not deformed. The setback is affected by changes in the inside radius +- Sheet Thickness (T): The thickness of the sheet metal being bent. Sheet thickness contributes to the overall setback + +For outside setback, which is the distance from the tangent point of the radius to the outside bend vertex of the flange, the formula is as follows: + +[ Outside \space Setback = T + \sqrt{R^2 - \left(\frac{T}{\sin(\alpha)}\right)^2} ] + +The above formula assumes that the bend angle is less than 90 degrees. For a 90-degree bend angle, the setback value is simply the bend radius plus the sheet thickness + +By knowing the values of outside setback and bend deduction, we can obtain the bend allowance. The sum of bend deduction and bend allowance is equal to two times the outside setback \ No newline at end of file diff --git a/src/BendDeduction.cpp b/src/BendDeduction.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/DataLoad.cpp b/src/DataLoad.cpp index 16cc7b3..1c61785 100644 --- a/src/DataLoad.cpp +++ b/src/DataLoad.cpp @@ -14,14 +14,4 @@ void loadDataFromCSV(const std::string& fileName) { } else { std::cerr << "Failed to open the file: " << fileName << std::endl; } -} - -int main() { - // Load historical bend data from a CSV file - loadDataFromCSV("historical_bend_data.csv"); - - // Load machine data from a CSV file - loadDataFromCSV("machine_data.csv"); - - return 0; } \ No newline at end of file diff --git a/src/DataSave.cpp b/src/DataSave.cpp index 630f15f..33fec1e 100644 --- a/src/DataSave.cpp +++ b/src/DataSave.cpp @@ -10,14 +10,4 @@ void saveDataToCSV(const std::string& fileName, const std::string& data) { } else { std::cerr << "Failed to open the file: " << fileName << std::endl; } -} - -int main() { - // Save historical bend data to a CSV file - saveDataToCSV("historical_bend_data.csv", "Your historical bend data here"); - - // Save machine data to a CSV file - saveDataToCSV("machine_data.csv", "Your machine data here"); - - return 0; } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index aa6d256..964a032 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,58 +40,17 @@ #include #include -#include "Tonnage.h" +#include "BendAllowance.h" +#include "BendDeduction.h" +#include "DataLoad.h" +#include "DataSave.h" +#include "Deserializer.h" +#include "FormingTool.h" #include "Kfactor.h" +#include "Serializer.h" +#include "Setback.h" +#include "Tonnage.h" int main() { - - /* - * Required Press Tonnage Calculation - */ - - double materialThickness, bendLength, dieOpeningWidth, materialFactor, methodFactor, multipleBendToolingFactor; - - // Get user inputs - std::cout << "Enter material thickness (in inches): "; - std::cin >> materialThickness; - std::cout << "Enter bend length (in inches): "; - std::cin >> bendLength; - std::cout << "Enter die opening width (in inches): "; - std::cin >> dieOpeningWidth; - std::cout << "Enter material factor: "; - std::cin >> materialFactor; - std::cout << "Enter method factor: "; - std::cin >> methodFactor; - std::cout << "Enter multiple-bend tooling factor: "; - std::cin >> multipleBendToolingFactor; - - // Calculate the press brake tonnage using the module function - double tonnage = calculateTonnage(materialThickness, bendLength, dieOpeningWidth, materialFactor, methodFactor, multipleBendToolingFactor); - - // Output the calculated tonnage - std::cout << "The required press brake tonnage is: " << tonnage << " tons" << std::endl; - - return 0; - - /* - * Kfactor calculation - */ - - // User inputs for K-factor calculation - double neutralAxisLocation, materialThickness; - - // Get user inputs - std::cout << "Enter neutral axis location: "; - std::cin >> neutralAxisLocation; - std::cout << "Enter material thickness: "; - std::cin >> materialThickness; - - // Calculate the K-factor using the module function - double kFactor = calculateKFactor(neutralAxisLocation, materialThickness); - - // Output the calculated K-factor - std::cout << "The calculated K-factor is: " << kFactor << std::endl; - - return 0; } \ No newline at end of file