mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Python wrapper geometry handling
This commit is contained in:
+3
-4
@@ -41,16 +41,15 @@ script:
|
|||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake ..
|
- cmake ..
|
||||||
- make
|
- sudo make -j2 install
|
||||||
- sudo make install
|
|
||||||
- cd ..
|
- cd ..
|
||||||
- cd ..
|
- cd ..
|
||||||
- pwd
|
- pwd
|
||||||
- cd IfcOpenShell
|
- cd IfcOpenShell
|
||||||
- pwd
|
- pwd
|
||||||
- cd cmake
|
- cd cmake
|
||||||
- mkdir build-ifc2x3 build-ifc4
|
- mkdir build
|
||||||
- cd build-ifc2x3
|
- 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_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 ..
|
||||||
- sudo make install
|
- sudo make install
|
||||||
- cd ../../test
|
- cd ../../test
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ namespace {
|
|||||||
|
|
||||||
IfcSchema::IfcGeometricRepresentationContext::list::it it;
|
IfcSchema::IfcGeometricRepresentationContext::list::it it;
|
||||||
IfcSchema::IfcGeometricRepresentationContext::list::ptr contexts =
|
IfcSchema::IfcGeometricRepresentationContext::list::ptr contexts =
|
||||||
file->instances_by_type<IfcSchema::IfcGeometricRepresentationContext>();
|
file->instances_by_type_excl_subtypes<IfcSchema::IfcGeometricRepresentationContext>();
|
||||||
|
|
||||||
for (it = contexts->begin(); it != contexts->end(); ++it) {
|
for (it = contexts->begin(); it != contexts->end(); ++it) {
|
||||||
IfcSchema::IfcGeometricRepresentationContext* context = *it;
|
IfcSchema::IfcGeometricRepresentationContext* context = *it;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ IfcGeom::Kernel::Kernel(IfcParse::IfcFile* file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string& schema_name = file->schema()->name();
|
const std::string& schema_name = file->schema()->name();
|
||||||
impl::kernel_implementations().construct(schema_name, file);
|
implementation_ = impl::kernel_implementations().construct(schema_name, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,11 @@ from .entity_instance import entity_instance
|
|||||||
|
|
||||||
|
|
||||||
def open(fn):
|
def open(fn):
|
||||||
return file(ifcopenshell_wrapper.open(os.path.abspath(fn)))
|
f = ifcopenshell_wrapper.open(os.path.abspath(fn))
|
||||||
|
if f.good():
|
||||||
|
return file(f)
|
||||||
|
else:
|
||||||
|
raise IOError("Unable to open file for reading")
|
||||||
|
|
||||||
def create_entity(type, *args, **kwargs):
|
def create_entity(type, *args, **kwargs):
|
||||||
e = entity_instance(type)
|
e = entity_instance(type)
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ class iterator(_iterator):
|
|||||||
def get(self):
|
def get(self):
|
||||||
return wrap_shape_creation(self.settings, _iterator.get(self))
|
return wrap_shape_creation(self.settings, _iterator.get(self))
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
if self.initialize():
|
||||||
|
while True:
|
||||||
|
yield self.get()
|
||||||
|
if not self.next(): break
|
||||||
|
|
||||||
class tree(ifcopenshell_wrapper.tree):
|
class tree(ifcopenshell_wrapper.tree):
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,16 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
typename T::list::ptr instances_by_type_excl_subtypes() {
|
||||||
|
IfcEntityList::ptr untyped_list = instances_by_type_excl_subtypes(&T::Class());
|
||||||
|
if (untyped_list) {
|
||||||
|
return untyped_list->as<T>();
|
||||||
|
} else {
|
||||||
|
return typename T::list::ptr(new typename T::list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns all entities in the file that match the positional argument.
|
/// Returns all entities in the file that match the positional argument.
|
||||||
/// NOTE: This also returns subtypes of the requested type, for example:
|
/// NOTE: This also returns subtypes of the requested type, for example:
|
||||||
/// IfcWall will also return IfcWallStandardCase entities
|
/// IfcWall will also return IfcWallStandardCase entities
|
||||||
|
|||||||
@@ -167,14 +167,6 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
$result = boost::apply_visitor(ShapeRTTI(), $1);
|
$result = boost::apply_visitor(ShapeRTTI(), $1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This does not seem to work:
|
|
||||||
%ignore IfcGeom::Iterator<float>::Iterator(const IfcGeom::IteratorSettings&, IfcParse::IfcFile*);
|
|
||||||
%ignore IfcGeom::Iterator<float>::Iterator(const IfcGeom::IteratorSettings&, void*, int);
|
|
||||||
%ignore IfcGeom::Iterator<float>::Iterator(const IfcGeom::IteratorSettings&, std::istream&, int);
|
|
||||||
%ignore IfcGeom::Iterator<double>::Iterator(const IfcGeom::IteratorSettings&, IfcParse::IfcFile*);
|
|
||||||
%ignore IfcGeom::Iterator<double>::Iterator(const IfcGeom::IteratorSettings&, void*, int);
|
|
||||||
%ignore IfcGeom::Iterator<double>::Iterator(const IfcGeom::IteratorSettings&, std::istream&, int);
|
|
||||||
|
|
||||||
%extend IfcGeom::IteratorSettings {
|
%extend IfcGeom::IteratorSettings {
|
||||||
%pythoncode %{
|
%pythoncode %{
|
||||||
attrs = ("convert_back_units", "deflection_tolerance", "disable_opening_subtractions", "disable_triangulation", "faster_booleans", "sew_shells", "use_brep_data", "use_world_coords", "weld_vertices")
|
attrs = ("convert_back_units", "deflection_tolerance", "disable_opening_subtractions", "disable_triangulation", "faster_booleans", "sew_shells", "use_brep_data", "use_world_coords", "weld_vertices")
|
||||||
@@ -237,6 +229,11 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
};
|
};
|
||||||
|
|
||||||
%extend IfcGeom::Element {
|
%extend IfcGeom::Element {
|
||||||
|
|
||||||
|
IfcUtil::IfcBaseClass* product_() const {
|
||||||
|
return $self->product();
|
||||||
|
}
|
||||||
|
|
||||||
%pythoncode %{
|
%pythoncode %{
|
||||||
if _newclass:
|
if _newclass:
|
||||||
# Hide the getters with read-only property implementations
|
# Hide the getters with read-only property implementations
|
||||||
@@ -248,7 +245,9 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
context = property(context)
|
context = property(context)
|
||||||
unique_id = property(unique_id)
|
unique_id = property(unique_id)
|
||||||
transformation = property(transformation)
|
transformation = property(transformation)
|
||||||
|
product = property(product_)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%extend IfcGeom::TriangulationElement {
|
%extend IfcGeom::TriangulationElement {
|
||||||
|
|||||||
Reference in New Issue
Block a user