Moar stuff added

This commit is contained in:
Gregory Kenneth Bowne 2024-02-08 14:14:23 -08:00
parent e559c2d730
commit fee6a594df
12 changed files with 94 additions and 11 deletions

BIN
.vscode/browse.vc.db vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

@ -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
A C++ Bend calculator for sheet metal bending and forming calculations used in the sheet metal and forming and fabrication trades

0
include/BendAllowance.h Normal file
View File

0
include/FormingTool.h Normal file
View File

0
src/BendAllowance.cpp Normal file
View File

View File

@ -0,0 +1,27 @@
#include <iostream>
#include <fstream>
#include <string>
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;
}

View File

@ -1 +1,23 @@
D
#include <iostream>
#include <fstream>
#include <string>
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;
}

15
src/FormingTool.cpp Normal file
View File

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

View File

@ -1,7 +1,11 @@
#include "Kfactor.h"
#include <cmath> // 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;
}
}