How to get number of floors from the model?

Is there any way to find numbers of floors in of building …

Probably several ones! Where are you hacking this - python, js, .net - and what’s the source of your data (e.g., revit, navis, etc.)?

This should help us narrow down things!

the source of my data is revit and using Javascript.

I whipped up something quick here:

(based off this revit commit)

what is this ?
I Think you didn’t understand my question. Actually ,I am asking that how to get the number of floors and roofs in a building.

Hey @Sachin_Kannaujiya the code above shows how to list all the floors in a stream using javascript, give it a go and let us know!

can you please give graphql query for this ?

Thanks . I tried this and its work .

1 Like

How to sure it is can work with native javascript ?

You’re probably using an outdated version of node. If you do node -v what do you get out of it?

Otherwise, in node, it’s an easy fix:

Can I use with version node lower ? At the moment I have some depend with v18.12.0, your link is useful now.

Node18 LTS is the target version

1 Like

That message is a WARN type, it will not stop you from using the package.

But the cause of the warning is our bad, we’re going to relax the node version requirements a bit.

As a sidenote, we recommend using a version manager for switching between nodejs versions in different projects.

On mac / linux its nvm
and on windows you can use nwm-windows

This will allow u to use node 18.12 in one project and a completely different version in another.

Thanks @jonathon @gjedlicska @dimitrie , I guess upgrade LTS is best way to follow with team, but some another package they don’t follow with latest npm, I wish have a version package better npm now but nope, because it is javascript . :sweat_smile:

Hey @chuongmep Dimitrie’s code with some minor modifications, is fully compatible with your version of node. I was able to run the code below in a node 18.0.0 environment.

const ObjectLoader = require("@speckle/objectloader")

async function getLevelsAndCountRoofs() {
  const streamId = "c1faab5c62";
  const objectId = "1849e1f072b577ed02e8618f75a0b799";
  const serverUrl = "";

  const loader = new ObjectLoader({
    options: {
      enableCaching: false,

  let levelsMap = {};
  const allRoofs = [];
  for await (const obj of loader.getObjectIterator()) {
    if (obj.level) {
      levelsMap[] = obj.level;
    // Objects.BuiltElements.Roof:Objects.BuiltElements.Revit.RevitRoof.RevitRoof:Objects.BuiltElements.Revit.RevitRoof.RevitExtrusionRoof
    if (obj.speckle_type.includes("Objects.BuiltElements.Roof")) {
  console.log("Here are all the leves:", levelsMap);
  console.log(`There are ${allRoofs.length} roofs in the model.`);
  return levelsMap;

void getLevelsAndCountRoofs();

Thank you @gjedlicska , I will add more sample with react app for any guy want explore power of speckle :kissing_heart: