IGES And STEP Files To STL Conversion Issue

  • Get involved
  • Resources
    • Download
    • Issue tracker
    • Git repository
    • Components
    • Online-documentation
    • Training & E-learning
    • Technical support
    • FAQ
    • Licensing
  • Blog
  • Forum
    • All Forums
    • Active Topics
  • About
  • Research & Science
  • Projects & Products
  • Contact us
IGES and STEP files to STL conversion issue Forums: Data Exchange and Application Framework

Im using these two code snippets to convert IGES and STEP files to STL file.

IGES to STL :

IGESControl_Reader reader; reader.ReadFile(file_in_occ); cout << "IGES File loaded" << endl; Handle(TColStd_HSequenceOfTransient) myList = reader.GiveList("iges-faces"); myList->Length(); reader.TransferRoots(); sh = reader.OneShape(); BRepMesh_IncrementalMesh aMesh(sh, 0.1); sh = aMesh.Shape(); StlAPI_Writer myStlWriter; myStlWriter.ASCIIMode() = Standard_True; myStlWriter.Write(sh, file_out_occ);

STEP to STL :

STEPControl_Reader reader; reader.ReadFile(file_in_occ); cout << "STEP File loaded" << endl; reader.TransferRoots(); sh = reader.OneShape(); BRepMesh_IncrementalMesh aMesh(sh, 0.1); sh = aMesh.Shape(); StlAPI_Writer myStlWriter; myStlWriter.ASCIIMode() = Standard_True; myStlWriter.Write(sh, file_out_occ);

The problem here is, for some files, conversion takes a long time and the file size sometimes go close to a GB. Im attaching such a file here.

But when I convert this same file using ImportExport application built from the given sample, the file size is just within 200kb. I expect an output similar to the one from ImportExport application.

Where have I gone wrong. Can someone please guide me to get the expected output.

Thank you

Attachments: File Part2.IGSBinary Data Part2.STEP Kirill Gavrilov's picture Kirill Gavrilov Tue, 08/04/2020 - 17:36

Your model is almost hundred meters in size, while mesh parameters ask for 0.1 mm precision. > BRepMesh_IncrementalMesh aMesh(sh, 0.1); I have some doubts that you would like to print a 1:1 replica of the model on 3D printer using generated STL file, so you should reconsider meshing parameters. When exact quality does not matter, linear deflection is usually computed based on model bounding box dimensions.

  • Log in to post comments
giridaran.unilogic_159669's picture giridaran.unilo... Tue, 08/04/2020 - 17:58

Thank you for your quick reply. Is there a function to get the bounding box dimensions, so that I can calculate the linear deflection for each model loaded instead of leaving it as a constant

  • Log in to post comments

Tag » How To Convert Iges To Stl