Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
MicroStation
  • Product Communities
MicroStation
[Archived] AskInga Wiki UstnKeyin protocol
    • Sign In

    • -AskInga
      • +3D MicroStation
      • +AccuDraw Secrets
      • +Animation - Rendering
      • +Behind The Scenes
      • +Cells
      • +Colours
      • +Conversion - Translation
      • +Coordinate Input
      • +Design Settings
      • +Dimensions
      • +DWG
      • +EDG
      • +Element Manipulation
      • +Element Properties
      • +Element Selection
      • +Freeware - Shareware
      • +Interface Look And Feel
      • -Internet - E-Links - Links
        • Customize action for MicroStation On The Web - Bentley Library button
        • Drive MicroStation from a webpage using UstnForm protocol
        • Google Earth KML or KMZ
        • Keyin to access a website from withing MicroStation
        • Link multimedia files to graphical elements with this macro
        • Linking elements to a webpage
        • Linking to external documents
        • Links on elements
        • Understanding and using NTBang
        • UstnKeyin protocol
      • +Keyins
      • +Levels
      • +Line Styles
      • +Models
      • +MSM Archive
      • +Other
      • +Presentations
      • +Printing - Plotting
      • +Programming - Automation
      • +Rasters - Images
      • +References
      • +Tags - Data Fields - Fields
      • +Text - Fonts - Annotation
      • +Views
      • +Windows - Interacting With
      • +Workspaces - Configuration
    • graffiti

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

    UstnKeyin protocol

    AskInga logo

    Original Article Date: March 2004 

    Updated:  March 2008, December 2010

    Driving MicroStation from a web page:
    A really cool component of MicroStation and the Internet, is the ability to send MicroStation commands from an HTML document (web page) directly to your design session. This is achieved through the use of HREF tag and two special protocols: ustnkeyin and ustnform. In this article we'll look at the ustnkeyin protocol.

    Sample Files for this article:
    Download and extract both the design file and cell library from 187_Files.zip.
    (The zip file contains both V7 and V8 file formats.)
    Once extracted, rename the cell library to ustnkeys.cel and carry on.

    Examples of sending commands from an Internet browser:
    The ustnkeyin protocol allows you to include links that run MicroStation keyins directly from an HTML file being read by Internet Explorer.  In order to achieve this functionality, Internet Explorer must be opened from within MicroStation.

    The protocol and the associated keyins are entered into the HREF tag in the same way one would attach a link to another web page.   For example: href="ustnkeyin://fit+view+extended" would activate the MicroStation command fit view extended. When creating or building these tags, it's important to note that any spaces in the command must be replaced with the + character as shown above.

    The following are examples of using the ustnkeyin protocol and are designed to be used with the sample file provided.  Open the design file and simply drag and drop Wegpage.html  from the zip file into your open design file.  MicroStation will start the web browser, load the HTML page and open the E-Links tool box.

    Alternatively, you can connect to the browser from within MicroStation by choosing Utilities > Connect Web Browser.  Then open the HTML page from the browser. 

    Once the page is loaded, click on each link and notice that it activates a MicroStation keyin.  For example, clicking Draw Pipes executes the following MicroStation keyins: co=3;lv=9;lc=0;wt=0;place smartline.   To make this keyin string work from an HTML web page, it's tagged as follows (replace the square brackets with the proper tag format).

    [a href="ustnkeyin://co=3;lv=9;lc=0;wt=0;place+smartline"]Draw Pipes[/a]

     

     
    Using ustnkeyins with E-Links (MicroStation pre-V8i):
    An Engineering Link is an web tag that allows you to go to a specific web page in your browser. However, if you replace the URL in the tag with a MicroStation keyin using the ustnkeyin protocol, you can execute specific keyins when Follow Engineering Links is selected.

    For example, if you want to add the rd= command to a match line on your drawing, all you do is key in the following in the URL field of the tag: ustnkeyin://rd=filename.dgn

    A few other examples:

    To launch the Image Viewer and open a specific file:
    ustnkeyin://mdl+load+imagevue+[imageFile]

    To execute a macro:
    ustnkeyin://macro+[macro_name]

    To open another design file:
    ustnkeyin://rd=[filename.dgn]

    To attach a V8 reference:
    ustnkeyin://rf=[file_name]


    NOTE: MicroStation has difficulty interpreting commas in the RF command. For example, rf=c:\dgn\road.dgn,,Road,,* will work fine as a normal keyin but reports File not found when called via USTNKEYIN. (TR#129912). To circumvent this issue, simply create a little macro specifying the keyin and then call the macro from USTNKEYIN. For example, the macro roads.bas may contain the following lines:

    Sub main
    MbeSendKeyin "rf=c:\dgn\road.dgn,,Road,,*"
    End Sub


    And the webpage will show the following command:
    HREF="ustnkeyin://macro roads"

     

    Using ustnkeyins with links (MicroStation V8i):
    Rather than using e-Links in MicroStation V8i, just use the tool Add Link to Element from the Organize task.  This is a modern version of e-Links that also plays nice with the Project Explorer.  In addition, it facilitates linking to external files, executing MicroSation keyins via the ustnkeyin protocol, as well as support URL links such as mailto.

    The following video shows how to use this tool to add MicroStation keyins to an element.  In this example, I'm attaching the keyin fit view extended to a piece of text and then edit the link so it reads a bit easier.

     Play this video

     

     

    AskInga Article #187

    • Internet ELinks Links
    • Askinga
    • Share
    • History
    • More
    • Cancel
    • CTennyson Created by Bentley Colleague CTennyson
    • When: Wed, May 28 2008 12:50 PM
    • Inga Morozoff Last revision by Bentley Colleague Inga Morozoff
    • When: Tue, Dec 14 2010 4:49 PM
    • Revisions: 17
    • Comments: 0
    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