From 670b00a3c6065d3b654fa10de2114cb2638740ec Mon Sep 17 00:00:00 2001 From: kaijohnsonn Date: Tue, 6 Feb 2024 21:00:02 -0500 Subject: [PATCH] fixed cmake list --- backend/CMakeLists.txt | 4 +-- backend/src/igs_to_todoDsShape.cpp | 23 ++++++++++++++++++ backend/src/todoDsShape_to_geomCurve.cpp | 31 ------------------------ 3 files changed, 25 insertions(+), 33 deletions(-) delete mode 100644 backend/src/todoDsShape_to_geomCurve.cpp diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index a385d01..6614fbd 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -11,8 +11,8 @@ target_link_libraries(cad_to_gcode ${OpenCASCADE_LIBRARIES}) # Include OpenCASCADE directories include_directories(${OpenCASCADE_INCLUDE_DIR}) -add_executable(todoShape_to_geomCurve src/todoDsShape_to_geomCurve.cpp src/igs_to_todoDsShape.cpp src/ShapeProcessor.hpp) -target_link_libraries(todoShape_to_geomCurve ${OpenCASCADE_LIBRARIES}) +add_executable(igs_to_todoDsShape src/igs_to_todoDsShape.cpp) +target_link_libraries(igs_to_todoDsShape ${OpenCASCADE_LIBRARIES}) # Add a new executable for IGES to TopoDS_Shape conversion # add_executable(iges_to_shape src/igs_to_todoDsShape.cpp) diff --git a/backend/src/igs_to_todoDsShape.cpp b/backend/src/igs_to_todoDsShape.cpp index 117a209..bb4c074 100644 --- a/backend/src/igs_to_todoDsShape.cpp +++ b/backend/src/igs_to_todoDsShape.cpp @@ -10,6 +10,29 @@ #include "ShapeProcessor.hpp" #include + +void ProcessShape(const TopoDS_Shape &shape) +{ + // Iterate through all edges in the shape + for (TopExp_Explorer explorer(shape, TopAbs_EDGE); explorer.More(); explorer.Next()) + { + TopoDS_Edge edge = TopoDS::Edge(explorer.Current()); + + // Convert TopoDS_Edge to Geom_Curve + BRepAdaptor_Curve curveAdapter(edge); + Handle(Geom_Curve) geomCurve = curveAdapter.Curve().Curve(); + + // Analyze the curve (e.g., calculate length) + double length = GCPnts_AbscissaPoint::Length(curveAdapter); + + // If the curve is a bend, analyze its attributes + // This would involve more specific logic, depending on how bends are defined + + // Example output + std::cout << "Curve Length: " << length << std::endl; + } +} + int main(int argc, char *argv[]) { diff --git a/backend/src/todoDsShape_to_geomCurve.cpp b/backend/src/todoDsShape_to_geomCurve.cpp deleted file mode 100644 index 91f24dc..0000000 --- a/backend/src/todoDsShape_to_geomCurve.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "ShapeProcessor.hpp" -#include -#include -#include -#include -#include -#include -#include - -// Function to process a TopoDS_Shape and analyze its geometrical properties -void ProcessShape(const TopoDS_Shape &shape) -{ - // Iterate through all edges in the shape - for (TopExp_Explorer explorer(shape, TopAbs_EDGE); explorer.More(); explorer.Next()) - { - TopoDS_Edge edge = TopoDS::Edge(explorer.Current()); - - // Convert TopoDS_Edge to Geom_Curve - BRepAdaptor_Curve curveAdapter(edge); - Handle(Geom_Curve) geomCurve = curveAdapter.Curve().Curve(); - - // Analyze the curve (e.g., calculate length) - double length = GCPnts_AbscissaPoint::Length(curveAdapter); - - // If the curve is a bend, analyze its attributes - // This would involve more specific logic, depending on how bends are defined - - // Example output - std::cout << "Curve Length: " << length << std::endl; - } -} \ No newline at end of file