Global actions for controlling script behavior
pw:: | Global actions for controlling script behavior |
Static Attributes | |
ServerActive | This attribute is a flag for whether the Glyph Server is actively listening for client connections or not. |
ServerPort | This attribute is the TCP port number of that the Glyph Server listens on for client connections. |
ServerAuthentication | This attribute is an authentication code used to authenicate the clients that attempt to connect to the Glyph Server. |
ServerAllowRemote | This attribute is a flag for whether clients on remote hosts will be allowed to connect to the Glyph Server. |
DomainUnstructuredSkipMeshing | This attribute is a flag for whether meshing on unstructured domains should be skipped. |
Static Actions | |
processServerMessages | This action processes incoming messages to the Glyph Server, which allows executing Glyph commands in Pointwise over a TCP port. |
source | This action includes and executes the specified Glyph file with its own undo level. |
loadTk | This action loads and initializes the Tk library for use in the script. |
createPointLink | This action creates a string that, when displayed in the Messages window, creates a link to a point or list of points. |
createEntityLink | This action creates a string that, when displayed in the Messages window, creates a link to a set of entities. |
createFileLink | This action creates a string that, when displayed in the Messages window, creates a hyperlink to a file or directory. |
pw::Script get/setServerActive active
This attribute is a flag for whether the Glyph Server is actively listening for client connections or not. Only client connections originating from the localhost will be responded to unless ServerAllowRemote is true.
This attribute is a boolean value.
The default for this attribute is false or the value of the PWI_GLYPH_SERVER_ACTIVE environment variable, if it set.
If this attribute is set to true and the current ServerPort is already in use, an alternate port that is not currently in use will be used, and the ServerPort attribute will be updated.
This attribute cannot be set in non-interactive mode or through a Glyph Server connection.
pw::Script get/setServerPort port
This attribute is the TCP port number of that the Glyph Server listens on for client connections. Only client connections originating from the localhost will be responded to unless ServerAllowRemote is true and ServerAuthentication is not an empty string.
This attribute is an integer with the range [1025, 65536].
The default for this attribute is 2807 or the value of the PWI_GLYPH_SERVER_PORT environment variable, if it is set. However, if the default port is in use by another application, a random port number that is unused will be assigned.
If this attribute is modified and the Glyph Server is currently active it will be deactivated temporarily, the port changed and reactived. It is possible that errors will occur during this process leading to the Glyph Server becoming deactived.
This attribute cannot be set through a Glyph Server connection.
pw::Script get/setServerAuthentication code
This attribute is an authentication code used to authenicate the clients that attempt to connect to the Glyph Server.
This attribute is a string with maximum length of 40.
The default for this attribute is an empty string or the value of the PWI_GLYPH_SERVER_AUTH environment variable, if it is set.
This attribute cannot be set through a Glyph Server connection.
pw::Script get/setServerAllowRemote allow
This attribute is a flag for whether clients on remote hosts will be allowed to connect to the Glyph Server. In order for remote hosts to connect this attribute must be true and the ServerAuthentication attribute must be set to a non empty string.
This attribute is a boolean.
The default for this attribute is false.
This attribute cannot be set through a Glyph Server connection.
pw::Script get/setDomainUnstructuredSkipMeshing skip
This attribute is a flag for whether meshing on unstructured domains should be skipped. The attribute value will be reset to the default value after script execution.
This attribute is a boolean.
The default for this attribute is false.
pw::Script processServerMessages ?-authentication code? ?-allowRemote allow? ?-timeout seconds?
This action processes incoming messages to the Glyph Server, which allows executing Glyph commands in Pointwise over a TCP port.
-authentication code | This optional parameter is the string authentication code that clients must use to communicate with the server. The default is the current value of the ServerAuthentication parameter. |
-allowRemote allow | This optional parameter is the boolean flag which sets whether a client from a remote host will be allowed to communicate with the server. The default is the current value of the ServerAllowRemote parameter. Even when set to true, an authentication code must be in use for remote hosts to connect to the server. |
-timeout seconds | This optional parameter is the integer number of seconds to wait for a client connection. The default is -1, which specifies that it will wait indefinitely. |
The Glyph Server protocol is a simple message based TCP protocol for executing glyph commands given by a client that connects to the Glyph Server. Each message sent to or from the server consists of a 4 byte network ordered (big-endian) unsigned integer with the value representing the length of the following message in bytes.
Each message is further defined as starting with an 8 byte string denoting the type of message with spaces padding on the right, followed by a variable length string payload.
After a client connects, it should immediately send an authentication message:
After the AUTH message has been sent, the server will send one of three messages:
The READY message signals to the client that messages will be accepted from the client by the server. The AUTHFAIL message will be send if the client couldn’t not be authenticated. The BUSY message will be sent when another client is currently connected to the Server or the Pointwise application is otherwise busy. The ERROR message will be sent for any other issue not covered by the above cases for which an established connection did not occur.
After the READY message has been returned, the client may send one or more of the following messages:
The CONTROL message is handled by the Glyph Server by modifying or querying a setting of the Glyph Server. To modify a setting, the message should be in the form “setting=value”. To query a setting, the message should be just the name of the setting. After the message is received, the Glyph Server responds with one of two messages:
Control settings include:
The EVAL message is handled by the Glyph Server by evaluating the Glyph command. Once complete, the Glyph Server responds with one of two messages:
The COMMAND message is handled by the Glyph Server by running the given Glyph command and parameters. The command and parameters must be actual values since no nested commands or variable substitution will be evaluated. Once completes, the Glyph Server responds with one of two messages:
The Glyph Server supports JSON according to RFC 7159, which supports boolean, number and string values at the top level. When a Glyph command returns a single value, it will be returned as a value at the top level of the JSON data.
The PING message is handled by the Glyph Server by simply returning an OK message. This may be used to determine whether the client-server connection is still active. After the message is received, the Glyph Server will respond with the following message:
This action cannot be run through a Glyph Server connection.
This action returns nothing.
pw::Script source filename
This action includes and executes the specified Glyph file with its own undo level. If the Glyph file is a self-contained script and modifies the undo stack, using this method instead of the standard Tcl source command will contain the undo changes within the script.
filename | This parameter is the name of the Glyph file to include. |
This action returns a boolean, which is true if the script executes successfully.
pw::Script createPointLink ?-title string? link_text points
This action creates a string that, when displayed in the Messages window, creates a link to a point or list of points. This only occurs when the command is run in interactive mode. In batch mode, no links are created. Instead, just a comma-separated list of the point values are generated.
title | If specified, this controls the tooltip text that is shown when the user hovers over the link. |
link_text | This string specifies the text that serves as the link in the messages window. |
point | This argument is expected to be a list of one or more point values. |
This action returns a string value that can be used with the puts Tcl command.
This example shows how to create a link to an XYZ point.
Code
set cn(1) [create2PtConnector {0 0 0} {10 0 0} 21] set n 15 set pt [$cn(1) getPoint $n] set link [pw::Script createPointLink "point $n" $pt] puts "Maximum located at $link."
Output
Maximum located at <a href='pwpnt://pwi.app?loc=7.5 0.0 0.0'>point 15</a>."
pw::Script createEntityLink ?-title string? link_text entities
This action creates a string that, when displayed in the Messages window, creates a link to a set of entities. This only occurs when the command is run in interactive mode. In batch mode, no links are created. Instead, the returned string value is a space-separate list of the entity function names.
title | If specified, this controls the tooltip text that is shown when the user hovers over the link. |
link_text | This string specifies the text that serves as the link in the messages window. |
entities | This argument is expected to be a list of one or more pw::Entity objects that can be selected in the display. |
This action returns a string value that can be used with the puts Tcl command.
This example shows how to create a link to a list of two entities.
Code
set cn(1) [create2PtConnector {0 0 0} {10 0 0} 21] set cn(2) [create2PtConnector {0 5 0} {10 5 0} 21] set link [pw::Script createEntityLink -title "New Connectors" "2 connectors" [list $cn(1) $cn(2)]] puts "Created $link."
Output
Created <a href='pwent://pwi.app?ents=::pw::Connector_1 ::pw::Connector_2' title='New Connectors'>2 connectors</a>."
This action creates a string that, when displayed in the Messages window, creates a hyperlink to a file or directory. This only occurs when the command is run in interactive mode. In batch mode, no links are created. Instead, just the file or directory name is returned.
title | If specified, this controls the tooltip text that is shown when the user hovers over the link. |
link_text | This string specifies the text that serves as the link in the messages window. |
path | This argument is expected to be a string corresponding to a file or directory path. A folder in the path can be a @FolderId token which will be expanded to the actual runtime value in the link. Current tokens are: SysInstall, SysBin, SysCommon, SysDoc, SysLicense, SysAltLicense, SysUserPrivate, SysUserHome, SysUserPublic, SysAppPrivate, SysAppPublic, SysTemp, AppPrivate, AppPublic, AppPlugins, PrivatePlugins, PublicPlugins, and URLDocBase. If the command is run in batch mode, then the path is returned as the result. Any @FolderId tokens are expanded. |
This action returns a string value that can be used with the puts Tcl command.
This example shows how to create a link to a file.
Code
set file [file join @SysInstall doc PDF Glyph.pdf] set link [pw::Script createFileLink "Glyph Docs" $file] puts "For reference: $link."
Output
For reference: <a href='pwfile://@SysInstall/doc/PDF/Glyph.pdf'>Glyph Docs</a>."
This attribute is a flag for whether the Glyph Server is actively listening for client connections or not.
pw::Script get/setServerActive active
This attribute is the TCP port number of that the Glyph Server listens on for client connections.
pw::Script get/setServerPort port
This attribute is an authentication code used to authenicate the clients that attempt to connect to the Glyph Server.
pw::Script get/setServerAuthentication code
This attribute is a flag for whether clients on remote hosts will be allowed to connect to the Glyph Server.
pw::Script get/setServerAllowRemote allow
This attribute is a flag for whether meshing on unstructured domains should be skipped.
pw::Script get/setDomainUnstructuredSkipMeshing skip
This action processes incoming messages to the Glyph Server, which allows executing Glyph commands in Pointwise over a TCP port.
pw::Script processServerMessages ?-authentication code? ?-allowRemote allow? ?-timeout seconds?
This action includes and executes the specified Glyph file with its own undo level.
pw::Script source filename
This action loads and initializes the Tk library for use in the script.
pw::Script loadTk
This action creates a string that, when displayed in the Messages window, creates a link to a point or list of points.
pw::Script createPointLink ?-title string? link_text points
This action creates a string that, when displayed in the Messages window, creates a link to a set of entities.
pw::Script createEntityLink ?-title string? link_text entities