1

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.

lghizoni
  • 113
  • 10
  • 1
    Did you find the thread at https://www.opencascade.com/content/write-stl ? That was the first hit for "opencascase step stl" and seems to be what you need. – Botje Sep 12 '19 at 11:45
  • Thanks a lot for the input :) ! It helped me a lot, plus I found this thread that completed what I needed: https://www.opencascade.com/content/correct-location-parts-after-step-import – lghizoni Oct 01 '19 at 09:11

0 Answers0