Load partial/part of the model in viewer

Hi,
I am trying to load a floor from a building model in my react js app using 3d viewer.
I am not sure how to find the floor (object)id so that it loads only that floor in viewer instead of loading the whole building at once which is approx 1.5gb and it takes time.
My application is basically comparing 360 image with model.
e.g on left side we load the 360 image of a room and on right side we want to load model of a room/floor.

I did find one approach from where i get all the ids by selecting the floor in filters and then use these ids comma seperated in SpeckleLoader but it is too slow, it looks like it loads model one by one in this case.

Thanks

If it’s literally just a floor element you can utilise the Graphql api. If it’s everything on one level, that’s also possible but a bit more involved

Thanks for quick response.

it is everything on the floor.

what do you mean by bit more invlolved. can you give me direction i need to look towards.

Apologies I am still travelling - I may get to you today, or if someone else from @SpeckleTeam wants to jump in?

1 Like

Hey Muhammad,

Hope this helps, alternatively the simplest option I can think of is to publish that specific floor in a separate model…

1 Like

Hi @Muhammad_Adnan

I’m going to detail a bit solution which uses the speckle viewer library, since I see you mention you are building your own web application.

Instead of passing a bunch of objects, comma separated to the SpeckleLoader you can just pass a common parent id of these objects. Like for example an URL of the form

https://latest.speckle.systems/projects/92b620fb17/models/8247bbc53865b0e0cb5ee4e252e66216

Will load the object 8247bbc53865b0e0cb5ee4e252e66216 along with any children it may have.

So in your case, if you organize each floor objects under a common parent (which doesn’t need to be displayable) and pass that object id to the loader it will load all it’s children. Maybe you already have the floors organized like this, have a look.

Let us know if you need more help

Cheers

Thanks Alex,
this is what i’m looking into since Jonathan mentioned graphql api, so i’ve able to filter all the objects using level id.

// variables
{
  "projectId": "6714b0f0ec",
  "objectId": "254766ed628e1787af5c6314719cc244",
  "query": [
        {
            "field":"level.id",
            "value":"0e966ae9dc77be0aaf34a366f4ac08e5",
            "operator":"="
        }
    ]
}

// query 
query Query($projectId: String!, $objectId: String!, $query: [JSONObject!]) {
  project(id: $projectId) {
    object(id: $objectId) {
      id
      totalChildrenCount
      children(query:$query) {
        totalCount
        objects {
          id
          data
          speckleType
          createdAt
          totalChildrenCount
          children {
            objects {
              children {
                objects {
                  id
                  speckleType
                  createdAt
                  totalChildrenCount
                  data
                }
              }
            }
          }
        }
      }
      data
      createdAt
      speckleType
    }
  }
}

I’ve not been able locate the Object Id of a floor and it seems there isn’t a common parent already but it feels good to know that i’m heading into right direction.
So right now the idea is to group these objects in response under one common parent,
looks like this mutation might do the job:
objectCreate: [String!]!
but its deprecated.
I am thinking of writing a custom mutation which does the following

  • creates a new object
  • get all the objects from above query
  • put them as children of this new object.
1 Like

@Muhammad_Adnan, with the new version of our connectors we’re structuring revit data out as by default via levels, so this adventure becomes a bit easier as each level will have its id.

Full model: revit/sample-school - ggg | Speckle

Just one level from it: Speckle

2 Likes

@dimitrie Thanks alot. this sounds wonderful, I’ll look into the new versions connectors from today. just back from vacationing.

Hey @dimitrie , i tried the 2.20.4 connector .does it have the change already? i could see the level in your example but not in mine.

Dimitrie was referring to the Next Gen v3 connectors in the form of a Revit connector. I don’t think there are plans to backport these changes into the v2 form.

1 Like

Hey @dimitrie @jonathon
i’ve tried the v3 connector, i get the level id and its great, am able to load each floor seperately, however i noticed the textures/finishing is not reflecting when we load floor by id.
is this something that will fixed in v3 connector later on or does it have something to do with my model?

1 Like

Correct, unfortunately that’s a side effect of some of the changes we’ve made and we haven’t gotten to working around it.

@alex had a workaround at one point, I guess i need to talk to him about making it official sooner rahter than later :sweat_smile:

1 Like