mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 09:48:41 +00:00
Fix #2002. Fix bug where sometimes shape IDs wouldn't be pure integers.
This commit is contained in:
committed by
Thomas Krijnen
parent
e129f4afa9
commit
36a7985f5a
@@ -328,6 +328,14 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
};
|
};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
template <typename T>
|
||||||
|
std::string to_locale_invariant_string(const T& t) {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss.imbue(std::locale::classic());
|
||||||
|
oss << t;
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Schema>
|
template <typename Schema>
|
||||||
static boost::variant<IfcGeom::Element*, IfcGeom::Representation::Representation*> helper_fn_create_shape(IfcGeom::IteratorSettings& settings, IfcUtil::IfcBaseClass* instance, IfcUtil::IfcBaseClass* representation = 0) {
|
static boost::variant<IfcGeom::Element*, IfcGeom::Representation::Representation*> helper_fn_create_shape(IfcGeom::IteratorSettings& settings, IfcUtil::IfcBaseClass* instance, IfcUtil::IfcBaseClass* representation = 0) {
|
||||||
IfcParse::IfcFile* file = instance->data().file;
|
IfcParse::IfcFile* file = instance->data().file;
|
||||||
@@ -444,7 +452,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
IfcGeom::IfcRepresentationShapeItems shapes = kernel.convert(instance);
|
IfcGeom::IfcRepresentationShapeItems shapes = kernel.convert(instance);
|
||||||
|
|
||||||
IfcGeom::ElementSettings element_settings(settings, kernel.getValue(IfcGeom::Kernel::GV_LENGTH_UNIT), instance->declaration().name());
|
IfcGeom::ElementSettings element_settings(settings, kernel.getValue(IfcGeom::Kernel::GV_LENGTH_UNIT), instance->declaration().name());
|
||||||
IfcGeom::Representation::BRep brep(element_settings, boost::lexical_cast<std::string>(instance->data().id()), shapes);
|
IfcGeom::Representation::BRep brep(element_settings, to_locale_invariant_string(instance->data().id()), shapes);
|
||||||
try {
|
try {
|
||||||
if (settings.get(IfcGeom::IteratorSettings::USE_BREP_DATA)) {
|
if (settings.get(IfcGeom::IteratorSettings::USE_BREP_DATA)) {
|
||||||
return new IfcGeom::Representation::Serialization(brep);
|
return new IfcGeom::Representation::Serialization(brep);
|
||||||
|
|||||||
Reference in New Issue
Block a user