iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
623 stars 211 forks source link

imodel snapshot - level visibility issue #596

Closed dontbmh closed 3 years ago

dontbmh commented 3 years ago

Hi team,

I have a container DGN file that has multiple small DGN files attached as references.

In Microstation, the levels and elements were displayed as they were supposed to, but the visibility of the attachments, as can be seen in the screenshot below, was unexpectedly turned off by default when the container file was exported as the .bim snapshot generated through the latest iTwin Synchronizer app.

Am I missing something in the original DGN design files? Or the "invisible attachments" was just a default setting made by iTwin Sync or maybe imodeljs?

Any help will be appreciated.

1 2

c-macdonald commented 3 years ago

The MicroStation connector starts with the root model of the default group. It will map all models that are referenced by attachments that can be resolved and which are marked as displayed in that view. Those are the models that are displayed in the Design Review Models tree.

dontbmh commented 3 years ago

The MicroStation connector starts with the root model of the default group. It will map all models that are referenced by attachments that can be resolved and which are marked as displayed in that view. Those are the models that are displayed in the Design Review Models tree.

Thanks for your explanation of the underlying mechanism of imodel generation.

Could you be more specific about Design Review Models tree, I mean how to validate my design files in order to see which models are going to be displayed in the final .bim file?

c-macdonald commented 3 years ago

The Design Review Model Tree should show the same models that can be seen through MicroStation. If you have a discrepancy between what MicroStation shows and what Design Review shows, can you share a specific example?

dontbmh commented 3 years ago

The Design Review Model Tree should show the same models that can be seen through MicroStation. If you have a discrepancy between what MicroStation shows and what Design Review shows, can you share a specific example?

I'm sorry for the stupid question that where is the Design Review Model Tree?

pmconne commented 3 years ago

The "model tree" is displayed in the bottom-most screenshot in your original post, showing your reference hierarchy and allowing you to toggle the visibility of individual models. The initial visibility of each model is defined by the view you opened. The iModel can contain any number of views, each of which may be set up to display different combinations of models. The synchronizer can convert the view groups and saved views from your DGN file, with model visibility controlled by the corresponding reference file visibility in those views. So, your question "which models are going to be displayed in the final .bim file" depends on which view you choose to look at (or, what view the application you're using chooses or generates for you).

What application are you using? When you started it up, did it ask you to select a view, or did it simply open a viewport?

Design Review is one example of an iModel.js application that uses this tree.

dontbmh commented 3 years ago

The "model tree" is displayed in the bottom-most screenshot in your original post, showing your reference hierarchy and allowing you to toggle the visibility of individual models. The initial visibility of each model is defined by the view you opened. The iModel can contain any number of views, each of which may be set up to display different combinations of models. The synchronizer can convert the view groups and saved views from your DGN file, with model visibility controlled by the corresponding reference file visibility in those views. So, your question "which models are going to be displayed in the final .bim file" depends on which view you choose to look at (or, what view the application you're using chooses or generates for you).

What application are you using? When you started it up, did it ask you to select a view, or did it simply open a viewport?

Design Review is one example of an iModel.js application that uses this tree.

My DGN files were assembled in MSCE Update 14 with particular geolocation. From what I can tell, there is only 1 view group called "Default" in the container DGN file, the level manager of which was illustrated in the first screenshot. The bottom-most screenshot is just a TreeWidgetControl inside a modified version of the official ninezone viewer sample react app. After opening the snapshot(generated by iTwin Sync) with iModelJs, querying views with the code snippet imodel.views.getViewList({ from: SpatialViewState.classFullName }) still gives only 1 spatial view as well.

From my digging in MSCE, I found that levels in the level manager not marked as "used" would be treated as invisible in the Model Tree of iModelJs viewer, coincidentally levels of all the container DGN files are not marked as "used" no matter what position/depth they are in the level manager reference tree. This results in a consistency of what I saw in my react viewer app, that is, all the items in the Model Tree(TreeWidgetControl) with the name of its corresponding container file are invisible by default. Now I'm wondering whether the inconsistent viewing between MSCE and iModelJs is caused by the unused default level in the container files, however, these values of "used" cannot be changed. By the way, I'm using iModelJs 2.9.3.

c-macdonald commented 3 years ago

From what I can tell in the screenshot, you are showing the level manager for the master file? Do the levels show up as displayed for the reference? There was a problem that was recently fixed related to the level visibility in reference attachments that might be affecting this. If MSTN is showing the levels as displayed in the reference, can you try creating a new snapshot (iTwin Sync should automatically have updated to the latest release) to see if the problem still exists?

dontbmh commented 3 years ago

Yes, the screenshot is the master file, and the levels shown up in the level manager are consistent with the display for the references. I will try to create a new snapshot with the latest iTwin Sync and get back later. Many thanks, c-macdonald.

Update:

Unfortunately, the problem still exists with the snapshot generated through the latest iTwin Sync. As per the screenshot attached below, levels in the viewer app are invisible by default while in MSCE everything is just displayed as expected. For more details, all the "default" levels in the level manager are NOT marked as "used" except the one I selected in the screenshot. I'm sorry for the ugly red marks because of the project's confidential concern.

2

1

Update2:

Snapshots generated with the latest iTwin Snapshot app work like a charm with iModelJs, and the duration of exporting the same dgn file in iTwin Snapshot seems much shorter than that in iTwin Sync. I'll close the issue for now.