You are currently reviewing an older revision of this page.
Original Article Date: March 18, 2004
2008-03-26 Updated
A really cool component of MicroStation and the Internet, is the ability to send MicroStation commands from an HTML document 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.
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 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 a 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. V7 select Utilities > MicroStation Link V8 select Utilities > Connect Web Browser Then load this page in the browser. 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.
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 main MbeSendKeyin "rf=c:\dgn\road.dgn,,Road,,*" End Sub And the webpage will show the following command: HREF="ustnkeyin://macro roads"