mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Fix IfcOpenHouse
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ script:
|
|||||||
- cd cmake
|
- cd cmake
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake -DCOLLADA_SUPPORT=True -DOPENCOLLADA_INCLUDE_DIR=/usr/local/include/opencollada -DOPENCOLLADA_LIBRARY_DIR=/usr/local/lib/opencollada -DPCRE_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu -DBUILD_EXAMPLES=Off -DBUILD_IFCPYTHON=True -DUNICODE_SUPPORT=True -DOCC_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu -DPYTHON_LIBRARY=/usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_EXECUTABLE=/usr/bin/python2.7 ..
|
- cmake -DCOLLADA_SUPPORT=True -DOPENCOLLADA_INCLUDE_DIR=/usr/local/include/opencollada -DOPENCOLLADA_LIBRARY_DIR=/usr/local/lib/opencollada -DPCRE_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu -DBUILD_IFCPYTHON=True -DUNICODE_SUPPORT=True -DOCC_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu -DPYTHON_LIBRARY=/usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_EXECUTABLE=/usr/bin/python2.7 ..
|
||||||
- sudo make install
|
- sudo make install
|
||||||
- cd ../../test
|
- cd ../../test
|
||||||
- /usr/bin/python2.7 tests.py
|
- /usr/bin/python2.7 tests.py
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ namespace IfcGeom {
|
|||||||
template <typename Fn, typename T>
|
template <typename Fn, typename T>
|
||||||
IfcUtil::IfcBaseClass* execute_based_on_schema(Fn fn1, Fn fn2, const std::string& schema_name, const TopoDS_Shape& shape, T t) {
|
IfcUtil::IfcBaseClass* execute_based_on_schema(Fn fn1, Fn fn2, const std::string& schema_name, const TopoDS_Shape& shape, T t) {
|
||||||
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
|
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
|
||||||
if (schema_name == "ifc2x3") {
|
if (schema_name_lower == "ifc2x3") {
|
||||||
return fn1(shape, t);
|
return fn1(shape, t);
|
||||||
} else if (schema_name == "ifc4") {
|
} else if (schema_name_lower == "ifc4") {
|
||||||
return fn2(shape, t);
|
return fn2(shape, t);
|
||||||
} else {
|
} else {
|
||||||
throw IfcParse::IfcException("No geometry serialization available for " + schema_name);
|
throw IfcParse::IfcException("No geometry serialization available for " + schema_name);
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ namespace IfcUtil {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T* as() {
|
T* as() {
|
||||||
|
if (this == 0) {
|
||||||
|
return static_cast<T*>(0);
|
||||||
|
}
|
||||||
return declaration().is(T::Class())
|
return declaration().is(T::Class())
|
||||||
? static_cast<T*>(this)
|
? static_cast<T*>(this)
|
||||||
: static_cast<T*>(0);
|
: static_cast<T*>(0);
|
||||||
@@ -59,6 +62,9 @@ namespace IfcUtil {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
const T* as() const {
|
const T* as() const {
|
||||||
|
if (this == 0) {
|
||||||
|
return static_cast<const T*>(0);
|
||||||
|
}
|
||||||
return declaration().is(T::Class())
|
return declaration().is(T::Class())
|
||||||
? static_cast<const T*>(this)
|
? static_cast<const T*>(this)
|
||||||
: static_cast<const T*>(0);
|
: static_cast<const T*>(0);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "../ifcparse/IfcWrite.h"
|
#include "../ifcparse/IfcWrite.h"
|
||||||
#include "../ifcparse/IfcGlobalId.h"
|
#include "../ifcparse/IfcGlobalId.h"
|
||||||
|
|
||||||
namespace impl {
|
namespace {
|
||||||
IfcUtil::IfcBaseClass* get_parent_of_relation(IfcUtil::IfcBaseClass* t) {
|
IfcUtil::IfcBaseClass* get_parent_of_relation(IfcUtil::IfcBaseClass* t) {
|
||||||
return *t->data().getArgument(
|
return *t->data().getArgument(
|
||||||
t->declaration().as_entity()->attribute_index("RelatingObject")
|
t->declaration().as_entity()->attribute_index("RelatingObject")
|
||||||
@@ -132,10 +132,10 @@ public:
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
for (typename T::list::it i = li->begin(); i != li->end(); ++i) {
|
for (typename T::list::it i = li->begin(); i != li->end(); ++i) {
|
||||||
T* rel = *i;
|
T* rel = *i;
|
||||||
if (impl::get_parent_of_relation(rel) == relating_object) {
|
if (get_parent_of_relation(rel) == relating_object) {
|
||||||
IfcEntityList::ptr products = impl::get_children_of_relation(rel);
|
IfcEntityList::ptr products = get_children_of_relation(rel);
|
||||||
products->push(related_object);
|
products->push(related_object);
|
||||||
impl::set_children_of_relation(rel, products);
|
set_children_of_relation(rel, products);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -154,8 +154,13 @@ public:
|
|||||||
IfcEntityInstanceData* data = new IfcEntityInstanceData(&T::Class());
|
IfcEntityInstanceData* data = new IfcEntityInstanceData(&T::Class());
|
||||||
{ IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set<std::string>(IfcParse::IfcGlobalId()); data->setArgument(0, attr); }
|
{ IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set<std::string>(IfcParse::IfcGlobalId()); data->setArgument(0, attr); }
|
||||||
{ IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set(owner_hist); data->setArgument(1, attr); }
|
{ IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set(owner_hist); data->setArgument(1, attr); }
|
||||||
{ IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set(relating_object); data->setArgument(4, attr); }
|
int relating_index = 4, related_index = 5;
|
||||||
{ IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set(related_objects); data->setArgument(5, attr); }
|
if (T::Class().name() == "IfcRelContainedInSpatialStructure") {
|
||||||
|
// IfcRelContainedInSpatialStructure has attributes reversed.
|
||||||
|
std::swap(relating_index, related_index);
|
||||||
|
}
|
||||||
|
{ IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set(relating_object); data->setArgument(relating_index, attr); }
|
||||||
|
{ IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set(related_objects); data->setArgument(related_index, attr); }
|
||||||
|
|
||||||
T* t = (T*)Schema::get_schema().instantiate(data);
|
T* t = (T*)Schema::get_schema().instantiate(data);
|
||||||
addEntity(t);
|
addEntity(t);
|
||||||
|
|||||||
@@ -1079,6 +1079,10 @@ private:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void apply_attribute_(T& t, Argument* attr) const {
|
void apply_attribute_(T& t, Argument* attr) const {
|
||||||
|
if (!attr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (attr->type() == IfcUtil::Argument_ENTITY_INSTANCE) {
|
if (attr->type() == IfcUtil::Argument_ENTITY_INSTANCE) {
|
||||||
IfcUtil::IfcBaseClass* inst = *attr;
|
IfcUtil::IfcBaseClass* inst = *attr;
|
||||||
t(inst);
|
t(inst);
|
||||||
|
|||||||
Reference in New Issue
Block a user