Add dat.gui, and enable to update dxf elevation for bim_2_overlay_with_dxf

This commit is contained in:
yanzexuan
2023-09-03 17:54:59 +08:00
parent ebd4cdf1a5
commit 7ea3f560b6
4 changed files with 2542 additions and 2 deletions

View File

@ -37,7 +37,6 @@ import { DxfViewer, DxfViewerConfig, ModelConfig } from "@pattern-x/gemini-viewe
const viewerCfg: DxfViewerConfig = {
containerId: "myCanvas",
enableToolbar: true,
enableSpinner: true,
enableLayoutBar: true,
};

View File

@ -24,6 +24,8 @@
NavCubePlugin,
SectionPlugin,
} from "./demo/libs/gemini-viewer.esm.min.js";
import * as dat from "./demo/libs/dat.gui.module.js";
const gui = new dat.GUI();
const project = {
"id": "building1",
@ -82,6 +84,22 @@
// viewer.setToOrthographicCamera(false);
});
});
// dat.gui controls
const controls = {
dxfElevation: 0,
}
// update dxf elevation between -2 to 30, default value is 17.
gui.add(controls, "dxfElevation", -2.0, 30.0, 0.1)
.name("Dxf elevation")
.setValue(17) // the origin value is 17
.onChange((val) => {
const dxf = viewer.loadedModels.find((model) => model.modelId.endsWith(".dxf"));
const object = dxf.object;
object.position.setY(val);
object.updateMatrix();
viewer.enableRender();
});
</script>
</body>

View File

@ -31,7 +31,6 @@
const viewerCfg = {
containerId: "myCanvas",
language: "en",
enableToolbar: false,
}
const viewer = new BimViewer(viewerCfg);

File diff suppressed because one or more lines are too long