mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 12:12:15 +00:00
Allow optional arguments to be set from Python with None, e.g: ifc_person.set_argument(0, None)
This commit is contained in:
@@ -61,6 +61,12 @@ void Ifc::IfcUntypedEntity::invalid_argument(unsigned int i, const std::string&
|
||||
const std::string arg_name = Ifc2x3::Type::GetAttributeName(_type,i);
|
||||
throw IfcException(t + " is not a valid type for '" + arg_name + "'");
|
||||
}
|
||||
void Ifc::IfcUntypedEntity::setArgument(unsigned int i) {
|
||||
bool is_optional = Ifc2x3::Type::GetAttributeOptional(_type, i);
|
||||
if (is_optional) {
|
||||
writable_entity()->setArgument(i);
|
||||
} else invalid_argument(i,"NONE");
|
||||
}
|
||||
void Ifc::IfcUntypedEntity::setArgument(unsigned int i, int v) {
|
||||
IfcUtil::ArgumentType arg_type = Ifc2x3::Type::GetAttributeType(_type,i);
|
||||
if (arg_type == Argument_INT) {
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Ifc {
|
||||
const char* getArgumentName(unsigned int i) const;
|
||||
unsigned getArgumentIndex(const std::string& a) const;
|
||||
|
||||
void setArgument(unsigned int iz);
|
||||
void setArgument(unsigned int i, int v);
|
||||
void setArgument(unsigned int i, bool v);
|
||||
void setArgument(unsigned int i, double v);
|
||||
|
||||
Reference in New Issue
Block a user