mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Python wrapper precision updates
This commit is contained in:
@@ -71,12 +71,8 @@ class settings(ifcopenshell_wrapper.settings):
|
|||||||
ifcopenshell_wrapper.settings.set(self, *args)
|
ifcopenshell_wrapper.settings.set(self, *args)
|
||||||
|
|
||||||
|
|
||||||
# Hide templating precision to the user by choosing based on Python's
|
# Assert templated precision to match Python's internal float type
|
||||||
# internal float type. This is probably always going to be a double.
|
assert ifcopenshell_wrapper.iterator_double_precision.mantissa_size() == sys.float_info.mant_dig
|
||||||
for ty in (ifcopenshell_wrapper.iterator_single_precision, ifcopenshell_wrapper.iterator_double_precision):
|
|
||||||
if ty.mantissa_size() == sys.float_info.mant_dig:
|
|
||||||
_iterator = ty
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure people are able to use python's platform agnostic paths
|
# Make sure people are able to use python's platform agnostic paths
|
||||||
class iterator(_iterator):
|
class iterator(_iterator):
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#ifndef IFCPARSE_H
|
#ifndef IFCPARSE_H
|
||||||
#define IFCPARSE_H
|
#define IFCPARSE_H
|
||||||
|
|
||||||
#define IFCOPENSHELL_VERSION "0.6.0a0"
|
#define IFCOPENSHELL_VERSION "0.6.0a1"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|||||||
@@ -102,21 +102,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using RTTI return a more specialized type of Element
|
|
||||||
// Note that these elements are not to be owned by SWIG/Python as they will be freed automatically upon the next iteration
|
|
||||||
// except for the IfcGeom::Element instances which are returned by Iterator::getObject() calls
|
|
||||||
%typemap(out) IfcGeom::Element<float>* {
|
|
||||||
IfcGeom::SerializedElement<float>* serialized_elem = dynamic_cast<IfcGeom::SerializedElement<float>*>($1);
|
|
||||||
IfcGeom::TriangulationElement<float>* triangulation_elem = dynamic_cast<IfcGeom::TriangulationElement<float>*>($1);
|
|
||||||
if (triangulation_elem) {
|
|
||||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr(triangulation_elem), SWIGTYPE_p_IfcGeom__TriangulationElementT_float_t, 0);
|
|
||||||
} else if (serialized_elem) {
|
|
||||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr(serialized_elem), SWIGTYPE_p_IfcGeom__SerializedElementT_float_t, 0);
|
|
||||||
} else {
|
|
||||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1), SWIGTYPE_p_IfcGeom__ElementT_float_t, SWIG_POINTER_OWN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using RTTI return a more specialized type of Element
|
// Using RTTI return a more specialized type of Element
|
||||||
// Note that these elements are not to be owned by SWIG/Python as they will be freed automatically upon the next iteration
|
// Note that these elements are not to be owned by SWIG/Python as they will be freed automatically upon the next iteration
|
||||||
// except for the IfcGeom::Element instances which are returned by Iterator::getObject() calls
|
// except for the IfcGeom::Element instances which are returned by Iterator::getObject() calls
|
||||||
@@ -124,11 +109,11 @@
|
|||||||
IfcGeom::SerializedElement<double>* serialized_elem = dynamic_cast<IfcGeom::SerializedElement<double>*>($1);
|
IfcGeom::SerializedElement<double>* serialized_elem = dynamic_cast<IfcGeom::SerializedElement<double>*>($1);
|
||||||
IfcGeom::TriangulationElement<double>* triangulation_elem = dynamic_cast<IfcGeom::TriangulationElement<double>*>($1);
|
IfcGeom::TriangulationElement<double>* triangulation_elem = dynamic_cast<IfcGeom::TriangulationElement<double>*>($1);
|
||||||
if (triangulation_elem) {
|
if (triangulation_elem) {
|
||||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr(triangulation_elem), SWIGTYPE_p_IfcGeom__TriangulationElementT_double_t, 0);
|
$result = SWIG_NewPointerObj(SWIG_as_voidptr(triangulation_elem), SWIGTYPE_p_IfcGeom__TriangulationElementT_double_double_t, 0);
|
||||||
} else if (serialized_elem) {
|
} else if (serialized_elem) {
|
||||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr(serialized_elem), SWIGTYPE_p_IfcGeom__SerializedElementT_double_t, 0);
|
$result = SWIG_NewPointerObj(SWIG_as_voidptr(serialized_elem), SWIGTYPE_p_IfcGeom__SerializedElementT_double_double_t, 0);
|
||||||
} else {
|
} else {
|
||||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1), SWIGTYPE_p_IfcGeom__ElementT_double_t, SWIG_POINTER_OWN);
|
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1), SWIGTYPE_p_IfcGeom__ElementT_double_double_t, SWIG_POINTER_OWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,9 +125,9 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
IfcGeom::SerializedElement<double>* serialized_elem = dynamic_cast<IfcGeom::SerializedElement<double>*>(elem);
|
IfcGeom::SerializedElement<double>* serialized_elem = dynamic_cast<IfcGeom::SerializedElement<double>*>(elem);
|
||||||
IfcGeom::TriangulationElement<double>* triangulation_elem = dynamic_cast<IfcGeom::TriangulationElement<double>*>(elem);
|
IfcGeom::TriangulationElement<double>* triangulation_elem = dynamic_cast<IfcGeom::TriangulationElement<double>*>(elem);
|
||||||
if (triangulation_elem) {
|
if (triangulation_elem) {
|
||||||
return SWIG_NewPointerObj(SWIG_as_voidptr(triangulation_elem), SWIGTYPE_p_IfcGeom__TriangulationElementT_double_t, SWIG_POINTER_OWN);
|
return SWIG_NewPointerObj(SWIG_as_voidptr(triangulation_elem), SWIGTYPE_p_IfcGeom__TriangulationElementT_double_double_t, SWIG_POINTER_OWN);
|
||||||
} else if (serialized_elem) {
|
} else if (serialized_elem) {
|
||||||
return SWIG_NewPointerObj(SWIG_as_voidptr(serialized_elem), SWIGTYPE_p_IfcGeom__SerializedElementT_double_t, SWIG_POINTER_OWN);
|
return SWIG_NewPointerObj(SWIG_as_voidptr(serialized_elem), SWIGTYPE_p_IfcGeom__SerializedElementT_double_double_t, SWIG_POINTER_OWN);
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("Invalid element encountered");
|
throw std::runtime_error("Invalid element encountered");
|
||||||
}
|
}
|
||||||
@@ -459,26 +444,13 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
namespace IfcGeom {
|
namespace IfcGeom {
|
||||||
%template(iterator_single_precision) Iterator<float>;
|
|
||||||
%template(iterator_double_precision) Iterator<double>;
|
%template(iterator_double_precision) Iterator<double>;
|
||||||
|
|
||||||
%template(element_single_precision) Element<float>;
|
|
||||||
%template(element_double_precision) Element<double>;
|
%template(element_double_precision) Element<double>;
|
||||||
|
|
||||||
%template(triangulation_element_single_precision) TriangulationElement<float>;
|
|
||||||
%template(triangulation_element_double_precision) TriangulationElement<double>;
|
%template(triangulation_element_double_precision) TriangulationElement<double>;
|
||||||
|
|
||||||
%template(serialized_element_single_precision) SerializedElement<float>;
|
|
||||||
%template(serialized_element_double_precision) SerializedElement<double>;
|
%template(serialized_element_double_precision) SerializedElement<double>;
|
||||||
|
|
||||||
%template(transformation_single_precision) Transformation<float>;
|
|
||||||
%template(transformation_double_precision) Transformation<double>;
|
%template(transformation_double_precision) Transformation<double>;
|
||||||
|
|
||||||
%template(matrix_single_precision) Matrix<float>;
|
|
||||||
%template(matrix_double_precision) Matrix<double>;
|
%template(matrix_double_precision) Matrix<double>;
|
||||||
|
|
||||||
namespace Representation {
|
namespace Representation {
|
||||||
%template(triangulation_single_precision) Triangulation<float>;
|
|
||||||
%template(triangulation_double_precision) Triangulation<double>;
|
%template(triangulation_double_precision) Triangulation<double>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ private:
|
|||||||
%ignore IfcParse::IfcFile::register_inverse;
|
%ignore IfcParse::IfcFile::register_inverse;
|
||||||
%ignore IfcParse::IfcFile::unregister_inverse;
|
%ignore IfcParse::IfcFile::unregister_inverse;
|
||||||
%ignore IfcParse::IfcFile::schema;
|
%ignore IfcParse::IfcFile::schema;
|
||||||
|
%ignore IfcParse::IfcFile::begin;
|
||||||
|
%ignore IfcParse::IfcFile::end;
|
||||||
|
|
||||||
%ignore operator<<;
|
%ignore operator<<;
|
||||||
|
|
||||||
%ignore IfcParse::FileDescription::FileDescription;
|
%ignore IfcParse::FileDescription::FileDescription;
|
||||||
|
|||||||
Reference in New Issue
Block a user