CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FxBIM.h
Go to the documentation of this file.
1//
2// (C) Copyright 2020-2023 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 #define FXBIM_COMMON_CODE_API
22#else
23 #if defined( FX_BIM_CONVERTERS )
24 #ifdef FXBIM_COMMON_CODE_EXPORTS
25 #define FXBIM_API
26 #define FXBIM_COMMON_CODE_API __declspec(dllexport)
27 #else
28 #define FXBIM_API
29 #define FXBIM_COMMON_CODE_API __declspec(dllimport)
30 #endif
31 #elif defined( FXBIM_SC )
32 #if defined( FXBIM_SCEXE )
33 #define FXBIM_API
34 #define FXBIM_COMMON_CODE_API
35 #else
36 #define FXBIM_API __declspec(dllimport)
37 #define FXBIM_COMMON_CODE_API __declspec(dllimport)
38 #endif
39 #else
40 #ifdef FXBIM_EXPORTS
41 #define FXBIM_API __declspec(dllexport)
42 #define FXBIM_COMMON_CODE_API __declspec(dllexport)
43 #else
44 #define FXBIM_API __declspec(dllimport)
45 #define FXBIM_COMMON_CODE_API __declspec(dllimport)
46 #endif
47 #endif
48#endif
49
50#if defined( QT_VERSION )
51#include <QtCore/QString>
52#endif
53
54#include <OdaCommon.h>
55#include <OdaDefs.h>
56#include <DbDatabase.h>
57#include <DbBlockReference.h>
58
60
61#include <memory>
62#include <map>
63#include <vector>
64
65enum class Error
66{
67 eOk = 0,
68 eFail,
69 eAbort,
94};
95
96namespace FxBIM
97{
99}
100
101enum class fileType
102{
103 eUnknown = 0,
104 eRevit = 1,
105 eIFC = 2,
106 eTRB = 3
107};
108
109class OdString;
111
112#include <functional>
113#include <RxObject.h>
114
117
118#if !defined( XENON )
119 class CFxBIMIPCClient;
120#endif // !defined( XENON )
121
123{
124 enum Type
125 {
130 eConvertFromTrb
131 } _c;
132
133 using fn_start_t = std::function< void( const OdString& viewName, OdInt64 idView ) >;
134 using fn_ready_t = std::function< void( const OdString& dwgPath, const OdString& originalPath, const OdString& viewName, OdInt64 idView, int flags ) >;
135 using fn_finish_t = std::function< void( int exitCode, int exitStatus ) >;
136 using fn_abort_t = std::function< bool() >;
137 using fn_error_t = std::function< void( const OdString& err ) >;
138
139 struct Data
140 {
141 fn_start_t _fnStart = nullptr;
142 fn_ready_t _fnReady = nullptr;
143 fn_finish_t _fnFinish = nullptr;
144 fn_abort_t _fnAbort = nullptr;
145 fn_error_t _fnError = nullptr;
147 } _d;
148
149 enum Flags
150 {
151 eFNone = 0x0,
152 eFFailWithoutServer = 0x1, //Converter fails without IPC server connection
153 eFMaskInternal = 0xFF, //Flags starting from 0x100 are internal
154 };
155 int _flags = eFFailWithoutServer;
156
158 explicit Conversion( fileType type, Data data, int flags );
159
161 static OdString ToString( const Conversion& c );
162
163#if !defined( XENON )
164 std::shared_ptr< CFxBIMIPCClient > _ipc;
165#endif // !defined( XENON )
166};
167
168namespace FxBIM
169{
170 const OdString kBIMModuleName = OD_T( "FxBIM" );
171
173 {
174 k2019 = 1,
175 k2020 = 2,
176 k2021 = 3,
177 k2022 = 4,
178 k2023 = 5,
179 kSP0 = 0,
180 kSP1 = 1,
181 kSP2 = 2,
182 kSP3 = 3,
183 };
184
185 //TODO: verify what version it should be
189
192}
193
194#if defined( QT_VERSION )
195FXBIM_COMMON_CODE_API OdString convert( const QString& qstr );
196FXBIM_COMMON_CODE_API QString convert( const OdString& odstr );
197#endif
198
199class CFxBIMObject;
200typedef std::shared_ptr< CFxBIMObject > CFxBIMObjectPtr;
201
202class FXBIM_API CFxBIMObject : public std::enable_shared_from_this< CFxBIMObject >
203{
204protected:
206 virtual ~CFxBIMObject();
207};
208
209#include <DbObjectId.h>
210
211namespace FxBIM
212{
213 template <typename T>
214 std::shared_ptr<T> cast( CFxBIMObjectPtr pBase )
215 {
216 std::shared_ptr<T> p = std::dynamic_pointer_cast< T, CFxBIMObject >( pBase );
217 return( p );
218 }
219
220 template <typename T>
221 OdSmartPtr<T> cast( OdDbObjectId id, OdDb::OpenMode mode = OdDb::kForRead, bool openErased = false )
222 {
223 OdSmartPtr<T> p = T::cast( id.openObject( mode, openErased ) );
224 return( p );
225 }
226}
227
228class CFxBIMIterator;
229typedef std::shared_ptr< CFxBIMIterator > CFxBIMIteratorPtr;
230class CFxBIMIteratorRA;
231typedef std::shared_ptr< CFxBIMIteratorRA > CFxBIMIteratorRAPtr;
232class CFxBIMDbIterator;
233typedef std::shared_ptr< CFxBIMDbIterator > CFxBIMDbIteratorPtr;
235typedef std::shared_ptr< CFxBIMDbIteratorRA > CFxBIMDbIteratorRAPtr;
236
237#include <functional>
238
240{
241public:
242 virtual ~CFxBIMIterator() {};
243 virtual void SetPredicate( std::function< bool( CFxBIMObjectPtr ) > p ) = 0;
244 virtual void Start() = 0;
245 virtual bool Done() = 0;
246 virtual void Next() = 0;
247
248 virtual CFxBIMObjectPtr Object() = 0;
249};
250
252{
253public:
254 virtual ~CFxBIMIteratorRA() {};
255 virtual size_t Count() = 0;
256 virtual CFxBIMObjectPtr Object( size_t index ) = 0;
257};
258
259#include <DbObjectId.h>
260
262{
263public:
264 virtual ~CFxBIMDbIterator() {};
265 virtual void SetPredicate( std::function< bool( OdDbObjectId ) > p ) = 0;
266 virtual void Start() = 0;
267 virtual bool Done() = 0;
268 virtual void Next() = 0;
269
270 virtual OdDbObjectId Object() = 0;
271};
272
274{
275public:
277 virtual size_t Count() = 0;
278 virtual OdDbObjectId Object( size_t index ) = 0;
279};
280
281enum class BimStandards
282{
283 eUnset = -2,
284 eUnknown = -1,
285 eISO = 0,
286 eANSI = 1,
287};
288
290{
291 eUndefined = 0,
292 eFeet = 1,
293 eInch = 2,
294 eM = 3,
295 eDM = 4,
296 eCM = 5,
297 eMM = 6,
298};
299
301{
302 eAuto = 0, // Will choose the style according the BIMUNITSLENGTH
303 eSuperscript = 1, // Force m^2, ft^2 style
304 ePrefix = 2, // Force sq m, sq ft syle
305};
306
308{
309 eAuto = 0,
310 eAlways = 1,
311 eNever = 2,
312};
313
314enum class BimUnitsArea
315{
316 eUndefined = 0,
317 eSqFeet = 1,
318 eSqInches = 2,
319 eSqMeters = 3,
320 eSqDM = 4,
321 eSqCM = 5,
322 eSqMM = 6
323};
324
326{
327 //TODO: Update the list
328 eUndefined = 0,
329 eCubicFeet = 1,
330 eCubicInches = 2,
331 eCubicMeters = 3,
335};
336
337enum class EBIMView
338{
339 e3DView = 0,
340 e2DView = 1,
341};
342
343
344namespace FxBIM
345{
347 {
348 public:
349 explicit Standard( const OdString& name );
350
351 const OdString& Name() const;
352 const BimStandards& Type() const;
353
354 bool operator< ( const Standard& other ) const;
355
356 static OdString ToString( BimStandards standard );
357 static BimStandards FromString( const OdString& standard );
358
359 protected:
361 BimStandards m_Type = BimStandards::eUnset;
362 };
363
366
367 FXBIM_API double BIMHPSCALE( const OdDbDatabase* pDb );
368 FXBIM_API void SetBIMHPSCALE( OdDbDatabase* pDb, const double& value );
369
372
375
378
381
384
387
390
393
396
399
402
405
408}
409
410namespace FxBIM
411{
414
417}
418
419namespace FxBIM
420{
421 enum class EFileType
422 {
423 eModelDrawing = 0x0, //Files in 'models' directory
424 eFlatshotDrawing = 0x1 //Files in 'drawings' directory
425 };
426
427 FXBIM_API Error resolvePath( const OdDbDatabase* pDb, OdString& path, EFileType eFileType );
428}
429
430namespace FxBIM
431{
433#if defined( QT_VERSION )
434 FXBIM_API QString GetAbsoluteFilePath( const QString& sPath, OdDbDatabase* pCurrentDb );
435#endif
436}
437
438#if !defined( FX_BIM_CONVERTERS )
439namespace FxBIM
440{
443
444 /*
445 * Given a database, it tried to find the scale applied to the import. It then return a scale that
446 * can be used for call-outs and labels to have a nice representation
447 */
449}
450
451#endif // !defined( FX_BIM_CONVERTERS )
EBIMView
Definition: FxBIM.h:338
std::shared_ptr< CFxBIMDbIterator > CFxBIMDbIteratorPtr
Definition: FxBIM.h:233
std::shared_ptr< CFxBIMDbIteratorRA > CFxBIMDbIteratorRAPtr
Definition: FxBIM.h:235
Error
Definition: FxBIM.h:66
@ eCVTViewUnset
@ eNullBmDatabase
@ eNullBmObjectId
@ eGeomIsNotGElement
@ eNullFamSymbol
@ eNullBmObject
@ eWrongRVTFormat
@ eDegenerateTopology
@ eDegenerateGeometry
@ eUnsupportedTRBGeometryDefinition
@ eCVTInvalidConversionType
@ eGeomIsNotNode
@ eNullDbObjectId
@ eWrongIFCFormat
@ eCVTUnsupportedPlatform
@ eNotFound
@ eNotThatKindOfClass
@ eNotImplemented
@ eCVTInvalidSource
@ eCVTInvalidParameter
@ eWrongTRBGeometryDefinition
@ eCVTInvalidDestinationFolder
@ eInvalidParameter
@ eCVTInvalidDestinationExists
BimUnitsLength
Definition: FxBIM.h:290
BimStandards
Definition: FxBIM.h:282
std::shared_ptr< CFxBIMIteratorRA > CFxBIMIteratorRAPtr
Definition: FxBIM.h:231
#define FXBIM_API
Definition: FxBIM.h:20
OdSmartPtr< CFxBIMDatabaseReference > CFxBIMDatabaseReferencePtr
Definition: FxBIM.h:116
BimUnitsVolume
Definition: FxBIM.h:326
fileType
Definition: FxBIM.h:102
#define FXBIM_COMMON_CODE_API
Definition: FxBIM.h:21
BimUnitsStyle
Definition: FxBIM.h:301
BimLabelUnitsPolicy
Definition: FxBIM.h:308
std::shared_ptr< CFxBIMObject > CFxBIMObjectPtr
Definition: FxBIM.h:200
BimUnitsArea
Definition: FxBIM.h:315
std::shared_ptr< CFxBIMIterator > CFxBIMIteratorPtr
Definition: FxBIM.h:229
#define OD_T(x)
short OdInt16
bool operator<(const OdString &s1, const OdString &s2)
Definition: OdString.h:1309
virtual void Start()=0
virtual bool Done()=0
virtual void Next()=0
virtual ~CFxBIMDbIterator()
Definition: FxBIM.h:264
virtual void SetPredicate(std::function< bool(OdDbObjectId) > p)=0
virtual OdDbObjectId Object()=0
virtual ~CFxBIMDbIteratorRA()
Definition: FxBIM.h:276
virtual size_t Count()=0
virtual OdDbObjectId Object(size_t index)=0
virtual void Start()=0
virtual ~CFxBIMIterator()
Definition: FxBIM.h:242
virtual bool Done()=0
virtual void Next()=0
virtual void SetPredicate(std::function< bool(CFxBIMObjectPtr) > p)=0
virtual CFxBIMObjectPtr Object()=0
virtual ~CFxBIMIteratorRA()
Definition: FxBIM.h:254
virtual CFxBIMObjectPtr Object(size_t index)=0
virtual size_t Count()=0
virtual ~CFxBIMObject()
OdString m_Name
Definition: FxBIM.h:360
Standard(const OdString &name)
static OdString ToString(BimStandards standard)
static BimStandards FromString(const OdString &standard)
const BimStandards & Type() const
const OdString & Name() const
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 const GLchar * name
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
Definition: FxBIM.h:97
FXBIM_API OdInt64 currentVersion()
FXBIM_API void SetBIMCURRENTDIMSTYLE(OdDbDatabase *pDb, const OdString &value)
FXBIM_API OdString BIMCALLOUTBLOCKELEVATION(const OdDbDatabase *pDb)
FXBIM_API void SetBIMCALLOUTSFILE(OdDbDatabase *pDb, const OdString &value)
FXBIM_API void SetBIMCALLOUTBLOCKSECTIONALT(OdDbDatabase *pDb, const OdString &value)
FXBIM_API OdString BIMCALLOUTSFILE(const OdDbDatabase *pDb)
FXBIM_API OdString BIMAUTOFILTER(const OdDbDatabase *pDb)
FXBIM_API void SetBIMAUTOFILTER(OdDbDatabase *pDb, const OdString &value)
FXBIM_API void SetBIMUNITSSTYLE(OdDbDatabase *pDb, const int &value)
constexpr OdInt16 kCurrenVersionMinor
Definition: FxBIM.h:187
FXBIM_API bool BIMCALLOUTSONOFF(const OdDbDatabase *pDb)
FXBIM_API Error resolvePath(const OdDbDatabase *pDb, OdString &path, EFileType eFileType)
FXBIM_API void SetBIMVPSCALE(OdDbDatabase *pDb, const OdString &value)
FXBIM_API OdString BIMCALLOUTBLOCKSECTION(const OdDbDatabase *pDb)
FXBIM_API void SetBIMCALLOUTBLOCKSECTION(OdDbDatabase *pDb, const OdString &value)
FXBIM_API void SetBIMCALLOUTBLOCKELEVATION(OdDbDatabase *pDb, const OdString &value)
FXBIM_API OdString GetAbsoluteFilePath(const OdString &sPath, OdDbDatabase *pCurrentDb)
constexpr OdInt16 kCurrenVersionRevision
Definition: FxBIM.h:188
FXBIM_API OdInt64 bimVersion(OdInt16 major, OdInt16 minor, OdInt16 revision)
FXBIM_API OdString BIMCALLOUTBLOCKPLAN(const OdDbDatabase *pDb)
FXBIM_API OdString BIMPROJECTPATH(const OdDbDatabase *pDb)
FXBIM_API Error setRotation(OdDbBlockReferencePtr pBlkRef, double angle)
const OdString kBIMModuleName
Definition: FxBIM.h:170
FXBIM_API int BIMUNITSSTYLE(const OdDbDatabase *pDb)
FXBIM_API void SetBIMAUTOTEMPLATE(OdDbDatabase *pDb, const OdString &value)
FXBIM_COMMON_CODE_API int BIMUNITSLENGTH(const OdDbDatabase *pDb)
Version
Definition: FxBIM.h:173
@ kSP3
Definition: FxBIM.h:182
@ kSP2
Definition: FxBIM.h:181
@ k2022
Definition: FxBIM.h:177
@ kSP0
Definition: FxBIM.h:179
@ k2020
Definition: FxBIM.h:175
@ k2021
Definition: FxBIM.h:176
@ kSP1
Definition: FxBIM.h:180
@ k2023
Definition: FxBIM.h:178
@ k2019
Definition: FxBIM.h:174
FXBIM_API void SetBIMCALLOUTSONOFF(OdDbDatabase *pDb, const bool &value)
EFileType
Definition: FxBIM.h:422
FXBIM_API OdString BIMCURRENTDIMSTYLE(const OdDbDatabase *pDb)
FXBIM_API void SetBIMHPSCALE(OdDbDatabase *pDb, const double &value)
FXBIM_API void SetBIMPROJECTPATH(OdDbDatabase *pDb, const OdString &value)
FXBIM_API void SetBIMCALLOUTBLOCKPLAN(OdDbDatabase *pDb, const OdString &value)
FXBIM_COMMON_CODE_API void SetBIMUNITSLENGTH(OdDbDatabase *pDb, const int &value)
FXBIM_COMMON_CODE_API OdString ToString(const Error &e)
FXBIM_API OdString BIMVPSCALE(const OdDbDatabase *pDb)
FXBIM_API void SetBIMSTANDARD(OdDbDatabase *pDb, const OdString &value)
FXBIM_API Error getRotation(OdDbBlockReferencePtr pBlkRef, double &angle)
FXBIM_API void SetBIMCLIPPINGBOXONOFF(OdDbDatabase *pDb, const bool &value)
FXBIM_API void SetBIMVIEWTITLEBLOCK(OdDbDatabase *pDb, const OdString &value)
FXBIM_API bool BIMCLIPPINGBOXONOFF(const OdDbDatabase *pDb)
FXBIM_API OdString BIMAUTOTEMPLATE(const OdDbDatabase *pDb)
FXBIM_API OdString BIMCALLOUTBLOCKSECTIONALT(const OdDbDatabase *pDb)
constexpr OdInt16 kCurrenVersionMajor
Definition: FxBIM.h:186
FXBIM_API OdString BIMSTANDARD(const OdDbDatabase *pDb)
FXBIM_API double getImportScaleLabel(OdDbDatabasePtr database)
FXBIM_API OdString BIMVIEWTITLEBLOCK(const OdDbDatabase *pDb)
FXBIM_API double BIMHPSCALE(const OdDbDatabase *pDb)
std::shared_ptr< T > cast(CFxBIMObjectPtr pBase)
Definition: FxBIM.h:214
OpenMode
Definition: DbObjectId.h:54
@ kForRead
Definition: DbObjectId.h:56
std::function< void(const OdString &viewName, OdInt64 idView) > fn_start_t
Definition: FxBIM.h:133
@ eConvertToIfc
Definition: FxBIM.h:129
@ eConvertFromRevit
Definition: FxBIM.h:127
@ eConvertFromIfc
Definition: FxBIM.h:128
@ eNone
Definition: FxBIM.h:126
std::shared_ptr< CFxBIMIPCClient > _ipc
Definition: FxBIM.h:164
std::function< void(int exitCode, int exitStatus) > fn_finish_t
Definition: FxBIM.h:135
static Conversion::Type FromString(const OdString &arg)
std::function< void(const OdString &dwgPath, const OdString &originalPath, const OdString &viewName, OdInt64 idView, int flags) > fn_ready_t
Definition: FxBIM.h:134
std::function< bool() > fn_abort_t
Definition: FxBIM.h:136
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:137