From 260a030b1d82fa2dc5e90b48af4aa21b947b74c6 Mon Sep 17 00:00:00 2001 From: yanzexuan Date: Sun, 6 Nov 2022 14:48:02 +0800 Subject: [PATCH] Added readme content --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d543980..4bff05a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,63 @@ # gemini-viewer-examples Examples and demos for gemini-viewer sdk -# start +# Set up the example project npm install npm start -http://localhost:3000/#/demo \ No newline at end of file +http://localhost:3000/#/demo + + + +# gemini-viewer +gemini-viewer is a WebGL based JS SDK, it is built on top of three.js. It provides following viewers: + +#### 1. 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. + +#### 2. DxfViewer +Used to view 2d drawings. Only dxf format is supported, so user needs to convert dwg files to dxf. It supports most common entity types, it supports OLE and region via dwg2dxf; It supports common line types; It supports common hatch styles; It doesn't support line width; + +#### 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 +``` typescript +import { DxfViewer, DxfViewerConfig, ModelConfig } from "@pattern-x/gemini-viewer-threejs"; + +const viewerCfg: DxfViewerConfig = { + containerId: "myCanvas", + enableToolbar: true, + enableSpinner: true, + enableLayoutBar: true, +}; +const modelCfg: ModelConfig = { + 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(`${event.type}: ${progress}%`); +}); +console.log("Loaded"); +viewer.goToHomeView(); +``` + +## Features for DxfViewer +- Load and view dxf file +- Distance measurement +- Area measurement +- Angle measurement +- Markups +- Undo/redo