mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 19:34:34 +00:00
Merge remote-tracking branch 'origin/v0.8.0' into ifcviewer-wgpu
This commit is contained in:
@@ -57,9 +57,19 @@
|
||||
if (PySequence_Size(aggregate) == -1) return false;
|
||||
for(Py_ssize_t i = 0; i < PySequence_Size(aggregate); ++i) {
|
||||
PyObject* element = PySequence_GetItem(aggregate, i);
|
||||
// This is equivalent to the PyFloat_CheckExact macro. This means
|
||||
// that direct instances of int, float, str, etc. need to be used.
|
||||
bool b = element->ob_type == type_obj;
|
||||
// Accept the exact type or, for the numeric types, a subclass such
|
||||
// as a numpy scalar (numpy.float64 subclasses float), so that numpy
|
||||
// arrays can be assigned. The REAL vs INTEGER distinction is kept: a
|
||||
// float is not accepted where an int is expected and vice versa, and
|
||||
// bool (a subclass of int) is still rejected for INTEGER. See #5873.
|
||||
bool b;
|
||||
if (type_obj == static_cast<void*>(&PyFloat_Type)) {
|
||||
b = PyFloat_Check(element);
|
||||
} else if (type_obj == static_cast<void*>(&PyLong_Type)) {
|
||||
b = PyLong_Check(element) && !PyBool_Check(element);
|
||||
} else {
|
||||
b = element->ob_type == type_obj;
|
||||
}
|
||||
Py_DECREF(element);
|
||||
if (!b) {
|
||||
return false;
|
||||
@@ -249,6 +259,7 @@
|
||||
PyObject* pythonize(const ifcopenshell::inverse_attribute* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_ifcopenshell__inverse_attribute, 0); }
|
||||
PyObject* pythonize(const ifcopenshell::entity* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_ifcopenshell__entity, 0); }
|
||||
PyObject* pythonize(const ifcopenshell::declaration* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), declaration_type_to_swig(t), 0); }
|
||||
PyObject* pythonize(const log_message& t) { return SWIG_NewPointerObj(SWIG_as_voidptr(&t), SWIGTYPE_p_log_message, 0); }
|
||||
// @nb ownership
|
||||
PyObject* pythonize(const IfcGeom::ConversionResultShape* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcGeom__ConversionResultShape, SWIG_POINTER_OWN); }
|
||||
// PyObject* pythonize(const IfcGeom::ConversionResultShape* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcGeom__ConversionResultShape, 0); }
|
||||
|
||||
@@ -356,3 +356,21 @@ CREATE_OPTIONAL_TYPEMAP_IN(std::string, string, str)
|
||||
|
||||
CREATE_SET_TYPEMAP_IN(int)
|
||||
CREATE_SET_TYPEMAP_IN(std::string)
|
||||
|
||||
// for the logger codes
|
||||
%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING) SWIGTYPE &code_prefix {
|
||||
$1 = PyUnicode_Check($input);
|
||||
}
|
||||
%typemap(in) SWIGTYPE &code_prefix (char tmp[4]) {
|
||||
Py_ssize_t len = 0;
|
||||
const char *s = PyUnicode_AsUTF8AndSize($input, &len);
|
||||
|
||||
if (!s || len != 3) {
|
||||
SWIG_exception_fail(SWIG_ValueError, "Expected Python str of length 3");
|
||||
}
|
||||
|
||||
memcpy(tmp, s, 3);
|
||||
tmp[3] = '\0';
|
||||
|
||||
$1 = &tmp;
|
||||
}
|
||||
@@ -95,6 +95,7 @@ CREATE_VECTOR_TYPEMAP_OUT(ifcopenshell::inverse_attribute const *)
|
||||
CREATE_VECTOR_TYPEMAP_OUT(ifcopenshell::entity const *)
|
||||
CREATE_VECTOR_TYPEMAP_OUT(ifcopenshell::declaration const *)
|
||||
CREATE_VECTOR_TYPEMAP_OUT(IfcGeom::ConversionResultShape *)
|
||||
CREATE_VECTOR_TYPEMAP_OUT(log_message)
|
||||
|
||||
%typemap(out) ifcopenshell::geometry::Settings::value_variant_t {
|
||||
pythonizing_visitor vis;
|
||||
|
||||
Reference in New Issue
Block a user