diff --git a/src/ifcparse/IfcLateBoundEntity.cpp b/src/ifcparse/IfcLateBoundEntity.cpp index 8fc6d550cf..78d63e1f0f 100644 --- a/src/ifcparse/IfcLateBoundEntity.cpp +++ b/src/ifcparse/IfcLateBoundEntity.cpp @@ -95,6 +95,10 @@ Argument* IfcParse::IfcLateBoundEntity::getArgument(unsigned int i) const { const char* IfcParse::IfcLateBoundEntity::getArgumentName(unsigned int i) const { return IfcSchema::Type::GetAttributeName(_type,i).c_str(); } +bool IfcParse::IfcLateBoundEntity::getArgumentOptionality(unsigned int i) const { + return IfcSchema::Type::GetAttributeOptional(_type, i); +} + void IfcParse::IfcLateBoundEntity::invalid_argument(unsigned int i, const std::string& t) { const std::string arg_name = IfcSchema::Type::GetAttributeName(_type,i); throw IfcException(t + " is not a valid type for '" + arg_name + "'"); diff --git a/src/ifcparse/IfcLateBoundEntity.h b/src/ifcparse/IfcLateBoundEntity.h index 5df5480e0f..4cc67833ca 100644 --- a/src/ifcparse/IfcLateBoundEntity.h +++ b/src/ifcparse/IfcLateBoundEntity.h @@ -52,6 +52,7 @@ namespace IfcParse { Argument* getArgument(unsigned int i) const; const char* getArgumentName(unsigned int i) const; unsigned getArgumentIndex(const std::string& a) const; + bool getArgumentOptionality(unsigned int i) const; IfcEntityList::ptr get_inverse(const std::string& a); diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index 06eb9e5f52..5a8184c9cb 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -56,6 +56,7 @@ namespace IfcUtil { %rename("get_argument_type") getArgumentType; %rename("get_argument_name") getArgumentName; %rename("get_argument_index") getArgumentIndex; +%rename("get_argument_optionality") getArgumentOptionality; %rename("_set_argument") setArgument; %rename("__repr__") toString; %rename("entity_instance") IfcLateBoundEntity; @@ -179,6 +180,14 @@ namespace IfcUtil { std::ofstream f(fn.c_str()); f << (*$self); } + std::vector entity_names() const { + std::vector keys; + keys.reserve(std::distance($self->begin(), $self->end())); + for (IfcParse::IfcFile::entity_by_id_t::const_iterator it = $self->begin(); it != $self->end(); ++ it) { + keys.push_back(it->first); + } + return keys; + } %pythoncode %{ if _newclass: # Hide the getters with read-only property implementations