Window Select only selects what is visible
Description We currently have items with multiple elements that we are trying to convert and consolidate. When we select multiple elements using the window select tool
It selects the items visible to the user
But if you rotate to the back side, you will notice that the items on the back side did not get selected:
Is this by design? Or is this a bug? Or is there another way to do this?
To Reproduce I'm attaching a bim file to be used to reproduce. meppipieces.bim
We have reproduced in the display-test-app:
Version iTwin.js: 4.10.13 iTwinUI: 3.1.4 AppUI: 5.3.1 React: 18.3.1 Node.js: 20.18.1 Electron: 33.2.1
Have you tried modifying the Selection Scopes ?
Is this by design? Or is this a bug?
It is by design. People tend to find it surprising if, e.g,, selecting the exterior walls of a building quietly also selects all the elements they can't see inside the building.
Or is there another way to do this?
You could use a spatial query to find elements that intersect your rectangle. @bbastings might have advice or examples.
Volume query example
Have you tried modifying the Selection Scopes ?
Selection scope could help here if you are creating these elements as part of an assembly. Note: display-test-app does not support selection scope.
The screen shots above are using the element selection scope. We will look into adding the spatial query as Paul mentioned above. Thanks Guys.
Unfortunately the query for volume selection isn't returning any elements from meppipieces.
const viewedModels = [...vp.view.modelSelector.models].join(",");
const viewedCategories = [...vp.view.categorySelector.categories].join(",");
const ecsql = `SELECT e.ECInstanceId, Category.Id as category FROM bis.SpatialElement e JOIN bis.SpatialIndex i ON e.ECInstanceId=i.ECInstanceId WHERE Model.Id IN (${viewedModels}) AND Category.Id IN (${viewedCategories}) AND i.MinX <= ${range.xHigh} AND i.MinY <= ${range.yHigh} AND i.MinZ <= ${range.zHigh} AND i.MaxX >= ${range.xLow} AND i.MaxY >= ${range.yLow} AND i.MaxZ >= ${range.zLow}`;
const reader = vp.iModel.createQueryReader(ecsql, undefined, { rowFormat: QueryRowFormat.UseECSqlPropertyNames });
The problem isn't the model, category, or range restrictions. I checked a couple elements, everything looks good and they are in the spatial index?!?
@bbastings Does your response mean that spatial query will not work for them?
@markschlosseratbentley I wasn't able to figure out why my query didn't work in their file, it does in other files I tested (need query expert). The hope was that people that wanted volume selection could just set ToolSettings.enableVolumeSelection to true and the select tool along will all other tools that support drag box selection would just work.
I wasn't able to figure out why my query didn't work in their file, it does in other files I tested (need query expert).
@aruniverse do you know who is a query expert we can loop into this conversation?
I wasn't able to figure out why my query didn't work in their file, it does in other files I tested (need query expert).
@aruniverse do you know who is a query expert we can loop into this conversation?
@khanaffan
I have the BIM file from the issue. I can see the query. But what I need is query with parameters filled out.
I’ve reviewed the BIM file related to the issue and located the SQL query. However, what I need is the fully resolved query—with all parameters (like viewedModels, viewedCategories, and range) filled in with actual values.
Here’s the query template for reference:
SELECT e.ECInstanceId, Category.Id as category
FROM bis.SpatialElement e
JOIN bis.SpatialIndex i ON e.ECInstanceId = i.ECInstanceId
WHERE Model.Id IN (${viewedModels})
AND Category.Id IN (${viewedCategories})
AND i.MinX <= ${range.xHigh}
AND i.MinY <= ${range.yHigh}
AND i.MinZ <= ${range.zHigh}
AND i.MaxX >= ${range.xLow}
AND i.MaxY >= ${range.yLow}
AND i.MaxZ >= ${range.zLow};
Could you help provide the query with those placeholders replaced by actual values?
@khanaffan Thanks for having a look...
SELECT e.ECInstanceId, Category.Id as category FROM bis.SpatialElement e JOIN bis.SpatialIndex i ON e.ECInstanceId=i.ECInstanceId WHERE Model.Id IN (0x17) AND Category.Id IN (0x8d,0x1d) AND i.MinX <= 6.254427909851074 AND i.MinY <= 1.5976687669754028 AND i.MinZ <= 4.996658802032471 AND i.MaxX >= 2.0561231486102374 AND i.MaxY >= -3.7628626041133995 AND i.MaxZ >= -100
^ Box select in top view shown below: