Fixed a bunch of minor issues including CMakeLists.txt

This commit is contained in:
Gregory Kenneth Bowne 2024-02-08 23:44:59 -08:00
parent fee6a594df
commit 9c06bf45bf
16 changed files with 135 additions and 100 deletions

BIN
.vscode/browse.vc.db vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,36 +1,41 @@
cmake_minimum_required(VERSION 3.13.4) 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 C++ standard
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_VERBOSE_MAKEFILE ON)
add_compile_options(-g -Wall -Wextra -Werror -pedantic)
set(CMAKE_CXX_COMPILER /usr/bin/g++) 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 # Source files
set(SOURCES set(SOURCES
src/main.cpp src/main.cpp
src/Tonnage.cpp src/Tonnage.cpp
src/Setback.cpp src/Setback.cpp
src/Serializer.cpp src/Serializer.cpp
src/Kfactor.cpp src/Kfactor.cpp
src/Deserializer.cpp src/Deserializer.cpp
src/DataSave.cpp src/DataSave.cpp
src/DataLoad.cpp src/DataLoad.cpp
include/Tonnage.h src/BendDeduction.cpp
include/Setback.h src/FormingTool.cpp
include/Serializer.h
include/Kfactor.h
include/Deserializer.h
include/DataSave.h
include/DataLoad.h
) )
# Create executable # Create executable
add_executable(bend_calc ${SOURCES}) add_executable(bendcalc ${SOURCES})
# Include directories
target_include_directories(bendcalc PUBLIC include)

View File

@ -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 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
-

14
docs/BendAllowance.md Normal file
View File

@ -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

25
docs/BendDeduction.md Normal file
View File

@ -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

0
docs/KFactor.md Normal file
View File

View File

@ -1,12 +1,33 @@
// Inputs for Bend Angle Tonnage required # Inputs for calculating the 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
// Outputs for Bend Angle Tonnage - Material Type: Aluminum or Steel
// P in kN/mt and convert to Tons (lb^2/i)
- 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)

View File

@ -0,0 +1,4 @@
/*
* This file is the header file for the BendAllowance.cpp
*
*/

View File

@ -0,0 +1,4 @@
/*
*
*
*/

View File

@ -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

0
src/BendDeduction.cpp Normal file
View File

View File

@ -14,14 +14,4 @@ void loadDataFromCSV(const std::string& fileName) {
} else { } else {
std::cerr << "Failed to open the file: " << fileName << std::endl; 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;
} }

View File

@ -10,14 +10,4 @@ void saveDataToCSV(const std::string& fileName, const std::string& data) {
} else { } else {
std::cerr << "Failed to open the file: " << fileName << std::endl; 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;
} }

View File

@ -40,58 +40,17 @@
#include <thread> #include <thread>
#include <vector> #include <vector>
#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 "Kfactor.h"
#include "Serializer.h"
#include "Setback.h"
#include "Tonnage.h"
int main() 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;
} }