CFx SDK Documentation  2022 SP0
FxBIM.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2020-2021 by Graebert GmbH.
3 //
4 // Permission to use, copy, modify, and distribute this software in
5 // object code form for any purpose and without fee is hereby granted,
6 // provided that the above copyright notice appears in all copies and
7 // that both that copyright notice and the limited warranty and
8 // restricted rights notice below appear in all supporting
9 // documentation.
10 //
11 // GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12 // GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14 // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15 // UNINTERRUPTED OR ERROR FREE.
16 
17 #pragma once
18 
19 #ifndef _MSC_VER
20  #define FXBIM_API
21 #else
22  #if defined( FX_STATIC_BUILD )
23  #define FXBIM_API
24  #else
25  #ifdef FXBIM_EXPORTS
26  #define FXBIM_API __declspec(dllexport)
27  #else
28  #define FXBIM_API __declspec(dllimport)
29  #endif
30  #endif
31 #endif
32 
33 #include <QtCore/QString>
34 
35 #include <OdaCommon.h>
36 #include <OdaDefs.h>
37 #include <sdk/FxBIMEntityReference.h>
38 
39 #if defined (Q_OS_LINUX)
40 #include <memory>
41 #endif
42 
43 enum class Error
44 {
45  eOk = 0,
46  eFail,
47  eAbort,
59  eNotFound,
69 };
70 
71 enum class fileType
72 {
73  eUnknown = 0,
74  eRevit = 1,
75  eIFC = 2,
76 };
77 
78 class OdString;
80 
81 #include <functional>
82 #include <RxObject.h>
83 
86 
88 {
89  enum Type
90  {
95  } _c;
96 
97  using fn_start_t = std::function< void( const OdString& viewName, OdInt64 idView ) >;
98  using fn_ready_t = std::function< void( const OdString& dwgPath, const OdString& originalPath, const OdString& viewName, OdInt64 idView, int flags ) >;
99  using fn_finish_t = std::function< void( int exitCode, int exitStatus ) >;
100  using fn_abort_t = std::function< bool() >;
101  using fn_error_t = std::function< void( const OdString& err ) >;
102 
103  struct Data
104  {
105  fn_start_t _fnStart = nullptr;
106  fn_ready_t _fnReady = nullptr;
107  fn_finish_t _fnFinish = nullptr;
108  fn_abort_t _fnAbort = nullptr;
109  fn_error_t _fnError = nullptr;
110  OdDbHostAppProgressMeter* _pProgress = 0;
111  } _d;
112 
113  enum Flags
114  {
116  };
117  int _flags = eFNone;
118 
120  explicit Conversion( fileType type, Data data, int flags );
121 
122  static Conversion::Type FromString( const OdString& arg );
123  static OdString ToString( const Conversion& c );
124 };
125 
126 namespace FxBIM
127 {
128  static OdString kBIMModuleName = OD_T( "FxBIM" );
129 
130  enum Version
131  {
132  k2019 = 1,
133  k2020 = 2,
134  k2021 = 3,
135  kSP0 = 0,
136  kSP1 = 1,
137  kSP2 = 2,
138  kSP3 = 3,
139  };
140 
141  static OdInt16 kCurrenVersionMajor = k2020;
142  static OdInt16 kCurrenVersionMinor = kSP3;
143  static OdInt16 kCurrenVersionRevision = 5;
144 
145  FXBIM_API OdInt64 bimVersion( OdInt16 major, OdInt16 minor, OdInt16 revision );
147 }
148 
149 FXBIM_API OdString convert( const QString& qstr );
150 FXBIM_API QString convert( const OdString& odstr );
151 
152 class CFxBIMObject;
153 typedef std::shared_ptr< CFxBIMObject > CFxBIMObjectPtr;
154 
155 class FXBIM_API CFxBIMObject : public std::enable_shared_from_this< CFxBIMObject >
156 {
157 protected:
159  virtual ~CFxBIMObject();
160 };
161 
162 #include <DbObjectId.h>
163 
164 namespace FxBIM
165 {
166  template <typename T>
167  std::shared_ptr<T> cast( CFxBIMObjectPtr pBase )
168  {
169  std::shared_ptr<T> p = std::dynamic_pointer_cast< T, CFxBIMObject >( pBase );
170  return( p );
171  }
172 
173  template <typename T>
174  OdSmartPtr<T> cast( OdDbObjectId id, OdDb::OpenMode mode = OdDb::kForRead, bool openErased = false )
175  {
176  OdSmartPtr<T> p = T::cast( id.openObject( mode, openErased ) );
177  return( p );
178  }
179 }
180 
181 class CFxBIMIterator;
182 typedef std::shared_ptr< CFxBIMIterator > CFxBIMIteratorPtr;
183 class CFxBIMIteratorRA;
184 typedef std::shared_ptr< CFxBIMIteratorRA > CFxBIMIteratorRAPtr;
185 class CFxBIMDbIterator;
186 typedef std::shared_ptr< CFxBIMDbIterator > CFxBIMDbIteratorPtr;
187 class CFxBIMDbIteratorRA;
188 typedef std::shared_ptr< CFxBIMDbIteratorRA > CFxBIMDbIteratorRAPtr;
189 
190 #include <functional>
191 
193 {
194 public:
195  virtual void SetPredicate( std::function< bool( CFxBIMObjectPtr ) > p ) = 0;
196  virtual void Start() = 0;
197  virtual bool Done() = 0;
198  virtual void Next() = 0;
199 
200  virtual CFxBIMObjectPtr Object() = 0;
201 };
202 
204 {
205 public:
206  virtual size_t Count() = 0;
207  virtual CFxBIMObjectPtr Object( size_t index ) = 0;
208 };
209 
210 #include <DbObjectId.h>
211 
213 {
214 public:
215  virtual void SetPredicate( std::function< bool( OdDbObjectId ) > p ) = 0;
216  virtual void Start() = 0;
217  virtual bool Done() = 0;
218  virtual void Next() = 0;
219 
220  virtual OdDbObjectId Object() = 0;
221 };
222 
224 {
225 public:
226  virtual size_t Count() = 0;
227  virtual OdDbObjectId Object( size_t index ) = 0;
228 };
229 
230 namespace FxBIM
231 {
232  FXBIM_API double BIMHPSCALE( const OdDbDatabase* pDb );
233  FXBIM_API void SetBIMHPSCALE( OdDbDatabase* pDb, const double& value );
234 
235  namespace Units
236  {
237  enum
238  {
242  eLengthM = 3,
246  };
247 
248  FXBIM_API double Scale( int dst, int src );
249  };
250 
252  FXBIM_API void SetBIMUNITSLENGTH( OdDbDatabase* pDb, const int& value );
253 
256 
259 };
std::shared_ptr< CFxBIMDbIterator > CFxBIMDbIteratorPtr
Definition: FxBIM.h:185
std::shared_ptr< CFxBIMDbIteratorRA > CFxBIMDbIteratorRAPtr
Definition: FxBIM.h:187
Error
Definition: FxBIM.h:44
@ eCVTViewUnset
@ eNullBmDatabase
@ eNullBmObjectId
@ eGeomIsNotGElement
@ eNullFamSymbol
@ eNullBmObject
@ eWrongRVTFormat
@ eDegenerateTopology
@ eDegenerateGeometry
@ eCVTInvalidConversionType
@ eGeomIsNotNode
@ eNullDbObjectId
@ eWrongIFCFormat
@ eNotFound
@ eNotThatKindOfClass
@ eNotImplemented
@ eCVTInvalidSource
@ eCVTInvalidParameter
@ eCVTInvalidDestinationFolder
@ eInvalidParameter
@ eCVTInvalidDestinationExists
std::shared_ptr< CFxBIMIteratorRA > CFxBIMIteratorRAPtr
Definition: FxBIM.h:183
FXBIM_API OdString convert(const QString &qstr)
#define FXBIM_API
Definition: FxBIM.h:20
OdSmartPtr< CFxBIMDatabaseReference > CFxBIMDatabaseReferencePtr
Definition: FxBIM.h:84
fileType
Definition: FxBIM.h:72
std::shared_ptr< CFxBIMObject > CFxBIMObjectPtr
Definition: FxBIM.h:152
std::shared_ptr< CFxBIMIterator > CFxBIMIteratorPtr
Definition: FxBIM.h:181
#define OD_T(x)
short OdInt16
virtual void Start()=0
virtual bool Done()=0
virtual void Next()=0
virtual void SetPredicate(std::function< bool(OdDbObjectId) > p)=0
virtual OdDbObjectId Object()=0
virtual size_t Count()=0
virtual OdDbObjectId Object(size_t index)=0
virtual void Start()=0
virtual bool Done()=0
virtual void Next()=0
virtual void SetPredicate(std::function< bool(CFxBIMObjectPtr) > p)=0
virtual CFxBIMObjectPtr Object()=0
virtual CFxBIMObjectPtr Object(size_t index)=0
virtual size_t Count()=0
virtual ~CFxBIMObject()
Definition: Int64.h:43
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
GLuint index
Definition: gles2_ext.h:265
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
@ eLengthUndefined
Definition: FxBIM.h:239
@ eLengthFeet
Definition: FxBIM.h:240
@ eLengthM
Definition: FxBIM.h:242
@ eLengthInch
Definition: FxBIM.h:241
@ eLengthDM
Definition: FxBIM.h:243
@ eLengthCM
Definition: FxBIM.h:244
@ eLengthMM
Definition: FxBIM.h:245
FXBIM_API double Scale(int dst, int src)
Definition: FxBIM.h:127
FXBIM_API OdInt64 currentVersion()
FXBIM_API void SetBIMCURRENTDIMSTYLE(OdDbDatabase *pDb, const OdString &value)
FXBIM_API void SetBIMVPSCALE(OdDbDatabase *pDb, const OdString &value)
FXBIM_API OdInt64 bimVersion(OdInt16 major, OdInt16 minor, OdInt16 revision)
FXBIM_API void SetBIMUNITSLENGTH(OdDbDatabase *pDb, const int &value)
std::shared_ptr< T > cast(CFxBIMObjectPtr pBase)
Definition: FxBIM.h:167
FXBIM_API int BIMUNITSLENGTH(const OdDbDatabase *pDb)
Version
Definition: FxBIM.h:131
@ kSP3
Definition: FxBIM.h:138
@ kSP2
Definition: FxBIM.h:137
@ kSP0
Definition: FxBIM.h:135
@ k2020
Definition: FxBIM.h:133
@ k2021
Definition: FxBIM.h:134
@ kSP1
Definition: FxBIM.h:136
@ k2019
Definition: FxBIM.h:132
FXBIM_API OdString BIMCURRENTDIMSTYLE(const OdDbDatabase *pDb)
FXBIM_API void SetBIMHPSCALE(OdDbDatabase *pDb, const double &value)
FXBIM_API OdString BIMVPSCALE(const OdDbDatabase *pDb)
OdSmartPtr< T > cast(OdDbObjectId id, OdDb::OpenMode mode=OdDb::kForRead, bool openErased=false)
Definition: FxBIM.h:174
FXBIM_API double BIMHPSCALE(const OdDbDatabase *pDb)
OpenMode
Definition: DbObjectId.h:54
@ kForRead
Definition: DbObjectId.h:56
std::function< void(const OdString &viewName, OdInt64 idView) > fn_start_t
Definition: FxBIM.h:97
@ eConvertFromRevit
Definition: FxBIM.h:92
@ eConvertFromIcf
Definition: FxBIM.h:93
@ eConvertToIcf
Definition: FxBIM.h:94
@ eNone
Definition: FxBIM.h:91
std::function< void(int exitCode, int exitStatus) > fn_finish_t
Definition: FxBIM.h:99
static Conversion::Type FromString(const OdString &arg)
@ eFNone
Definition: FxBIM.h:115
std::function< void(const OdString &dwgPath, const OdString &originalPath, const OdString &viewName, OdInt64 idView, int flags) > fn_ready_t
Definition: FxBIM.h:98
std::function< bool() > fn_abort_t
Definition: FxBIM.h:100
static OdString ToString(const Conversion &c)
Conversion(fileType type, Data data, int flags)
std::function< void(const OdString &err) > fn_error_t
Definition: FxBIM.h:101