Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when setting unit system to US Survey - missing CUB_US_SURVEY_FT #6666

Open
wilmaier opened this issue Apr 24, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@wilmaier
Copy link

When setting the unit system to US Survey in pineapple viewer, we see an uncaught exception:

image

  1. Open following iModel (likely happens for any iModel):
    https://qa-review-eus.itwin.bentley.com/context/8b3d0653-02b5-4a76-832e-7c16ed50ff21/imodel/b9bf7a2d-bf2e-4d3f-b127-90c8029a855e?changesetid=308791f67a9c5ece81a1c792b3ab3cf1ab584b47&it3mode

  2. Open Settings dialog and under General Tab select Unit System US Survey

  3. Notice in DevTools console an exception is shown

  4. The Model tree is no longer display in the Models widget

  • iTwin.js Version 4.5.1
@wilmaier wilmaier changed the title Exception when setting unit system to US Survey - misssing CUB_US_SURVEY_FT Exception when setting unit system to US Survey - missing CUB_US_SURVEY_FT Apr 24, 2024
@wilmaier wilmaier reopened this Apr 24, 2024
@wilmaier wilmaier added the bug Something isn't working label Apr 24, 2024
@grigasp
Copy link
Member

grigasp commented Apr 25, 2024

@ColinKerr

@ColinKerr
Copy link
Member

the US Survey volumes were added in Units 1.0.7: https://github.com/iTwin/bis-schemas/blob/fac8b94583872514c97cc2e4aabbe425e4af39e4/SchemaInventory.json#L298

This iModel has units 1.0.4.

Units 1.0.7 was added about 3 years ago which is around the same time the format using CUB_US_SURVEY_FT was added to the default formats:

units: [{ label: "ft³", name: "Units.CUB_US_SURVEY_FT" }],

The code needs to either check schema version before creating this formatter or needs to wrap in a try/catch. Remember very old iModels will not even have a units schema because units were hard coded in EC 3.1 ECDb profile 4.0.0.1.

There are several code paths in addition to the one in the stack above that get the default format for a unit system then load it. We could handle in loadFormatAndParserSpec but that would leave us with no format, maybe the correct answer is to fall back on the hard coded unit system that is used if we find an iModel that has a 4.0.0.1 ECDb profile and has no units schema at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants