1.0.15 • Published 4 years ago
bim-viewer3d v1.0.15
canwin-viewer3d
擎云 BIM 可视化 webgl 三维引擎
使用方法
- npm 安装 import 导入
npm 安装
npm install --save bim-viewer3d
import 导入
import Canwin from 'bim-viewer3d'
viewer 初始化
let viewerApp = null; //配置参数 let options = { webApi:"120.197.17.151:40007",//webpath webLocal:"120.197.17.151:40007",//socket noLoadDocList:true, clientId: "366c6088-34e1-4738-b517-649d5575ff58", clientSecret: "c2c434b5-60d0-44dd-ab33-6352b5c0998f" }; //1.通过全局Initializer()初始化(不推荐直接创建Viewer3D) Canwin.Viewing.Globals.Graphics3DConfig.setGraphicsLib(Canwin.Viewing.Globals.Graphics3DConfig.LIB_XEOKIT_FRAME_JS); Canwin.Viewing.Initializer(options, function onInitialized() { //2.通过viewerApp(viewerApp包装了viewer3D)创建一个app viewerApp = new Canwin.Viewing.ViewingApplication("rendererElement"); //3.注册一个viewer3D viewerApp.registerViewer(viewerApp.k3d, Canwin.Viewing.Private.BaseViewer3D); Canwin.Viewing.theExtensionManager.registerExtension(Canwin.Viewing.ExtensionManager.S_NAVIGATION_VIEW_TOOL_EXTENSION, Canwin.Viewing.Globals.NavigationViewToolExtension); viewerApp.getCurrentViewer().loadExtension(Canwin.Viewing.ExtensionManager.S_NAVIGATION_VIEW_TOOL_EXTENSION); Canwin.Viewing.theExtensionManager.registerExtension(Canwin.Viewing.ExtensionManager.S_LABEL_MARKER_EXTENSION, Canwin.Viewing.Globals.LabelMarkerExtension); viewerApp.getCurrentViewer().loadExtension(Canwin.Viewing.ExtensionManager.S_LABEL_MARKER_EXTENSION); let baseExtension = Canwin.Viewing.theExtensionManager.getExtensionAtId(Canwin.Viewing.ExtensionManager.S_BASE_CONTROL_EXTENSION); baseExtension.setRotateViewAndScene(1, 0); baseExtension.enableMoving(false); });
- script 标签引入
html 标签引入本地,远程,cdn viewer3d
<script src="xxxxx/viewer3D.umd.js"></script>
初始化
let viewerApp = null; //配置参数 let options = { webApi:"120.197.17.151:40007",//webpath webLocal:"120.197.17.151:40007",//socket noLoadDocList:true, clientId: "366c6088-34e1-4738-b517-649d5575ff58", clientSecret: "c2c434b5-60d0-44dd-ab33-6352b5c0998f" }; //1.通过全局Initializer()初始化(不推荐直接创建Viewer3D) Canwin.Viewing.Globals.Graphics3DConfig.setGraphicsLib(Canwin.Viewing.Globals.Graphics3DConfig.LIB_XEOKIT_FRAME_JS); Canwin.Viewing.Initializer(options, function onInitialized() { //2.通过viewerApp(viewerApp包装了viewer3D)创建一个app viewerApp = new Canwin.Viewing.ViewingApplication("rendererElement"); //3.注册一个viewer3D viewerApp.registerViewer(viewerApp.k3d, Canwin.Viewing.Private.BaseViewer3D); Canwin.Viewing.theExtensionManager.registerExtension(Canwin.Viewing.ExtensionManager.S_NAVIGATION_VIEW_TOOL_EXTENSION, Canwin.Viewing.Globals.NavigationViewToolExtension); viewerApp.getCurrentViewer().loadExtension(Canwin.Viewing.ExtensionManager.S_NAVIGATION_VIEW_TOOL_EXTENSION); Canwin.Viewing.theExtensionManager.registerExtension(Canwin.Viewing.ExtensionManager.S_LABEL_MARKER_EXTENSION, Canwin.Viewing.Globals.LabelMarkerExtension); viewerApp.getCurrentViewer().loadExtension(Canwin.Viewing.ExtensionManager.S_LABEL_MARKER_EXTENSION); let baseExtension = Canwin.Viewing.theExtensionManager.getExtensionAtId(Canwin.Viewing.ExtensionManager.S_BASE_CONTROL_EXTENSION); baseExtension.setRotateViewAndScene(1, 0); baseExtension.enableMoving(false); });
script type=‘’module’ 标签内模块化引用
});
- 包发布到公网 npm
npm publish