CFx SDK Documentation  2020SP3
FxBIM.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef _MSC_VER
4  #define FXBIM_API
5 #else
6  #if defined( FX_STATIC_BUILD )
7  #define FXBIM_API
8  #else
9  #ifdef FXBIM_EXPORTS
10  #define FXBIM_API __declspec(dllexport)
11  #else
12  #define FXBIM_API __declspec(dllimport)
13  #endif
14  #endif
15 #endif
16 
17 enum class Error
18 {
19  eOk = 0,
20  eFail,
21  eAbort,
22  eInvalidParameter,
23  eNullFamSymbol,
24  eGeomIsNotNode,
25  eGeomIsNotGElement,
27  eDegenerateTopology,
28  eDegenerateGeometry,
29  eNullBmDatabase,
30  eNullBmObject,
31  eNullBmObjectId,
32  eNullDbObjectId,
33  eNotFound,
34  eNotThatKindOfClass,
35  eWrongIFCFormat,
36  eWrongRVTFormat,
37  eCVTInvalidParameter,
38  eCVTInvalidConversionType,
39  eCVTInvalidSource,
40  eCVTInvalidDestinationFolder,
41  eCVTInvalidDestinationExists,
43 };
44 
45 enum class FileType
46 {
47  eUnknown = 0,
48  eRevit = 1,
49  eIFC = 2,
50 };
51 
52 class OdString;
54 
55 #include <functional>
56 #include <RxObject.h>
57 
60 
62 {
63  enum Type
64  {
69  } _c;
70 
71  using fn_start_t = std::function< void( const OdString& viewName, OdInt64 idView ) >;
72  using fn_ready_t = std::function< void( CFxBIMDatabaseReferencePtr, OdInt64 idView ) >;
73  using fn_finish_t = std::function< void( int exitCode, int exitStatus ) >;
74  using fn_abort_t = std::function< bool() >;
75  using fn_error_t = std::function< void( const OdString& error ) >;
76 
77  struct Data
78  {
79  fn_start_t _fnStart = nullptr;
80  fn_ready_t _fnReady = nullptr;
81  fn_finish_t _fnFinish = nullptr;
82  fn_abort_t _fnAbort = nullptr;
83  fn_error_t _fnError = nullptr;
84  OdDbHostAppProgressMeter* _pProgress = 0;
85  } _d;
86 
87  enum Flags
88  {
90  eFMultipleViews = 0x1,
91  };
92  int _flags = eFNone;
93 
95  explicit Conversion( FileType type, Data data, int flags );
96 
97  static Conversion::Type FromString( const OdString& arg );
98  static OdString ToString( const Conversion& c );
99 };
100 
101 namespace FxBIM
102 {
103  static OdString kBIMModuleName = OD_T( "FxBIM" );
104 
105  enum Version
106  {
107  k2019 = 1,
108  k2020 = 2,
109  k2021 = 3,
110  kSP0 = 0,
111  kSP1 = 1,
112  kSP2 = 2,
113  kSP3 = 3,
114  };
115 
116  static OdInt16 kCurrenVersionMajor = k2020;
117  static OdInt16 kCurrenVersionMinor = kSP3;
118  static OdInt16 kCurrenVersionRevision = 1;
119 
120  FXBIM_API OdInt64 bimVersion( OdInt16 major, OdInt16 minor, OdInt16 revision );
122 }
123 
124 FXBIM_API OdString convert( const QString& qstr );
125 FXBIM_API QString convert( const OdString& odstr );
126 
127 class CFxBIMObject;
128 typedef std::shared_ptr< CFxBIMObject > CFxBIMObjectPtr;
129 
130 class FXBIM_API CFxBIMObject : public std::enable_shared_from_this< CFxBIMObject >
131 {
132 protected:
134  virtual ~CFxBIMObject();
135 };
136 
137 #include <DbObjectId.h>
138 
139 namespace FxBIM
140 {
141  template <typename T>
142  std::shared_ptr<T> cast( CFxBIMObjectPtr pBase )
143  {
144  std::shared_ptr<T> p = std::dynamic_pointer_cast< T, CFxBIMObject >( pBase );
145  return( p );
146  }
147 
148  template <typename T>
150  {
151  OdSmartPtr<T> p = T::cast( id.openObject( mode ) );
152  return( p );
153  }
154 }
155 
156 class CFxBIMIterator;
157 typedef std::shared_ptr< CFxBIMIterator > CFxBIMIteratorPtr;
158 class CFxBIMIteratorRA;
159 typedef std::shared_ptr< CFxBIMIteratorRA > CFxBIMIteratorRAPtr;
160 class CFxBIMDbIterator;
161 typedef std::shared_ptr< CFxBIMDbIterator > CFxBIMDbIteratorPtr;
162 class CFxBIMDbIteratorRA;
163 typedef std::shared_ptr< CFxBIMDbIteratorRA > CFxBIMDbIteratorRAPtr;
164 
165 #include <functional>
166 
168 {
169 public:
170  virtual void SetPredicate( std::function< bool( CFxBIMObjectPtr ) > p ) = 0;
171  virtual void Start() = 0;
172  virtual bool Done() = 0;
173  virtual void Next() = 0;
174 
175  virtual CFxBIMObjectPtr Object() = 0;
176 };
177 
179 {
180 public:
181  virtual size_t Count() = 0;
182  virtual CFxBIMObjectPtr Object( size_t index ) = 0;
183 };
184 
185 #include <DbObjectId.h>
186 
188 {
189 public:
190  virtual void SetPredicate( std::function< bool( OdDbObjectId ) > p ) = 0;
191  virtual void Start() = 0;
192  virtual bool Done() = 0;
193  virtual void Next() = 0;
194 
195  virtual OdDbObjectId Object() = 0;
196 };
197 
199 {
200 public:
201  virtual size_t Count() = 0;
202  virtual OdDbObjectId Object( size_t index ) = 0;
203 };
204 
205 namespace FxBIM
206 {
207  FXBIM_API double BIMHPSCALE( const OdDbDatabase* pDb );
208  FXBIM_API void SetBIMHPSCALE( OdDbDatabase* pDb, const double& value );
209 
210  namespace Units
211  {
212  enum
213  {
217  eLengthM = 3,
221  };
222 
223  FXBIM_API double Scale( int dst, int src );
224  };
225 
227  FXBIM_API void SetBIMUNITSLENGTH( OdDbDatabase* pDb, const int& value );
228 
231 };
CFxBIMIteratorRA::Object
virtual CFxBIMObjectPtr Object(size_t index)=0
CFxBIMDbIterator::SetPredicate
virtual void SetPredicate(std::function< bool(OdDbObjectId) > p)=0
FxBIM::Version
Version
Definition: FxBIM.h:106
CFxBIMIteratorRA::Count
virtual size_t Count()=0
Conversion::Data
Definition: FxBIM.h:78
OdString
Definition: OdString.h:95
OdDbDatabase
Definition: DbDatabase.h:421
Error
Error
Definition: FxBIM.h:18
CFxBIMDbIterator::Done
virtual bool Done()=0
FxBIM::SetBIMVPSCALE
FXBIM_API void SetBIMVPSCALE(OdDbDatabase *pDb, const OdString &value)
Conversion::fn_start_t
std::function< void(const OdString &viewName, OdInt64 idView) > fn_start_t
Definition: FxBIM.h:71
CFxBIMDbIteratorPtr
std::shared_ptr< CFxBIMDbIterator > CFxBIMDbIteratorPtr
Definition: FxBIM.h:160
OdInt64
Definition: Int64.h:43
Conversion::fn_ready_t
std::function< void(CFxBIMDatabaseReferencePtr, OdInt64 idView) > fn_ready_t
Definition: FxBIM.h:72
type
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
Conversion::fn_finish_t
std::function< void(int exitCode, int exitStatus) > fn_finish_t
Definition: FxBIM.h:73
OdDbObjectId
Definition: DbObjectId.h:99
FxBIM::Units::eLengthM
@ eLengthM
Definition: FxBIM.h:217
CFxBIMDbIterator
Definition: FxBIM.h:188
CFxBIMIterator::Start
virtual void Start()=0
Conversion::ToString
static OdString ToString(const Conversion &c)
FxBIM::Units::eLengthFeet
@ eLengthFeet
Definition: FxBIM.h:215
Conversion::eFNone
@ eFNone
Definition: FxBIM.h:89
convert
FXBIM_API OdString convert(const QString &qstr)
FileType::eUnknown
@ eUnknown
Conversion::FromString
static Conversion::Type FromString(const OdString &arg)
CFxBIMDatabaseReferencePtr
OdSmartPtr< CFxBIMDatabaseReference > CFxBIMDatabaseReferencePtr
Definition: FxBIM.h:58
FxBIM::BIMVPSCALE
FXBIM_API OdString BIMVPSCALE(const OdDbDatabase *pDb)
CFxBIMDbIterator::Start
virtual void Start()=0
FXBIM_API
#define FXBIM_API
Definition: FxBIM.h:4
CFxBIMDbIterator::Next
virtual void Next()=0
FxBIM::currentVersion
FXBIM_API OdInt64 currentVersion()
FxBIM::Units::Scale
FXBIM_API double Scale(int dst, int src)
CFxBIMObject::CFxBIMObject
CFxBIMObject()
RxObject.h
OdInt16
short OdInt16
Definition: OdPlatformSettings.h:756
FxBIM
Definition: FxBIM.h:102
data
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
index
GLuint index
Definition: gles2_ext.h:265
FxBIM::kSP2
@ kSP2
Definition: FxBIM.h:112
FxBIM::k2019
@ k2019
Definition: FxBIM.h:107
OD_T
#define OD_T(x)
Definition: OdPlatformSettings.h:714
OdDb::kForRead
@ kForRead
Definition: DbObjectId.h:56
Error::eNotFound
@ eNotFound
FxBIM::Units::eLengthCM
@ eLengthCM
Definition: FxBIM.h:219
OdDbHostAppProgressMeter
Definition: DbHostAppProgressMeter.h:58
Conversion::fn_error_t
std::function< void(const OdString &error) > fn_error_t
Definition: FxBIM.h:75
FxBIM::Units::eLengthInch
@ eLengthInch
Definition: FxBIM.h:216
OdSmartPtr
Definition: SmartPtr.h:58
CFxBIMDbIteratorRA
Definition: FxBIM.h:199
CFxBIMIterator::Next
virtual void Next()=0
Conversion
Definition: FxBIM.h:62
CFxBIMObject
Definition: FxBIM.h:131
Conversion::eNone
@ eNone
Definition: FxBIM.h:65
DbObjectId.h
CFxBIMIteratorPtr
std::shared_ptr< CFxBIMIterator > CFxBIMIteratorPtr
Definition: FxBIM.h:156
FxBIM::cast
OdSmartPtr< T > cast(OdDbObjectId id, OdDb::OpenMode mode=OdDb::kForRead)
Definition: FxBIM.h:149
FxBIM::cast
std::shared_ptr< T > cast(CFxBIMObjectPtr pBase)
Definition: FxBIM.h:142
CFxBIMIteratorRAPtr
std::shared_ptr< CFxBIMIteratorRA > CFxBIMIteratorRAPtr
Definition: FxBIM.h:158
CFxBIMDbIteratorRA::Count
virtual size_t Count()=0
CFxBIMObjectPtr
std::shared_ptr< CFxBIMObject > CFxBIMObjectPtr
Definition: FxBIM.h:127
FxBIM::Units::eLengthMM
@ eLengthMM
Definition: FxBIM.h:220
FxBIM::BIMUNITSLENGTH
FXBIM_API int BIMUNITSLENGTH(const OdDbDatabase *pDb)
CFxBIMObject::~CFxBIMObject
virtual ~CFxBIMObject()
FileType
FileType
Definition: FxBIM.h:46
Error::eFail
@ eFail
CFxBIMDatabaseReference
Definition: FxBIMDatabaseReference.h:17
dst
Definition: SmCalloutBlocks.h:39
Error::eNotImplemented
@ eNotImplemented
FxBIM::Units::eLengthDM
@ eLengthDM
Definition: FxBIM.h:218
FxBIM::Units::eLengthUndefined
@ eLengthUndefined
Definition: FxBIM.h:214
OdDb::OpenMode
OpenMode
Definition: DbObjectId.h:54
FxBIM::kSP0
@ kSP0
Definition: FxBIM.h:110
FxBIM::BIMHPSCALE
FXBIM_API double BIMHPSCALE(const OdDbDatabase *pDb)
Conversion::eConvertToIcf
@ eConvertToIcf
Definition: FxBIM.h:68
Conversion::Type
Type
Definition: FxBIM.h:64
CFxBIMDbIterator::Object
virtual OdDbObjectId Object()=0
FxBIM::kSP1
@ kSP1
Definition: FxBIM.h:111
Conversion::Conversion
Conversion(FileType type, Data data, int flags)
FxBIM::kSP3
@ kSP3
Definition: FxBIM.h:113
value
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
CFxBIMIteratorRA
Definition: FxBIM.h:179
Conversion::Flags
Flags
Definition: FxBIM.h:88
Conversion::fn_abort_t
std::function< bool() > fn_abort_t
Definition: FxBIM.h:74
Conversion::eConvertFromRevit
@ eConvertFromRevit
Definition: FxBIM.h:66
FxBIM::k2021
@ k2021
Definition: FxBIM.h:109
CFxBIMIterator::Done
virtual bool Done()=0
CFxBIMIterator::SetPredicate
virtual void SetPredicate(std::function< bool(CFxBIMObjectPtr) > p)=0
CFxBIMDbIteratorRA::Object
virtual OdDbObjectId Object(size_t index)=0
FxBIM::SetBIMUNITSLENGTH
FXBIM_API void SetBIMUNITSLENGTH(OdDbDatabase *pDb, const int &value)
CFxBIMIterator
Definition: FxBIM.h:168
void
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)
FxBIM::SetBIMHPSCALE
FXBIM_API void SetBIMHPSCALE(OdDbDatabase *pDb, const double &value)
Conversion::Conversion
Conversion()
Error::eOk
@ eOk
FxBIM::bimVersion
FXBIM_API OdInt64 bimVersion(OdInt16 major, OdInt16 minor, OdInt16 revision)
Conversion::eConvertFromIcf
@ eConvertFromIcf
Definition: FxBIM.h:67
FxBIM::k2020
@ k2020
Definition: FxBIM.h:108
CFxBIMIterator::Object
virtual CFxBIMObjectPtr Object()=0
CFxBIMDbIteratorRAPtr
std::shared_ptr< CFxBIMDbIteratorRA > CFxBIMDbIteratorRAPtr
Definition: FxBIM.h:162