This section describes the usage of the send_request() function defined in xmlhttp.js.
The Creating External Custom Interfaces topic presents the xmlhttp.js javascript file found in the extras\Ajax\js subdirectory of your Showcase installation.
External custom interfaces do not work with the "autodesk:" protocol. When creating files for your external interface, use the following syntax for sending Showcase messages:
<a href="#" onclick="send_request('MESSAGE_NAME::param1::param2...');">Send Message</a>
Each message parameter is converted using the Utilities.ConvertData function, which converts the string data to its intended string type.
Tuples and lists must use correct Python syntax.
Quotation marks are required for each element, for example ('shot1','shot2'). Using quotation marks for a single string message parameter yields a string with a set of quotation marks around it, for example "'shot1'". Empty square brackets [] denote an empty list.
Multiple messages take the form:
msg1||msg2||msg3
When using the DELAY_UNTIL_MESSAGE, separate message parameters for the submessage with two commas, i.e. ,,.
For example the following message will wait until the ALTERNATIVE_SET_CHANGED message arrives to send the SHOT_PLAY message with (`Shot1','Shot2') as the first parameter and False as the second.
DELAY_UNTIL_MESSAGE::ALTERNATIVE_SET_CHANGED::SHOT_PLAY::(`Shot1','Shot2'),,False
Example 1: Switching to Wireframe Mode
The following message switches the draw mode to Wireframe when the user clicks the "Wireframe" link.
<a href="#" onclick="sendrequest('SET_DRAW_MODE::WIREFRAME');">Wireframe</a>
The following message displays a dialog with the default title (product name), the specified message, and the default button (OK) when the user clicks the "Confirm" link.
<a href="#" onclick="send_request('UI_CONFIRM_DIALOG::This is a dialog. Click OK to continue.::OK');">Confirm</a>
Example 3: Set to Wireframe, Play Shot, and Show Normals
The following example displays the draw mode to Wireframe and plays shot #1. Once the shot has finished playing, sets the draw mode to Shaded.
<a href="#" onclick="send_request('SET_DRAW_MODE::WIREFRAME ||SHOT_PLAY_SINGLE_BYLABEL::Shot #1::1 ||DELAY_UNTIL_MESSAGE::SHOT_PLAYING_DONE::SET_DRAW_MODE::SHADED');"> Wireframe then shot then shaded</a>