diff --git a/.vscode/browse.vc.db b/.vscode/browse.vc.db index bb83416..c3931d9 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 ff4d95c..4cba9c0 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 0d3eab6..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 e971f66..6a6913a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,6 @@ 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) diff --git a/docs/BendDeduction.md b/docs/BendDeduction.md index c450dbb..9b5b96d 100644 --- a/docs/BendDeduction.md +++ b/docs/BendDeduction.md @@ -18,8 +18,22 @@ 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. + 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 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 + +Bend deduction is a crucial concept in sheet metal fabrication, allowing for accurate prediction of the final size of a part after bending. It accounts for the material's stretch and compression during the bending process. The formula provided for calculating bend deduction is not standard and seems to be a misunderstanding. Instead, bend deduction is typically calculated using the bend allowance and the outside setback (OSSB). The correct approach involves understanding several key factors: + + Bend Angle (θθ): The angle to which the metal is bent. + Inside Radius (R): The radius on the inside of the bend, where the material undergoes compression. + Material Thickness (T): The thickness of the sheet metal being bent. + K-Factor (K): A coefficient that represents the location of the neutral axis (the layer within the material that does not experience tension or compression during bending) relative to the thickness of the material. This factor varies based on material properties and bending operations. + +The bend deduction (BD) can be calculated using the formula: BD=2×OSSB−BABD=2×OSSB−BA where: + + OSSB (Outside Setback) is calculated based on the material thickness, inside radius, and bend angle. + Bend Allowance (BA) is the arc length of the bend along the neutral axis. It accounts for the material stretch in the bending area and is calculated using the formula that incorporates the K-factor, bend angle, inside radius, and material thickness. + +The K-factor is instrumental in determining the bend allowance and, subsequently, the bend deduction. It influences how the neutral axis shifts during bending, affecting the material's elongation and the final dimensions of the bent part. diff --git a/docs/Setback.md b/docs/Setback.md new file mode 100644 index 0000000..3fe3013 --- /dev/null +++ b/docs/Setback.md @@ -0,0 +1,33 @@ +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 + +Setback is a term used in sheet metal forming to describe the distance from the edge of the sheet to the tangent point of the bend radius. There are two types of setback: inside setback (ISSB) and outside setback (OSSB). These are important for calculating the flat pattern layout of a part before bending. +Inside Setback (ISSB) +Inside setback is the distance from the inside surface of the sheet metal to the tangent point of the bend radius. It is a measure of how much the material compresses on the inside of the bend. +Outside Setback (OSSB) +Outside setback is the distance from the tangent point of the bend radius to the outside bend vertex of the flange. It is a measure of how much the material stretches on the outside of the bend. +Factors Affecting Setback Calculation + + Bend Angle (αα): The angle to which the metal is bent. The bend angle affects the setback because it changes the arc length of the bend. + Inside Radius (R): The radius of the bend on the inside of the material. The inside radius affects the setback because it determines how much the material compresses. + Sheet Thickness (T): The thickness of the sheet metal being bent. The thickness contributes to the overall setback because it affects the position of the neutral axis. + +Calculating Outside Setback +For outside setback, the formula is: Outside Setback=T+R2−(Tsin⁡(α))2Outside Setback=T+R2−(sin(α)T​)2 +​ This 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. + +Relationship Between Setback, Bend Deduction, and Bend Allowance +The bend deduction (BD) and bend allowance (BA) are related to the setbacks. The bend deduction is the amount of material that must be subtracted from the total length of the flat pattern to achieve the correct size after bending. The bend allowance is the length of the neutral axis through the bend. The sum of the bend deduction and bend allowance is equal to two times the outside setback: BD+BA=2×OSSBBD+BA=2×OSSB diff --git a/include/BendDeduction.h b/include/BendDeduction.h new file mode 100644 index 0000000..535a404 --- /dev/null +++ b/include/BendDeduction.h @@ -0,0 +1,16 @@ +#ifndef BENDDUCTION_H +#define BENDDUCTION_H + +class BendDeduction { +private: + double bendAngleRadians; // Bend angle in radians + double insideRadius; // Inside radius of the bend + double materialThickness; // Thickness of the material + double kFactor; // K-factor + +public: + BendDeduction(double angleDegrees, double radius, double thickness, double k); + double calculateBendDeduction(); +}; + +#endif \ No newline at end of file diff --git a/include/FormingTool.h b/include/FormingTool.h index 8e8650e..f62dc48 100644 --- a/include/FormingTool.h +++ b/include/FormingTool.h @@ -1,4 +1,29 @@ -/* - * - * - */ \ No newline at end of file +#ifndef FORMINGTOOL_H +#define FORMINGTOOL_H + +#include +#include +#include + +class FormingTool { +public: + FormingTool(const std::string &toolType, double toolSize, const std::string &materialType); + std::string getToolType() const; + double getToolSize() const; + std::string getMaterialType() const; + double getToolRadius() const; + void setToolType(const std::string &toolType); + void setToolSize(double toolSize); + void setMaterialType(const std::string &materialType); + void setToolRadius(double radius); + void serialize(std::ofstream &ofs) const; + void deserialize(std::ifstream &ifs); + +private: + std::string m_toolType; + double m_toolSize; + std::string m_materialType; + double m_toolRadius; +}; + +#endif // FORMINGTOOL_H \ No newline at end of file diff --git a/include/Setback.h b/include/Setback.h index 153f0d0..e69de29 100644 --- a/include/Setback.h +++ b/include/Setback.h @@ -1,15 +0,0 @@ -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 index e69de29..eed51e4 100644 --- a/src/BendDeduction.cpp +++ b/src/BendDeduction.cpp @@ -0,0 +1,25 @@ +#include + +class BendDeduction { +private: + double bendAngleRadians; // Bend angle in radians + double insideRadius; // Inside radius of the bend + double materialThickness; // Thickness of the material + double kFactor; // K-factor + +public: + // Constructor to initialize the properties + BendDeduction(double angleDegrees, double radius, double thickness, double k) + : bendAngleRadians(angleDegrees * M_PI / 180.0), // Convert degrees to radians + insideRadius(radius), + materialThickness(thickness), + kFactor(k) {} + + // Method to calculate the bend deduction + double calculateBendDeduction() { + double ossb = (insideRadius + materialThickness) * tan(bendAngleRadians / 2.0); + double ba = (M_PI / 180.0) * bendAngleRadians * (insideRadius + kFactor * materialThickness); + double bd = 2 * ossb - ba; + return bd; + } +}; \ No newline at end of file diff --git a/src/FormingTool.cpp b/src/FormingTool.cpp index 457543e..6e05da6 100644 --- a/src/FormingTool.cpp +++ b/src/FormingTool.cpp @@ -1,15 +1,65 @@ #include "FormingTool.h" +#include "Deserializer.h" +#include "Serializer.h" +#include +#include -FormingTool::FormingTool(const std::string& name, double toolRadius, const std::string& materialType) - : m_name(name), m_toolRadius(toolRadius), m_materialType(materialType) { - // Constructor implementation +FormingTool::FormingTool(const std::string &toolType, double toolSize, const std::string &materialType) + : m_toolType(toolType), m_toolSize(toolSize), m_materialType(materialType), m_toolRadius(0.0) // Assuming default value for radius +{ } -double FormingTool::getToolRadius() const { - return m_toolRadius; +double FormingTool::getToolRadius() const +{ + return m_toolRadius; } -void FormingTool::setToolRadius(double radius) { - m_toolRadius = radius; +double FormingTool::getToolSize() const +{ + return m_toolSize; +} + +std::string FormingTool::getToolType() const +{ + return m_toolType; +} + +std::string FormingTool::getMaterialType() const +{ + return m_materialType; +} + +void FormingTool::setToolRadius(double radius) +{ + m_toolRadius = radius; +} + +void FormingTool::setToolSize(double toolSize) +{ + m_toolSize = toolSize; +} + +void FormingTool::setToolType(const std::string &toolType) +{ + m_toolType = toolType; +} + +void FormingTool::setMaterialType(const std::string &materialType) +{ + m_materialType = materialType; +} + +void FormingTool::useTool() +{ + std::cout << "Using " << m_toolType << " of size " << m_toolSize << std::endl; +} + +void FormingTool::serialize(std::ofstream &ofs) const +{ + ofs << m_toolType << " " << m_toolSize << std::endl; +} + +void FormingTool::deserialize(std::ifstream &ifs) +{ + ifs >> m_toolType >> m_toolSize; } -// Implement other methods related to forming tools \ No newline at end of file