Skip to content

Commit 19d834b

Browse files
committed
Fix python wrapper
1 parent bc64b33 commit 19d834b

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/ifcparse/IfcEntityInstanceData.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ class IFC_PARSE_API IfcEntityInstanceData {
5252
{}
5353

5454
IfcEntityInstanceData(const IfcParse::declaration* type)
55-
: file(0), id_(0), type_(type), attributes_(0)
56-
{}
55+
: file(0), id_(0), type_(type), attributes_(new Argument*[getArgumentCount()])
56+
{
57+
for (size_t i = 0; i < getArgumentCount(); ++i) {
58+
attributes_[i] = 0;
59+
}
60+
}
5761

5862
void load() const;
5963

src/ifcwrap/IfcParseWrapper.i

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,10 @@ static const std::string& helper_fn_declaration_get_name(const IfcParse::declara
543543
const IfcParse::schema_definition* schema = IfcParse::schema_by_name(schema_identifier);
544544
const IfcParse::declaration* decl = schema->declaration_by_name(name);
545545
IfcEntityInstanceData* data = new IfcEntityInstanceData(decl);
546-
547-
size_t attr_count = 1;
548-
if (decl->as_entity()) {
549-
attr_count = decl->as_entity()->attribute_count();
550-
}
551546

552-
data->setArgument(attr_count - 1, new IfcWrite::IfcWriteArgument());
547+
for (size_t i = 0; i < data->getArgumentCount(); ++i) {
548+
data->setArgument(i, new IfcWrite::IfcWriteArgument());
549+
}
553550

554551
if (decl->as_entity()) {
555552
const std::vector<bool>& derived = decl->as_entity()->derived();

0 commit comments

Comments
 (0)