vue使用bimface完整展现模型

在index.html中加入代码
<script src="//static.bimface.com/api/BimfaceSDKLoader/BimfaceSDKLoader@latest-release.js" charset="utf-8"></script>

初始化

 show1() {

            var BimfaceLoaderConfig = new BimfaceSDKLoaderConfig();

            BimfaceLoaderConfig.viewToken = this.view_token;

            BimfaceSDKLoader.load(

                BimfaceLoaderConfig,

                this.successCallback,

                this.failureCallback

            );

        },

成功回调

successCallback(viewMetaData) {

            let that = this

            that.domShow = document.getElementById("bimface");

            //创建WebApplication3DConfig

            that.webAppConfig = new Glodon.Bimface.Application.WebApplicationDrawingConfig();

            //设置创建WebApplication3DConfig的dom元素值

            that.webAppConfig.domElement = that.domShow;

            that.webAppConfig.Toolbars = ['MainToolbar'];

            //创建WebApplication3D

            that.app = new Glodon.Bimface.Application.WebApplicationDrawing(that.webAppConfig);

            // //添加待显示的模型

            // this.app.addView(this.token);

            //获取viewer2D对象

            that.viewer2D = that.app.getViewer();

            // 加载图纸

            that.viewer2D.loadDrawing({

                viewToken: that.view_token

            });

            that.viewer2D.addEventListener(Glodon.Bimface.Viewer.ViewerDrawingEvent.MouseClicked, function (objectdata) {

                // 调用viewerDrawing对象的Method,可以继续扩展功能

                console.log("objectId : " + JSON.stringify(objectdata.objectId) + "\n" + "worldPosition : " + JSON.stringify(objectdata.worldPosition));

                that.infoVisible = false

            });

            //获取缩放级别

            that.viewer2D.addEventListener(Glodon.Bimface.Viewer.ViewerDrawingEvent.ZoomFactorChanged, function (objectdata) {

                // console.log(objectdata)

            });

            that.viewer2D.addEventListener(Glodon.Bimface.Viewer.ViewerDrawingEvent.Loaded, function (data) {

                // 创建标签容器配置

                let drawableContainerConfig = new Glodon.Bimface.Plugins.Drawable.DrawableContainerConfig();

                // 设置容器配置匹配的对象

                drawableContainerConfig.viewer = that.viewer2D;

                // 创建标签容器

                that.cunstomItemContainer = new Glodon.Bimface.Plugins.Drawable.DrawableContainer(drawableContainerConfig);

                that.addPoint();   //在cad加载完毕之后,创建图片

                //左下角到右上角

                //margin可自定义,margin值越大则边缘留白范围越大

                that.viewer2D.zoomToBoundingBox([[518452.5516821312, 4374772.383192343], [532475.6239589079, 4384617.828124176]], 0);

                that.viewer2D.setDisplayMode(1)

                that.viewer2D.render();

            });

        },

注意!!挂载的dom一定要有高度 height:800px 不能写100%!!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值