We’re in the process of creating a web application to manage room data. I’m now testing with exchanging this data with Revit. The workflow I envision and would like to facilitate for now, is:
Rooms will be modelled in Revit
Revit model is sent to Speckle
In the web app, the rooms are read from the Speckle stream
In the web app, room parameters can be added and modified.
This modified data is sent in a new commit
Receive updates in Revit
The web app is made with vue. I think I will need to write an appropriate GraphQL query to read all the rooms that are present in the stream. I am trying to do so first with the interactive graphql explorer, however I’m struggling to write the correct query (I’m new to GraphQL and it’s syntax). I think I will need a query that filters all the objects that have speckle type ‘Objects.BuiltElements.Room’. How would I go about that? I am taking this page from the docs as an example: GraphQL API | Speckle Docs
I got stuck on the name of the field to filter. In the model, the name is defined as speckleType, whereas I seem to get objects that have a speckle_type attribute:
Your query will indeed need to use the {“field”: “speckle_type”}
The elevated property to the GraphQL endpoint follows the property naming conventions used there. speckleType will typically return Base
When you query on the data object (I’m missing your query but presupposing it is there) we can filter out some of the noise with a select modifier. You will need to query based on the full speckle_type value however:
I’ve reported both speckle_typeand speckleType there. Compare also that I have requested the object id in the graphql schema. this matches that in the data which will always return despite the select option
Thank you!! This worked like a charm. I am now able to load the rooms from the stream into my web app and work with the data.
I was wondering what you’re suggestion would be for the sending of data. In the web app, users will be able to add and modify parameters of the rooms. When they are done, I’d like them to send the modified data to a stream, which can then be received again in Revit.
I guess upon sending, I can retrieve the list of objects again with your query. Then I can modify the objects to include the new parameters. Then use a mutation to create a new object with all of this data, and create a new commit after.
We don’t support the creation of new parameters in Revit on receive at this time. If you, however, have a Revit stream with existing parameters with/without values, then replacing these should be straightforward in an object-tree traversal.
You would first want to serialize the data and then write a commit (version) back to the server. The rudimentary methodology for this can be found in the Excel connector.