So I have a fairly big revit file with 137 MB and I need to get all dbIds so I can filter them by a certain properties, but due to the number of dbIds it takes too long. Is it possible to filter the dbids beforehand or a really fast way of getting the dbids. Currently I use this piece of code for dbid extraction.
getDbIds() {
let dictionary = this.instancetree.nodeAccess.dbIdToIndex
let dbids = []
for (let i = 0; i < Object.keys(dictionary).length; i++) {
let nochildCondition = this.instancetree.getChildCount(dictionary[i]);
if (nochildCondition !== 0) {
continue
}
dbids.push(dictionary[i])
}
return dbids
}
Is there a better way of extracting dbids fast ?
It's recommended to use
TnstanceTree#enumNodeChildren()
to obtain children nodes in the node tree instead. The following code snippet is used in our demo projects, hope it helps.