You are currently reviewing an older revision of this page.
Original Article Date: March 2004
Updated: March 2008
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 the browser, when the browser has been opened from within MicroStation. The protocol and the associated keyin 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 connect to the browser from within MicroStation by choosing Utilities > Connect Web Browser. If you're still using MicroSation V7, choose Utilities > MicroStation Link. Activating this command will open your configured Internet browser such as Microsoft's Internet Explorer as well as opens the E-Links tool box.
When the browser opens, load this web page by copying and pasting the following URL into the address field: http://communities.bentley.com/communities/other_communities/askinga/w/askinga/engineering-links-3-ustnkeyin-protocol.aspx
When ready, select each of the links below and watch what happens! The actual keyin being submitted is shown in italics next to the link. Note that these links only work on pre-MicroStaton v8i.
Using ustnkeyins with E-Links:Now that you've seen what the ustnkeyin protocol can do, let's explore how we can use this with MicroStation's Engineering Links. If you are new to E-Links, please refer to:Engineering Links #1 - Linking to a web pageEngineering Links #2 - Linking to external documentsAs you've learned, 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 spcific file:ustnkeyin://mdl+load+imagevue+[imageFile]To execute a specific 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 surcumvent this issue, simply create a little macro specifying the keyin and then call the macro from USTNKEYIN. For exampe, the macro roads.bas may contain the following lines:Sub mainMbeSendKeyin "rf=c:\dgn\road.dgn,,Road,,*"End SubAnd the webpage will show the following command:HREF="ustnkeyin://macro roads"
AskInga Article #187