@pattern-x/gemini-viewer-threejs
v0.2.71
Published
gemini-viewer is a WebGL based JS SDK, it is built on top of three.js. It provides following viewers:
Downloads
481
Maintainers
Readme
gemini-viewer
gemini-viewer is a WebGL based JS SDK, it is built on top of three.js. It provides following viewers:
1. DxfViewer
Used to view 2d drawings. Dxf format is supported, so we need to convert dwg files to dxf first (there is a dwg2dxf.exe worker). It supports most common entity types, it supports OLE and region via dwg2dxf; It supports common line types; It supports common hatch styles; It support line width;
2. BimViewer
Used to view 3d BIM models. It supports formats including gltf, obj, fbx, ifc, dae, etc. Its features including measurement, section, display outline, orthographic camera, selection, etc.
3. VRViewer
Used to view panoramas. It supports viewing a panorama with 1 image, 6 images, or 24 images; It supports viewing a serials of panoramas; It supports hotpoints;
Installation
To install from npm:
npm install @pattern-x/gemini-viewer-threejs
Examples for DxfViewer
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();
Project setup
npm install
Compiles and hot-reloads for development
npm start
Compiles and minifies for production
npm run build
Lints and fixes files
npm run lint
Documentation
npm run docs
Documents will be generated into "./docs" folder.
End