SliceAnalysis can be used to programmatically create a plane that slices through 3D features in a 3D SceneView.
A slice takes a SlicePlane as an input, which can be set through the shape property. If the shape has a tilt angle other than 0
, the angle is only considered if the tiltEnabled property is set to true
.
const sliceAnalysis = new SliceAnalysis({
shape: new SlicePlane({
position: new Point({ }),
width: 50,
height: 50,
tilt: 45
}),
tiltEnabled: true
});
view.analyses.add(sliceAnalysis);
SceneView.analyses can contain multiple slice analyses, but only one of them can be active at a time. When working with multiple slices, set the active property of a slice analysis view to true
to occlude the parts of the 3D features that are in front of the slice plane. When a slice analysis view is activated, all other slice analysis views are automatically deactivated.
const sliceAnalysisView = await view.whenAnalysisView(sliceAnalysis);
// make the slice active in the view (only one slice can be active at a time)
sliceAnalysisView.active = true;
To place a slice interactively, use the SliceAnalysisView3D.place() method.
const abortController = new AbortController();
try {
await analysisView.place({ signal: abortController.signal });
} catch (error) {
if (error.name === "AbortError") {
console.log("Placement operation was cancelled.");
}
}
// cancel the placement operation at some later point
abortController.abort();
Similarly, to interactively exclude layers from the slicing, use the SliceAnalysisView3D.pickLayerToExclude() method.
const abortController = new AbortController();
try {
await analysisView.pickLayerToExclude({ signal: abortController.signal });
} catch (error) {
if (error.name === "AbortError") {
console.log("Picking excluded layers operation was cancelled.");
}
}
// cancel the operation at some later point
abortController.abort();
Use the Slice component to display a user interface for the slice analysis. The component allows users to interactively place a slice and exclude layers from the analysis.
Known Limitations
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4