I'm looking for methods to export a STEP file into separate STL ones, and extracting relevant information from each of the parts (such as position in the whole model, rotation [if any], colors, and material [if possible]), so I use those in another program that needs STL inputs.
So far I have been trying to work with OpenCascade, but I'm a complete newbie there, and haven't had the proper progress. The code I've been working with so far is shown below (it's just a sample I found in the examples, but I don't really understand the outputs).
#include <iostream>
#include <STEPControl_Reader.hxx>
//#include <STEPCAFControl_Reader.hxx>
#include <Interface_Static.hxx>
#include <string>
int main(){
STEPControl_Reader CAFReader;
IFSelect_ReturnStatus Status = CAFReader.ReadFile("/home/User/Geometry/Module.step");
Standard_Integer ic = Interface_Static::SetIVal("read.precision.mode",1);
Standard_Real rp = Interface_Static::SetRVal("read.precision.val",0.0001);
cout<<ic<<endl;
cout<<rp<<endl;
What I would really need would be the export separate files in .stl and ideally vector(s) containing (for each of the parts):
- Position
- Rotation
- Color
- Material
Any inputs would be highly appreciated :)
Thank you in advance.