npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

canwinbim-viewer3d

v1.0.79

Published

Canwin viewer3DJS

Downloads

78

Readme

canwin-viewer3d

擎云 BIM 可视化 webgl 三维引擎

使用方法

  • npm 安装 import 导入
  1. npm 安装

    npm install --save canwinbim-viewer3d
  2. import 导入

    import Canwin from 'canwinbim-viewer3d'
  3. 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 标签引入
  1. html 标签引入本地,远程,cdn viewer3d

    <script src="xxxxx/viewer3D.umd.js"></script>
  2. 初始化

     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’ 标签内模块化引用

    <script type="module">     import Canwin from '../../dist/viewer3d-es.js'     console.log(Canwin)

    // 使用

    let viewerApp = null; //配置参数 let options = { webApi:"120.197.17.151:40007",//webpath webLocal:"120.197.17.151:40007",//socket // webStaticPath : "../../../src/util/task/", 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() { console.log("Initializer"); //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_LABEL_MARKER_EXTENSION, Canwin.Viewing.Globals.LabelMarkerExtension); viewerApp.getCurrentViewer().loadExtension(Canwin.Viewing.ExtensionManager.S_LABEL_MARKER_EXTENSION); Canwin.Viewing.theExtensionManager.registerExtension(Canwin.Viewing.ExtensionManager.S_FLYCAMERA_EXTENSION, Canwin.Viewing.Globals.FlyCameraExtension); viewerApp.getCurrentViewer().loadExtension(Canwin.Viewing.ExtensionManager.S_FLYCAMERA_EXTENSION); let statsExtension = Canwin.Viewing.theExtensionManager.getExtensionAtId(Canwin.Viewing.ExtensionManager.S_STATS_EXTENSION); statsExtension.show(); console.log("开始加载》。。");

      viewerApp.getCurrentViewer().mViewerApp.loadXKT("down_605ea0f8-2dc8-416a-9e80-8545b1006fa8_1872539922594", "testId", model=>{
          let aabb = model._aabb;
          let center = {
              x: (model._aabb[3] + model._aabb[0]) / 2,
              y: (model._aabb[4] + model._aabb[1]) / 2,
              z: (model._aabb[5] + model._aabb[2]) / 2,
          };
          let distanceX = model._aabb[3] - model._aabb[0];
          let distanceY = model._aabb[4] - model._aabb[1];
          let distanceZ = model._aabb[5] - model._aabb[2];
          let maxDistance = Math.max(distanceX,distanceY,distanceZ);
          let centerUp = {x:center.x, y:center.y + maxDistance, z:center.z};
          let r3d = viewerApp.getCurrentViewer().mRenderer3D;
          let lookTo = (pos, dir, center)=>{
              let at = new Canwin.Viewing.Globals.Vector3D();
              dir.addReturn(pos, at);
              let cameraNode = new Canwin.Viewing.Globals.CameraNode("cameraNode", r3d);
              let baseControl = Canwin.Viewing.theExtensionManager.getExtensionAtId(Canwin.Viewing.ExtensionManager.S_BASE_CONTROL_EXTENSION);
              baseControl.enable(false);
              baseControl.setViewCenter(center);
              cameraNode.setLookAtUpPitchYaw(pos, at, {x:0, y:1, z:0});
              baseControl.refreshViewInfoDontTrigger();
              //下面这行不加的话,虽然是从顶部去观察,但是相机可能是旋转某个角度的顶视图
              baseControl.mBaseCamera.updateInPitchYawRoll(-90, -90, null);
              baseControl.enable(true);
          }
         
      });
    
      //设置系统拓展的参数
      let baseExtension = Canwin.Viewing.theExtensionManager.getExtensionAtId(Canwin.Viewing.ExtensionManager.S_BASE_CONTROL_EXTENSION);
      //设置左键旋转
      baseExtension.enableR
      baseExtension.setRotateViewAndScene(1, 0);
      //禁用漫游(如果开启漫游,建议设置左键移动镜头,setRotateViewAndScene(0, 1);
      baseExtension.enableMoving(true);
      let labelMarkerExtension = Canwin.Viewing.theExtensionManager.getExtensionAtId(Canwin.Viewing.ExtensionManager.S_LABEL_MARKER_EXTENSION);
      labelMarkerExtension.enable(false);
    
     
    
    });
  • 包发布到公网 npm
    npm publish