Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <memory>
5 #include <stdexcept>
6 #include <vector>
7 #include <string>
8 
9 #if _MSC_VER
10 # if defined(LIBCONVERTER_BUILD)
11 # define CONVERTER_API __declspec (dllexport)
12 # else
13 # define CONVERTER_API __declspec (dllimport)
14 # endif
15 #elif defined(LINUX_SYSTEM)
16 # if defined(LIBCONVERTER_BUILD)
17 # define CONVERTER_API __attribute__ ((visibility ("default")))
18 # else
19 # define CONVERTER_API
20 # endif
21 #else
22 # define CONVERTER_API
23 #endif
24 
25 
26 namespace SC { namespace Store {
27  class MemoryDevice
28 } }
29 
30 
31 namespace Communicator {
33  class Exception : public std::runtime_error {
34  public:
35  Exception(std::string const & message) : std::runtime_error(message) {}
36  }
37 
38  struct Camera {
39  enum class Projection {
42  Stretched,
43  }
44 
46  float position[3]
47  float target[3]
48  float up_vector[3]
51  }
52 
53  enum class ViewOrientation {
55 
56  Top,
57 
59  Bottom,
60 
62  Left,
63 
65  Right,
66 
68  Front,
69 
71  Back,
72 
74  Iso,
75 
80  TopBack,
81  TopFront,
82  TopLeft,
83  TopRight,
84 
90  BottomBack,
91  BottomLeft,
93 
94  RightFront,
95  RightBack,
96 
97  LeftBack,
98  LeftFront,
99 
100  //2015 options
101  Iso2015,
102  None2015,
103  XY,
104  YX,
105  YZ,
106  ZY,
107  ZX,
108  XZ,
109 
110  }
111 
112  enum class RenderingMode {
114  Shaded,
115  HiddenLine
116  }
117 
118  enum class LightingMode {
119  Lighting2015,
121  }
122 
124  public:
127 
129  bool export_attributes = false
130 
132  bool export_materials = false
133 
135  bool export_matrices = true
136 
138  bool export_measurement = true
139 
142 
145 
147  bool sc_compress_models = false
148 
150  bool sc_create_scz = false
151 
153  bool sc_compress_scz = true
154 
156  bool sc_logging = false
157 
159  bool set_wire_to_black = true
160 
162  bool export_pmi = true
163 
165  bool export_views = true
166 
168  std::string compute_bounding_boxes = "None"
169 
172 
175 
178 
181 
183  bool stl_ascii = false
184 
187 
189  bool prc_remove_brep = false
190 
193 
195  bool generate_LODs = false
196 
198  bool clean_conflicting = true
199 
201  int step_format = 2
202 
204  bool sc_discard_lines = false
205 
208 
210  bool sc_compute_lines = false
211 
214 
217 
220 
223 
225  SC::Store::MemoryDevice * memory_device = nullptr
226 
228  bool export_exchange_ids = false
229  }
230 
232  public:
233  SC_Import_Options() = default
234 
237 
239  bool import_pmi = true
240 
243 
245  bool read_geometry = true
246 
248  bool read_attributes = true
249 
251  bool read_full_path = false
252 
254  bool read_wireframes = true
255 
258 
261 
264 
266  std::vector<std::string> texture_search_directories
267 
270 
273 
276 
278  std::vector<std::string> prc_font_directories
279 
281  std::vector<std::string> search_directories
282 
284  std::string substitution_font
285 
288 
290  bool force_capping = false
291  }
292 
293  struct Color {
294  Color() : red(0.0f), green(0.0f), blue(0.0f), alpha(1.0f) {}
295  Color(float red, float green, float blue, float alpha) : red(red), green(green), blue(blue), alpha(alpha) {}
296  float red
297  float green
298  float blue
299  float alpha
300  }
301 
302  class PrcModel
303  class HPSModel
304 
305  class ConverterImpl
306  class ImporterImpl
307 
308 
311  {
312  public:
314  Converter()
315  ~Converter()
316 
322  bool Init(char const *license)
323  void SetLogfile(char const *logfile, SC::Store::MemoryDevice *memory_device = nullptr)
324  void GetVersion(int &major, int &minor) const
325  const char *GetBuildId() const
326  void GetSCVersion(int &version) const
327 
328  private:
329  const char *GetLicense() const
330  friend class Importer
331 
332  ConverterImpl * _impl
333  }
334 
340  {
341  public:
345  Importer()
346  ~Importer()
347 
349  bool Init(Converter *converter, std::string output_model_logfile = std::string(), int debug_flags = 0)
350 
352  bool Load(char const *filename, SC_Import_Options import_options)
353 
355  bool Load(void *modelFile)
356 
357  private:
358  friend class Exporter
359  ImporterImpl * _impl = nullptr
360  }
361 
364  {
365  public:
366  Exporter()
367  ~Exporter()
368 
370  bool Init(Importer *importer)
371 
379  bool WriteSC(char const *utf8_model_path, char const *utf8_scs_filename, SC_Export_Options export_options)
380 
388  bool WriteHTML(const char* utf8_html_path, const char* utf8_html_template_path, SC_Export_Options export_options)
389 
390 
397  bool WriteXML(const char *out_filename, SC_Export_Options export_options)
398 
399 
416  bool WritePNG(
417  char const * outFilename,
418  int xres,
419  int yres,
420  Color backgroundColor,
421  Camera * cameraOverride = nullptr,
423  bool fitWorldExact = false,
424  bool enableHiddenLine = false,
425  bool enableTransparentBackground = false,
426  bool exportPmi = true,
429 
435  bool WriteHSF(char const *out_filename)
436 
445  bool WritePDF(char const *out_filename, const char *template_filename, const char *modify_list, Color background_color, SC_Export_Options export_options)
446 
452  bool WritePRC(const char *out_filename, SC_Export_Options export_options)
453 
460  bool WriteSTEP(const char *out_filename, SC_Export_Options export_options)
461 
468  bool WriteSTL(const char *out_filename, SC_Export_Options export_options)
469 
475  bool WriteXT(const char *out_filename)
476 
483  bool Write3MF(const char *out_filename, SC_Export_Options export_options = SC_Export_Options())
484 
491  bool WriteJT(const char *out_filename, SC_Export_Options export_options = SC_Export_Options())
492 
499  bool WriteDependencies(const char *out_filename, SC::Store::MemoryDevice * memory_device = nullptr)
500 
507  bool WriteXMLBOM(const char *out_filename, SC::Store::MemoryDevice * memory_device = nullptr)
508 
515  bool WriteConfigFile(const char *out_filename, SC::Store::MemoryDevice * memory_device = nullptr)
516 
525  bool WriteSCMaster(const char *xmlFile, const char *modelsPath, const char *outputFile, SC_Export_Options export_options)
526 
535  bool WriteSCShattered(SC_Export_Options export_options)
536 
537  private:
538  Importer *m_pImporter
539  }
540 
541 }
bool read_wireframes
Definition: libconverter.h:254
int tessellation_quality
Definition: libconverter.h:144
std::string substitution_font
Definition: libconverter.h:284
bool prc_remove_brep
Definition: libconverter.h:189
float field_width
Definition: libconverter.h:49
float green
Definition: libconverter.h:297
std::vector< std::string > search_directories
Definition: libconverter.h:281
Definition: libconverter.h:363
bool always_substitute_font
Definition: libconverter.h:242
float blue
Definition: libconverter.h:298
bool sc_compress_models
Definition: libconverter.h:147
bool stl_ascii
Definition: libconverter.h:183
int sc_discard_normals
Definition: libconverter.h:207
bool sc_compute_lines_split_faces
Definition: libconverter.h:216
double sc_compute_lines_min_triangle_angle
Definition: libconverter.h:219
Definition: libconverter.h:293
bool sc_compute_lines
Definition: libconverter.h:210
bool export_measurement
Definition: libconverter.h:138
Color(float red, float green, float blue, float alpha)
Definition: libconverter.h:295
std::string prepare_shattered_xml
Definition: libconverter.h:177
int drawings_mode
Definition: libconverter.h:272
bool import_pmi
Definition: libconverter.h:239
bool load_all_configurations
Definition: libconverter.h:257
bool export_attributes
Definition: libconverter.h:129
RenderingMode
Definition: libconverter.h:112
Projection
Definition: libconverter.h:39
int step_format
Definition: libconverter.h:201
std::vector< std::string > prc_font_directories
Definition: libconverter.h:278
float field_height
Definition: libconverter.h:50
bool sc_discard_lines
Definition: libconverter.h:204
std::string prepare_shattered_scs_parts
Definition: libconverter.h:174
std::string prepare_shattered_parts
Definition: libconverter.h:171
LightingMode
Definition: libconverter.h:118
Definition: libconverter.h:310
bool sc_compute_lines_add_non_adjacent
Definition: libconverter.h:213
bool export_materials
Definition: libconverter.h:132
bool sc_logging
Definition: libconverter.h:156
bool export_physical_properties
Definition: libconverter.h:141
float target[3]
Definition: libconverter.h:47
std::vector< std::string > texture_search_directories
Definition: libconverter.h:266
bool export_matrices
Definition: libconverter.h:135
SC::Store::MemoryDevice * memory_device
Definition: libconverter.h:225
bool export_assemblytree
Definition: libconverter.h:126
bool import_hidden_objects
Definition: libconverter.h:236
bool generate_LODs
Definition: libconverter.h:195
Definition: libconverter.h:231
Definition: libconverter.h:339
int revit_physical_properties
Definition: libconverter.h:287
Exception(std::string const &message)
Definition: libconverter.h:35
double sc_compute_lines_max_polyline_angle
Definition: libconverter.h:222
bool export_exchange_ids
Definition: libconverter.h:228
Color()
Definition: libconverter.h:294
bool sc_compress_scz
Definition: libconverter.h:153
Definition: libconverter.h:31
Projection projection
Definition: libconverter.h:45
int tessellation_quality
Definition: libconverter.h:260
#define CONVERTER_API
Definition: libconverter.h:22
Definition: libconverter.h:33
bool read_full_path
Definition: libconverter.h:251
Definition: libconverter.h:38
bool read_attributes
Definition: libconverter.h:248
bool export_pmi
Definition: libconverter.h:162
std::string compute_bounding_boxes
Definition: libconverter.h:168
bool prc_tessellation_compression
Definition: libconverter.h:192
bool sc_create_scz
Definition: libconverter.h:150
int multi_process_assembly_loading
Definition: libconverter.h:275
Definition: libconverter.h:123
float up_vector[3]
Definition: libconverter.h:48
Definition: libconverter.h:26
std::string sc_working_directory
Definition: libconverter.h:180
bool clean_conflicting
Definition: libconverter.h:198
float position[3]
Definition: libconverter.h:46
bool force_capping
Definition: libconverter.h:290
bool read_geometry
Definition: libconverter.h:245
bool export_views
Definition: libconverter.h:165
int jt_level_of_detail
Definition: libconverter.h:263
bool set_wire_to_black
Definition: libconverter.h:159
float red
Definition: libconverter.h:296
float alpha
Definition: libconverter.h:299
std::string configuration_to_load
Definition: libconverter.h:269
ViewOrientation
Definition: libconverter.h:53
int prc_brep_compression
Definition: libconverter.h:186