BendCalc/ask.txt

198 lines
5.4 KiB
Plaintext
Raw Permalink Normal View History

2024-07-26 21:42:13 -07:00
I am making a C++ program that is written in C++ 11 and uses CMake. It is meant for doing calculations for
bending sheet metal / sheetmetal for pressbrakes, press brakes, brakeforms, breakforms, brake forms, break forms, forming and forming machinery and metalforming machinery and sheetmetal forming machinery.
The /BendCalc folder/directory includes:
CMakeLists.txt data docs include LICENSE README.md src tests
data is a directcory
docs is a directory
include is a directory
LICENSE is the project license
README.md is for GitHub
src is a directory
tests is a directory
currently data is empty. this is the place for stored data to and from the machine (using a paralel or serial pot or inputted from the user or saved by this program
docs is the documentation for the BendCalc program in markdown format. it contains
BendAllowance.md BendDeduction.md KFactor.md Setback.md Tonnage.md
include contains header files:
BendAllowance.h DataLoad.h Deserializer.h Kfactor.h Setback.h
BendDeduction.h DataSave.h FormingTool.h Serializer.h Tonnage.h
src contains the cpp files:
BendAllowance.cpp DataLoad.cpp Deserializer.cpp Kfactor.cpp Serializer.cpp Tonnage.cpp
BendDeduction.cpp DataSave.cpp FormingTool.cpp main.cpp Setback.cpp
main is the entrypoint to the program. the rest are classes.
tests is currently empty and will be using google test
CMakeLists.txt is currently
cmake_minimum_required(VERSION 3.13.4)
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)
add_compile_options(-g -Wall -Wextra -Werror -pedantic)
set(CMAKE_CXX_COMPILER /usr/bin/g++)
# 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
src/BendDeduction.cpp
src/FormingTool.cpp
)
# Create executable
add_executable(bendcalc ${SOURCES})
# Include directories
target_include_directories(bendcalc PUBLIC include)
and the main.cpp entrypoint file is
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cstddef>
#include <chrono>
#include <cmath>
#include <condition_variable>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <memory>
#include <mutex>
#include <random>
#include <regex>
#include <sstream>
#include <string>
#include <thread>
#include <vector>
#include "../include/BendAllowance.h"
#include "../include/BendDeduction.h"
#include "../include/DataLoad.h"
#include "../include/DataSave.h"
#include "../include/Deserializer.h"
#include "../include/FormingTool.h"
#include "../include/Kfactor.h"
#include "../include/Serializer.h"
#include "../include/Setback.h"
#include "../include/Tonnage.h"
int main() {
DataLoad::loadDataFromCSV(/*fileName*/);
std::cout << "Welcome to BendCalc - Metal Forming and Bending Operations Calculator\n";
std::cout << "Select an operation:\n";
std::cout << "1. Calculate Bend Deduction\n";
std::cout << "2. Load Data\n";
std::cout << "3. Save Data\n";
std::cout << "4. Exit\n";
std::cout << "Enter your choice: ";
int choice;
std::cin >> choice;
switch (choice) {
case 1:
// **Calculate Bend Deduction**
// Get user input for bend parameters
double bendAngleDegrees;
double insideRadius;
double materialThickness;
double kFactor;
std::cout << "Enter bend angle (degrees): ";
std::cin >> bendAngleDegrees;
std::cout << "Enter inside bend radius (mm): ";
std::cin >> insideRadius;
std::cout << "Enter material thickness (mm): ";
std::cin >> materialThickness;
std::cout << "Enter K-factor: ";
std::cin >> kFactor;
// Create a BendDeduction object with user-provided values
BendDeduction bendCalculator(bendAngleDegrees, insideRadius, materialThickness, kFactor);
// Call the object's method to calculate bend deduction
double bendDeduction = bendCalculator.calculateBendDeduction();
// Display the result
std::cout << "Bend Deduction: " << bendDeduction << " mm\n";
break;
case 2:
// Call function to load data (implementation pending) // Load Data
std::string fileName;
std::cout << "Enter the CSV file name to load: ";
std::cin >> fileName;
DataLoad::loadDataFromCSV(fileName); // Call the static method
std::cout << "Data loaded (assuming successful parsing).\n";
std::cout << "Data is already loaded.\n";
break;
case 3:
// Save Data
std::string fileName;
std::string dataToSave;
std::cout << "Enter the CSV file name to save: ";
std::cin >> fileName;
std::cout << "Enter the data to save: ";
std::cin >> dataToSave;
DataSave::saveDataToCSV(fileName, dataToSave);
std::cout << "Data saved successfully.\n";
break;
case 4:
std::cout << "Exiting...\n";
return 0;
default:
std::cout << "Invalid choice. Please try again.\n";
}
return 0;
}