-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from GenerateNU/feature/step-conversion
Feature/step conversion
- Loading branch information
Showing
1 changed file
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,42 @@ | ||
#include <iostream> | ||
#include <TopoDS_Shape.hxx> | ||
#include <STEPControl_Reader.hxx> | ||
#include <TopoDS_Shape.hxx> | ||
#include <BRepTools.hxx> | ||
#include <iostream> | ||
#include <string> | ||
using namespace std; | ||
|
||
TopoDS_Shape read_step(const string& filename) { | ||
STEPControl_Reader reader; | ||
IFSelect_ReturnStatus status = reader.ReadFile(filename.c_str()); | ||
|
||
if (status != IFSelect_RetDone) { | ||
cout << "Error reading STEP file." << endl; | ||
return TopoDS_Shape(); | ||
} | ||
|
||
cout << "Number of roots in STEP file: " << reader.NbRootsForTransfer() << endl; | ||
cout << "STEP roots transferred: " << reader.TransferRoots() << endl; | ||
cout << "Number of resulting shapes is: " << reader.NbShapes() << endl; | ||
|
||
TopoDS_Shape result = reader.OneShape(); | ||
|
||
if (result.IsNull()) { | ||
cout << "Error: The resulting shape is invalid." << endl; | ||
return TopoDS_Shape(); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
int main(int argc, char* argv[]) { | ||
std::cout << "hello world" << std::endl; | ||
TopoDS_Shape shape = TopoDS_Shape(); | ||
bool eq = shape.IsEqual(TopoDS_Shape()); | ||
std::cout << eq << std::endl; | ||
|
||
string full_frame_filename = "Full_Frame.STEP"; | ||
TopoDS_Shape full_frame_shape = read_step(full_frame_filename); | ||
|
||
string rrh_filename = "RRH.STEP"; | ||
TopoDS_Shape rrh_shape = read_step(rrh_filename); | ||
} |