Section cap cannot work #1951
Unanswered
zhanggengjia
asked this question in
Q&A
Replies: 1 comment 4 replies
-
|
Hi @zhanggengjia, We plan to make it more obvious, that a capMaterial is ignored, if the Viewer is instantiated without that readableGeometryEnabled property.Hope this helps! Best, Michał |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I’m trying to use xeokit SectionPlanesPlugin to show section caps when slicing an XKT model.
I followed the official example [SectionPlanesPlugin_Duplex_SectionCaps.html]. In that example, setting capMaterial and clippable on each object in sceneModel.objects works fine – the section plane shows the red caps correctly.
But when I implement the same logic in a React + TypeScript (Vite) project, inside sceneModel.on("loaded"), like this:
const capMat = new PhongMaterial(viewer.scene, {
diffuse: [1.0, 0.0, 0.0],
backfaces: true,
});
const objs = (sceneModel as any).objects;
for (const id in objs) {
const entity = objs[id];
entity.capMaterial = capMat;
entity.clippable = true;
}
But still: no red cap surfaces are rendered.
In the official HTML example, the exact same code works.
Environment
xeokit version: tried @xeokit/xeokit-sdk (npm ESM) and also direct import from dist/xeokit-sdk.min.es.js
Frontend: React 18 + Vite + TypeScript
Model: Duplex_A_20110505.glTFEmbedded.xkt (same as official example)
Here is the link to my repo, and see the component .
https://github.com/zhanggengjia/Xeokit_Learning/blob/main/src/examples/LoadXKT2.tsx
Beta Was this translation helpful? Give feedback.
All reactions