Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
Bentley 中国优先社区
  • Welcome to Bentley Communities
  • Bentley's Communities
  • Bentley 中国优先社区
  • Cancel
Bentley 中国优先社区
技术资料库 09-超级URLs
    • Sign In
    Bentley 中国优先社区 requires membership for participation - click to join
    • +Bentley 中文技术资料库
    • -iTwin 数字孪生平台
      • Connector(原名Bridge)
      • i-twin微信小课堂
      • -iModel.js
        • +01-iModel.js资源
        • -02-iModel.js初步
          • 01-开始使用iModel.js
          • 02-简介
          • 03-为何使用iModel.js
          • 04-iModel上传
          • +05-iModel.js处理CSV文件
          • 06-简单的浏览应用
          • 07-数据显示
          • 08-前端和后端
          • 09-超级URLs
          • 10-iModel项目
          • 11-系统集成应用
          • 12-部署应用
          • 13-与微软IOT集成
          • 14-BIS数据结构
          • 15-快速开始
        • +03-iModel.js专题应用
      • +iTwin工作流程
      • +iTwin技术主题
    • Bentley二次开发资料库
    • +常见问题汇总
    • Bentley-Learn 官方教学平台-使用方法
    • +中国优先社区使用指南
    • +Bentley学习资料库
    • +Bentley用户成功活动精选
    • +服务合作伙伴计划

     
     Questions about this article, topic, or product? Click here. 

    09-超级URLs

    说明:

    原文刊登在Medium.com/imodeljs站点,作者: Roop Saini

    中文翻译:

    正在进行中...

    英文原文:

    “We want to create a hyperlink that opens up a 3D model and zooms into a specific element.”

    Can iModel.js do that?

    I snapped out of my post-lunch slump as those words emerged through my headset. The outreach team was on a Skype call with an engineering company that was new to iModel.js. We were going through the initial discussion of understanding their requirements and development needs.



    There was something riveting about this requirement; The idea that I could just upload an iModel, select an element and generate a shareable link that I can then drop-in at the end of a paragraph. A paragraph like this one. Eg. did you know that the Retail Building Sample has a designated area for a dairy cooler?

    Make sure to click the link above.

    Pretty cool, right? So how do we do that…?

    We make a Super URL!

    Step 1) Pass data into the URL.

    Step 2) Enhance your app to do something with it.

    The first piece of info we need is the iModel to open. If you have worked with simple-viewer-app before, you are probably familiar with the humdrum task of changing the iModel and Project name in the config:

    While this works in a development setting, it’s not reasonable for a deployed app. Users need the option to pick the iModel during runtime. URLs can help here.

    To start with, we need a project and iModel name. I recently uploaded one using the registration dashboard:

    Let’s see what this could look like.


    It respects your cases and spaces :)

    This also makes switching to new iModels much easier!



    Perfect! We can now use the URL to open a specific iModel. What’s next?

    We need something to uniquely identify the elements to zoom into. Lucky for us, the simple-viewer-app conveniently logs the IDs of elements that are selected in the viewport.

    Let’s select some letters as an example:

    Hit “F12” to open up the console.

    Using these IDs…I can construct this shareable link that hands the context over to you. Similarly, you can pass in any combination of information you need as URL parameters. Here are some more dairy-free examples:

    • elementColor: change the color of selected elements (color pallette reference.)
    • isolate: isolate selected elements.
    • wireFrame: render iModel in wireframe mode.
    • signIn: to use your own iModel.

    In the last one above, make sure to pass in your project and iModel name. Else it freaks out.

    Overall, these techniques can be an elegant way to integrate iModel.js into your web-apps. The shareable links can serve as powerful gateways into the world of infrastructure digital twins. Just remember to respect the 2000 character limit :)

    • Share
    • History
    • More
    • Cancel
    • shunnai.zhao Created by Bentley Colleague shunnai.zhao
    • When: Mon, Sep 14 2020 1:47 AM
    • shunnai.zhao Last revision by Bentley Colleague shunnai.zhao
    • When: Mon, Sep 14 2020 8:16 AM
    • Revisions: 3
    • Comments: 0
    • Sign in to reply
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies