iTwin Design Review is a great way to view an iModel and related Digital Twin data. It is not always obvious how to write an ECSql query for what is shown in Design Review. This section shows some tricks that can help.
-
Start at the registration dashboard
-
Click the workbook icon to view project on connect webportal
-
Click on the iModel
-
Click on the view button
-
Open Developer tools in your browser
-
Click on something in the 2d or 3d view
-
Find the request whose URL ends with
getContentDescriptor
-
Look in the request playload
Each Elements id is listed by the Element class. in this example a steel column, a railing and a beam is selected.
-
Query for the elements in the iModel Console
SELECT * FROM BuildingDataGroup.Railing WHERE ECInstanceId = 0x200000063de
The ECInstanceId shown here is unique to this iModel, use an Element Id seen in the request body.
NOTE about Ids: An Element has a fixed Id within an iModel, it is a unique identifier for the lifetime of the Element. If an Element is deleted and a new one inserted that represents the same object the will be different. To identify an object over the Element use the code system, federation guid or some other means.
-
Start with the request from the previous step
-
Look at the response payload and find the
selectedClasses
array. This contains all the classes that were selected to build up the data shown in the property pane. It will include the class of the Element selected, any Element Aspects attached to the Element and information about other relationships. -
Query for that related object (in this case an Element Aspect that defines where this Element originally came from)
SELECT * FROM BisCore.ExternalSourceAspect WHERE Element.Id = 0x200000063de
-
Start from the
getContentDescriptor
request from the previous steps and find the related calls togetPagedContent
. Identify the one whosedisplayType
isPropertyPane
-
Expand the result to see the items in the content set. The
displayValues
object holds the formatted values andvalues
holds the unformatted values. These structures maybe nested.NOTE: property names shown here are concatenated strings used internally by the presentation system. This name can be used to search the content descriptor for the field definition.
ALSO NOTE: The Content Descriptor can also be found in the response for getPagedContent so it can be helpful to copy out the entire response body into a text editor when examining it.
This is an advanced topic not fully covered in this talk, but presentation rules drive Design Reviews UI and is included in our open source iModel.js code base and documented on itwinjs.org
-
With dev tools open select any tree (for example the model tree)
-
Find the
getPagedNodes
request and expand it to find therulesetOrId
node. -
The rules in the ruleset define how the tree should be built
-
This ruleset and many others can be found in our open source repository: https://github.com/imodeljs/imodeljs/blob/master/ui/framework/src/ui-framework/imodel-components/models-tree/Hierarchy.GroupedByClass.json
-
Other rulesets can be found by looking on other presentation calls or by searching the iModel.js source for the ruleset schema
"$schema": "../../../../node_modules/@bentley/presentation-common/Ruleset.schema.json",