Horizon
step_importer.hpp
1 #pragma once
2 #include "import.hpp"
3 #include <TDocStd_Document.hxx>
4 #include <TopoDS_Shape.hxx>
5 #include <TopoDS_Face.hxx>
6 #include <TopoDS_Wire.hxx>
7 #include <Quantity_Color.hxx>
8 #include <XCAFApp_Application.hxx>
9 #include <XCAFDoc_ColorTool.hxx>
10 #include <glm/glm.hpp>
11 
12 namespace horizon::STEPImporter {
13 class STEPImporter {
14 public:
15  STEPImporter(const std::string &filename);
16 
17  Result get_faces_and_points();
18  bool is_loaded() const
19  {
20  return loaded;
21  }
22  std::vector<TopoDS_Shape> get_shapes();
23 
24 private:
25  bool readSTEP(const char *fname);
26  bool processNode(const TopoDS_Shape &shape);
27  bool processComp(const TopoDS_Shape &shape, const glm::dmat4 &mat_in = glm::dmat4(1));
28  bool processSolid(const TopoDS_Shape &shape, const glm::dmat4 &mat_in = glm::dmat4(1));
29  bool getColor(TDF_Label label, Quantity_Color &color);
30  bool processShell(const TopoDS_Shape &shape, Quantity_Color *color, const glm::dmat4 &mat = glm::dmat4(1));
31  bool processFace(const TopoDS_Face &face, Quantity_Color *color, const glm::dmat4 &mat = glm::dmat4(1));
32  void processWire(const TopoDS_Wire &wire, const glm::dmat4 &mat);
33 
34  Handle(XCAFApp_Application) m_app;
35  Handle(TDocStd_Document) m_doc;
36  Handle(XCAFDoc_ColorTool) m_color;
37  Handle(XCAFDoc_ShapeTool) m_assy;
38  bool hasSolid;
39  bool loaded = false;
40 
41  Result *result;
42 };
43 } // namespace horizon::STEPImporter
Definition: import.hpp:75
Definition: step_importer.hpp:13