- Objective:
Hello,
I have a Revit model which I’m viewing with the speckle viewer embedded in my app.
The model contains rooms, which I want to always hide, as they get in the way.
My app also has functionality to select specific objects to be isolated.
- Issue:
I’m observing that one cannot simultaneously hide some objects, while isolating some other objects.
They end up playing wack-a-mole with each other, with the last caller winning.
- Example:
Here is the code I have written which mostly unblocks my issue, since the app is not always isolating objects. I let the isolation win out over the hiding:
if (filtering) {
// Hide first, since you can only hide or isolate, but not both. And we need isolation to win.
const currentlyHidden = filtering.filteringState.hiddenObjects;
const toHide = hideObjectIds.filter((id) => !currentlyHidden?.includes(id));
const toShow = currentlyHidden?.filter((id) => !hideObjectIds.includes(id)) ?? [];
if (toShow?.nonEmpty) filtering.showObjects(toShow);
if (toHide.nonEmpty) filtering.hideObjects(toHide);
const currentlyIsolated = filtering.filteringState.isolatedObjects;
const toIsolate = isolateObjectIds.filter((id) => !currentlyIsolated?.includes(id));
const toUnIsolate = currentlyIsolated?.filter((id) => !isolateObjectIds.includes(id)) ?? [];
console.log({ currentlyIsolated, isolateObjectIds, toIsolate, toUnIsonlate: toUnIsolate });
if (toUnIsolate.nonEmpty) filtering.unIsolateObjects(toUnIsolate);
// Only isolate objects if specific ones are requested
if (toIsolate.nonEmpty) filtering.isolateObjects(toIsolate);
}
I say mostly, because seeing the ghosts of the rooms when isolating other features is still less than desirable
Rooms hidden when not isolating:
Room skeletons visible when isolating:
Thoughts appreciated