Skip to content

Commit

Permalink
View creator3d model extends fix (#1980) (#1984)
Browse files Browse the repository at this point in the history
* initial

* change-log

* handle null union result

* range isNull check

* clean up.

* Remove unnecessary length check.

Co-authored-by: roopksaini <roopksaini@users.noreply.github.com>
Co-authored-by: Paul Connelly <22944042+pmconne@users.noreply.github.com>
(cherry picked from commit 763f8c0)

Co-authored-by: roopksaini <68084841+roopksaini@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
mergify[bot] and roopksaini committed Aug 4, 2021
1 parent c92a413 commit 635074c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/imodeljs-frontend",
"comment": "ViewCreator3d fix - modelExtents now computed from all model ranges",
"type": "none"
}
],
"packageName": "@bentley/imodeljs-frontend",
"email": "roopksaini@users.noreply.github.com"
}
9 changes: 8 additions & 1 deletion core/frontend/src/ViewCreator3d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,15 @@ export class ViewCreator3d {
const categories: Id64Array = await this._getAllCategories();

// model extents
const modelExtents = new Range3d();
const modelProps = await this._imodel.models.queryModelRanges(models);
const modelExtents = Range3d.fromJSON(modelProps[0]);

for (const props of modelProps)
modelExtents.union(Range3d.fromJSON(props), modelExtents);

if (modelExtents.isNull)
modelExtents.setFrom(this._imodel.projectExtents);

let originX = modelExtents.low.x;
let originY = modelExtents.low.y;
const originZ = modelExtents.low.z;
Expand Down

0 comments on commit 635074c

Please sign in to comment.