gemini-viewer is a WebGL based JS SDK. It provides DxfViewer used to view 2d drawings.
To install from npm:
npm install @pattern-x/gemini-viewer-threejs
import { DxfViewer, DxfViewerConfig, DxfModelConfig } from "@pattern-x/gemini-viewer-threejs";
const viewerCfg: DxfViewerConfig = {
containerId: "myCanvas",
enableSpinner: true,
enableLayoutBar: true,
};
const modelCfg: DxfModelConfig = {
modelId: "id_0",
name: "sample",
src: "http://www.abc.com/sample.dxf",
}
const fontFiles = ["http://www.abc.com/hztxt.shx", "http://www.abc.com/simplex.shx"];
const viewer = new DxfViewer(viewerCfg);
await viewer.setFont(fontFiles);
await viewer.loadModelAsync(modelCfg, (event) => {
const progress = (event.loaded * 100) / event.total;
console.log(`Loading progress: ${progress}%`);
});
console.log("Loaded");
viewer.goToHomeView();
npm install
npm start
npm run build
npm run lint
npm run docs
Documents will be generated into "./docs" folder.
three.js
is upgraded, we'll also need to update draco
source files.draco
is configed in BimViewer.ts
, const decoderPath = 'libs/draco/gltf/'
, which is a path that must be available from network. We'll need to:node_modules/three/examples/jsm/libs/draco
folder to public/three/js/libs/draco
wasm is required in order to load ifc file, we'll need to copy: node_modules/three/examples/jsm/loaders/ifc/web-ifc.wasm to /public/three/js/libs/ifc/
End
Generated using TypeDoc