diff --git a/.vscode/browse.vc.db b/.vscode/browse.vc.db index 127329e..badb0ed 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 90a584a..628e3ca 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 5d4c442..e69de29 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 0c02831..c364d53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,20 +3,34 @@ project(BendCalc) # Set C++ standard set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_VERBOSE_MAKEFILE ON) + +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 - # Add other source files here + 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 ) # Create executable add_executable(bend_calc ${SOURCES}) - -# Add subdirectories for modules -add_subdirectory(tests) -add_subdirectory(docs) \ No newline at end of file diff --git a/README.md b/README.md index df5093b..1dbef1c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # BendCalc -A C++ Bend calculator for sheet metal bending and forming calculations used in the sheet metal and forming and fabrication trades \ No newline at end of file +A C++ Bend calculator for sheet metal bending and forming calculations used in the sheet metal and forming and fabrication trades + diff --git a/include/BendAllowance.h b/include/BendAllowance.h new file mode 100644 index 0000000..e69de29 diff --git a/include/FormingTool.h b/include/FormingTool.h new file mode 100644 index 0000000..e69de29 diff --git a/src/BendAllowance.cpp b/src/BendAllowance.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/DataLoad.cpp b/src/DataLoad.cpp index e69de29..16cc7b3 100644 --- a/src/DataLoad.cpp +++ b/src/DataLoad.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +void loadDataFromCSV(const std::string& fileName) { + std::ifstream file(fileName); + if (file.is_open()) { + std::string line; + while (std::getline(file, line)) { + // Process the line, e.g., parse and store the data + std::cout << line << std::endl; // Example: Output the line + } + file.close(); + } 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 02358d2..630f15f 100644 --- a/src/DataSave.cpp +++ b/src/DataSave.cpp @@ -1 +1,23 @@ -D \ No newline at end of file +#include +#include +#include + +void saveDataToCSV(const std::string& fileName, const std::string& data) { + std::ofstream file(fileName, std::ios::app); + if (file.is_open()) { + file << data << "\n"; + file.close(); + } 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/FormingTool.cpp b/src/FormingTool.cpp new file mode 100644 index 0000000..457543e --- /dev/null +++ b/src/FormingTool.cpp @@ -0,0 +1,15 @@ +#include "FormingTool.h" + +FormingTool::FormingTool(const std::string& name, double toolRadius, const std::string& materialType) + : m_name(name), m_toolRadius(toolRadius), m_materialType(materialType) { + // Constructor implementation +} + +double FormingTool::getToolRadius() const { + return m_toolRadius; +} + +void FormingTool::setToolRadius(double radius) { + m_toolRadius = radius; +} +// Implement other methods related to forming tools \ No newline at end of file diff --git a/src/Kfactor.cpp b/src/Kfactor.cpp index 4b1f534..570420e 100644 --- a/src/Kfactor.cpp +++ b/src/Kfactor.cpp @@ -1,7 +1,11 @@ #include "Kfactor.h" +#include // Required for the pi constant + +// Constants +const double PI = 3.14159265358979323846; // Function definition for calculating the K-factor -double calculateKFactor(double neutralAxisLocation, double materialThickness) { - double kFactor = neutralAxisLocation / materialThickness; +double calculateKFactor(double bendAllowance, double bendingAngle, double materialThickness, double innerRadius) { + double kFactor = (180.0 * bendAllowance) / (PI * bendingAngle * materialThickness) - (innerRadius / materialThickness); return kFactor; -} \ No newline at end of file +}