This module is intended to contain functionality that is common to the PRIS package, and it is accessed as the top-level module of the PRIS package. Functionality in this module is independent of the application (Layout or Modeler).
Note
Functionality in this module is automatically included by the remaining PRIS modules, so you will typically never include it directly. For example, plug-in code presented in the previous section imports ‘Mesh’ and ‘getdir’ from lwsdk.pris.modeler, but these objects are actually defined in this common module.
Bases: exceptions.Exception
A exception that is raised when arguments are not acceptable, either by count, type or requirements of other parameters.
Bases: exceptions.Exception
A exception that is raised when an initialization state does not exist, or cannot be achieved.
Bases: object
This is a Mesh class, similar in purpose to the LScript Mesh Object agent. It is returned by an number of mesh-based PRIS functions.
(char) Returns the object filename.
(int) Returns the number of layers occupied by the object’s mesh.
Calculates the angle between two points on the given axis plane.
Parameters: |
|
---|---|
Returns: | float: The calculated angle, in degrees. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Appends the list of provided items to the appendee.
Parameters: |
|
---|---|
Returns: | Returns the first argument to the caller, once processing is complete. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the ASCII (integer) equivalent of the provided character.
Parameters: | char (str) – A character to render into ASCII. |
---|---|
Returns: | int: The ASCII value. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Plays the provided audio file.
Note that this function is only usable under Windows, and requires the ‘winsound’ module that is available in the provided Python runtime archive.
Parameters: |
|
---|---|
Returns: | Nothing |
Raises: | pris.ArgException (if arguments are unacceptable) |
Attempts to convert the provided input into a binary-formatted string value.
Note that not all objects will respond to this conversion.
Parameters: |
|
---|---|
Returns: | str: The binary-formatted string that resulted from the conversion. |
Returns: | None: The conversion was not possible. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Calculates the center point between two points.
Parameters: |
|
---|---|
Returns: | lwsdk.Vector: The calculated center point. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Change the current working directory to the provided path.
Parameters: | path – The new working directory. |
---|---|
Returns: | int: 0 on success, 1 on failure |
Raises: | pris.ArgException (if arguments are unacceptable) |
Clamps the provided value between the indicated boundaries.
Parameters: |
|
---|---|
Returns: | value: Clamped within the range if required. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Clears a specified image, identified by an imageid, from the application.
See also loadimage()
Parameters: | id (imageid) – The image id to clear (typically returned by loadimage()) |
---|---|
Returns: | bool: True if successful, False otherwise |
Raises: | Nothing |
Creates a unique entry in the surface database of the current object.
Parameters: |
|
---|---|
Returns: | surfid: The surface id of the newly created surface (or the id of a pre-existing surface with the same name). |
Returns: | None: The surface could not be created. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Computes the cross product of a pair of 3D values.
Parameters: |
|
---|---|
Returns: | lwsdk.Vector: The computed cross product of v1 and v2 |
Raises: | pris.ArgException (if arguments are unacceptable) |
Computes the dot product of a pair of 3D values.
Parameters: |
|
---|---|
Returns: | lwsdk.Vector: The computed dot product of v1 and v2 |
Raises: | pris.ArgException (if arguments are unacceptable) |
Displays an error message to the user via LightWaves GUI.
It should be noted that calling this function will result in the termination of your running script (via Exception). This is done to mimic the behavior of LScript. You may trap this exception to bypass this behavior.
Parameters: |
|
---|---|
Returns: | Nothing |
Raises: | Exception (to halt the execution of the script) |
Calculates the bounding volume (extent) of two 3D vector values.
Parameters: |
|
---|---|
Returns: | lwsdk.Vector: The extent of the volume as width, height and depth. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Computes the factorial of the provided value.
Parameters: | value (lwsdk.Vector, int, float) – The value to process. |
---|---|
Returns: | The computed factorial of value |
Raises: | pris.ArgException (if arguments are unacceptable) |
Copies the contents of a file to a new location.
See also filerename(), filefind(), filedelete(), fileexists(), filestat(), filecrc()
Parameters: |
|
---|---|
Returns: | bool: Returns True if the copy succeeded, False otherwise |
Raises: | pris.ArgException (if arguments are unacceptable) |
Calculates a CRC32 value for contents of a given file
See also filecopy(), filefind(), filedelete(), fileexists(), filerename(), filestat()
Parameters: | path (str) – The path to the file to process. |
---|---|
Returns: | int: The caculcated CRC32 value. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Attempts to remove the specified file
Note that this function will always return False for directories.
See also filecopy(), filecrc(), fileexists(), filefind(), filerename(), filestat()
Parameters: | path (str) – The path to check. |
---|---|
Returns: | bool: True if it exists, False otherwise. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Reports on the existence of a file system entry (file or directory)
See also filecopy(), filecrc(), filedelete(), filefind(), filerename(), filestat()
Parameters: | path (str) – The path to check. |
---|---|
Returns: | bool: True if it exists, False otherwise. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Recursively scans a list of application-defined folders for files that match a given pattern.
See also filecopy(), filecrc(), filedelete(), fileexists(), filerename(), filestat()
Parameters: |
|
---|---|
Returns: | tuple(str): A sequence of files that matched (may be empty). |
Raises: | pris.ArgException (if arguments are unacceptable) |
Renames an existing file system entry
See also filecopy(), filefind(), filedelete(), fileexists(), filestat(), filecrc()
Parameters: |
|
---|---|
Returns: | bool: Returns True if the rename succeeded, False otherwise |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the various properties of a file system entry (file or directory)
See also filecopy(), filefind(), filedelete(), fileexists(), filerename(), filecrc()
Parameters: | path (str) – The path to the entry to process. |
---|---|
Returns: | tuple(int): A sequence of the values stored with the entry on the file system. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Extracts the fractional part of a floating point value.
Parameters: | value (lwsdk.Vector, float) – The value to process. |
---|---|
Returns: | float: The fractional part of value |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the absolute value of a provided (presumably relative) path.
Parameters: | path (str) – The path to be converted, typically relative. |
---|---|
Returns: | str: The separator value (e.g., ‘\’). |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns an application-defined path for a given directory token.
(Please refer to the documentation for the LightWave SDK LWDirInfoFunc global for available key values.)
Parameters: | selector – A directory selector key. |
---|---|
Returns: | str: The path defined for the key value. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns a value assigned to a variable in the current process’s environment.
Parameters: | key (str) – The name of the variable to query. |
---|---|
Returns: | str: The value assigned to the variable. |
Returns: | None: If the variable doesn’t exist. |
Raises: | Nothing |
Returns the path separator character for the current platform.
Returns: | str: The separator value (e.g., ‘\’). |
---|---|
Raises: | Nothing |
Retrieves a named value from a global database that is available to all scripts.
See also store(), recall(), globalstore()
Parameters: |
|
---|---|
Returns: | Python: A Python object (either the one requested, or the default provided) |
Raises: | pris.ArgException (if arguments are unacceptable) |
Stores a named value to a global database for later recall by any script.
See also store(), recall(), globalrecall()
Parameters: |
|
---|---|
Returns: | bool: True if successful, False otherwise |
Raises: | pris.ArgException (if arguments are unacceptable) |
Attempts to convert the provided input into a hexidecimal-formatted string value.
Note that not all objects will respond to this conversion.
Parameters: |
|
---|---|
Returns: | str: The hexidecimal-formatted string that resulted from the conversion. |
Returns: | None: The conversion was not possible. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the build number of the host application
Returns: | int: The build number. |
---|---|
Raises: | Nothing |
Returns the major and minor version values of the host application
Returns: | tuple(major, minor): The integer major and minor values. |
---|---|
Raises: | Nothing |
Displays an information message to the user via LightWaves GUI.
Parameters: |
|
---|---|
Returns: | Nothing |
Raises: | Nothing |
Tests the provided value for inclusing in the indicated range.
Parameters: |
|
---|---|
Returns: | bool: Indicating that the value is within the provided range, inclusive. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Attempts to convert the provided input into an integer value.
Note that not all objects will respond to this conversion.
Parameters: | value (Any valid Python type capable of rendering to integer) – The value to be converted. |
---|---|
Returns: | int: The integer representation of the provided value |
Returns: | None: The conversion was not possible. |
Raises: | Nothing |
Returns a sequence of strings that represent the valid encoding format for the current ItemShapeData structure.
Returns: | tuple(str): The encoding formats, suitable for using with the LWComRing.encodeData() method, that represents the current format of the ItemShapeData structure. |
---|
Returns the license id of the host application.
Returns: | int: The license id. |
---|---|
Raises: | Nothing |
Loads a given image file into the application.
See also clearimage()
Parameters: | filename (str) – The path to the image file. |
---|---|
Returns: | imageid: The image id of the image loaded, or None if the load failed. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Scans the indicated path for directory names matching a pattern.
Note that this is not a recursive scan. Only those directories in the specified location (if any) are considered.
See also matchfiles()
Parameters: |
|
---|---|
Returns: | list[str]: A list of direcotry names that matched the pattern in the specified location. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Scans the indicated path for file names matching a pattern.
Note that this is not a recursive scan. Only those files in the specified location (if any) are considered.
See also matchdirs()
Parameters: |
|
---|---|
Returns: | list[str]: A list of file names that matched the pattern in the specified location. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Creates a new directory on the file system.
See also rmdir()
Parameters: | path – The directory (and path to it) to be created. |
---|---|
Returns: | int: 0 on success, 1 on failure |
Raises: | pris.ArgException (if arguments are unacceptable) |
Conclude a task in progress.
Returns: | Nothing |
---|---|
Raises: | Nothing |
Initialize a progress monitor.
Parameters: |
|
---|---|
Returns: | bool: True if the monitor successfully initialized, False otherwise |
Raises: | Nothing |
Reduces the number of steps remaining in the task.
Parameters: | count (int) – Optional step count by which to reduce the remainder of the task. |
---|---|
Returns: | bool: True if the reduction was successful, False otherwise |
Raises: | Nothing |
Normalizes a 3D vector value.
Parameters: | vector (lwsdk.Vector, sequence[3]) – The vector value to be normalized. |
---|---|
Returns: | lwsdk.Vector: The normalized version of vector. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the float representation of the provided item.
Parameters: | item (Any valid Python type) – The object to be converted. |
---|---|
Returns: | float: The float representation of item, or 0.0 if the conversion fails. |
Raises: | Nothing |
Attempts to convert the provided input into an octal-formatted string value.
Note that not all objects will respond to this conversion.
Parameters: |
|
---|---|
Returns: | str: The octal-formatted string that resulted from the conversion. |
Returns: | None: The conversion was not possible. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Parses a string value using the provided separator character.
Parameters: |
|
---|---|
Returns: | list[str]: The elements that result from splitting fields using sep |
Raises: | pris.ArgException (if arguments are unacceptable) |
Reports the type of the system on which the script is operating.
Returns: | str: One of ‘win32’, ‘win64’, or ‘osx’ |
---|---|
Raises: | Nothing |
Generate a pseudo-random value in the range 0.0 to 1.0.
Note that this is a deterministic algorithm, so using a given seed value will generate the same sequence of “random” numbers each time.
Parameters: | seed – A seed value with with to initialize the random number generator. |
---|---|
Returns: | float: A value in the range 0.0 to 1.0, inclusive. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Retrieves a named value from a database that is localized to the executing script.
See also store(), globalstore(), globalrecall()
Parameters: |
|
---|---|
Returns: | Python: A Python object (either the one requested, or the default provided) |
Raises: | pris.ArgException (if arguments are unacceptable) |
Removes an existing directory from the file system.
Note that the target directory must be empty for this to succeed.
See also mkdir()
Parameters: | path – The directory (and path to it) to be removed. |
---|---|
Returns: | int: 0 on success, 1 on failure |
Raises: | pris.ArgException (if arguments are unacceptable) |
Rotate a point or points in 3D space by an offset.
See also translate3d(), scale3d()
Parameters: |
|
---|---|
Returns: | lwsdk.Vector, sequence[lwsdk.Vector]: A Vector (or sequence of Vectors) with the rotation applied. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Rounds the provided float value to the number of digits specified.
Parameters: |
|
---|---|
Returns: | float: value rounded to the number of significant digits requested |
Raises: | pris.ArgException (if arguments are unacceptable) |
Reports the host application environment under which the script is operating.
Returns: | str: One of ‘layout’, ‘modeler’, or ‘screamernet’ |
---|---|
Raises: | Nothing |
Scale a point or points in 3D space by an amount.
See also translate3d(), rotate3d()
Parameters: |
|
---|---|
Returns: | lwsdk.Vector, sequence[lwsdk.Vector]: A Vector (or sequence of Vectors) with the scaling applied. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns a value selected based on the comparison of a range.
Parameters: |
|
---|---|
Returns: | lo_result if value is less than threshold, otherwise hi_result |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns a list of the identities of all plug-ins registered under the given plug-in class type.
See also serverpath()
Parameters: | klass (str) – The class of the plug-in (e.g., lwsdk.LWMASTER_HCLASS) |
---|---|
Returns: | list[str]: Returns a sequence of the plug-in ids registered under the given class type. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the full file-system path to a plug-in with a given name, belonging to a given class type.
See also serverlist()
Parameters: |
|
---|---|
Returns: | str: Returns the path of the plug-in module, or ‘’ if it doesn’t exist in the database. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the size of the item.
Parameters: | item (Any valid Python type) – The object to be sized. |
---|---|
Returns: | int: The size of the provided item, or 0 if size cannot be determined. |
Raises: | Nothing |
Returns the size of the item.
Parameters: | item (Any valid Python type) – The object to be sized. |
---|---|
Returns: | int: The size of the provided item, or 0 if size cannot be determined. |
Raises: | Nothing |
Pauses processing for the specified number of seconds.
Parameters: | seconds (int, float) – The amount of time to pause, in seconds. |
---|---|
Returns: | Nothing |
Raises: | Nothing |
Launches an external process.
Parameters: |
|
---|---|
Returns: | int: Result code if wait=True |
Returns: | pid: The process instance that can later be used with wait() and terminate() if the call is asynchronous (!wait) |
Raises: | pris.ArgException (if arguments are unacceptable) |
Splits a path and returns its constituent parts.
Parameters: | path (str) – The path to process. |
---|---|
Returns: | list[str]: List of string items that represent the parsed path. |
Raises: | Nothing |
Parameters: |
|
---|---|
Returns: | value if comp2 is less than comp1, otherwise 0 |
Raises: | pris.ArgException (if arguments are unacceptable) |
Stores a named value to a database for later recall that is localized to the executing script.
See also recall(), globalstore(), globalrecall()
Parameters: |
|
---|---|
Returns: | bool: True if successful, False otherwise |
Raises: | pris.ArgException (if arguments are unacceptable) |
Raises: | pris.InitException (if the id of the current script cannot be determined) |
Returns the string representation of the provided item.
Parameters: | item (Any valid Python type) – The object to be converted. |
---|---|
Returns: | str: The string representation of item, or ‘’ if the conversion fails. |
Raises: | Nothing |
Returns a number of characters from the left portion of a string.
See also strright(), strsub()
Parameters: |
|
---|---|
Returns: | str: The characters extracted, or the entire string value if there are fewer characters than the requested amount. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the lowercase version of a string.
See also strupper()
Parameters: | value (str) – The string value to be processed. |
---|---|
Returns: | str: The provided string value converted to lowercase. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns a number of characters from the right portion of a string.
Parameters: |
|
---|---|
Returns: | str: The characters extracted, or the entire string value if there are fewer characters than the requested amount. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns a number of characters from an arbitrary offset of a string.
See also strleft(), strright()
Parameters: |
|
---|---|
Returns: | str: The characters extracted, or the entire string value if offset exceeds the length of the string. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the uppercase version of a string.
See also strlower()
Parameters: | value (str) – The string value to be processed. |
---|---|
Returns: | str: The provided string value converted to uppercase. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Executes a shell command.
See also systemex()
Parameters: | cmd – The command to be executed. |
---|---|
Returns: | int: The result code. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Executes a shell command, capturing the output of the command.
See also system()
Parameters: | cmd – The command to be executed. |
---|---|
Returns: | tuple(int, str): The integer result code and the output generated by the command. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Terminates a process created with spawn(). This is a “soft” termination, not a “hard” kill.
Parameters: | pid (Python object) – The process id of the object created with spawn(). |
---|---|
Returns: | Nothing |
Raises: | pris.ArgException (if arguments are unacceptable) |
Starts tracking elapsed time.
See also timestop()
Returns: | Nothing |
---|---|
Raises: | Nothing |
Returns the time that has elapsed since the timer was started.
See also timestart()
Returns: | int: The number of seconds that have elapsed since timestart() was called. |
---|---|
Raises: | Nothing |
Translate a point or points in 3D space by an offset.
See also rotate3d(), scale3d()
Parameters: |
|
---|---|
Returns: | lwsdk.Vector, sequence[lwsdk.Vector]: A Vector (or sequence of Vectors) with the offset applied. |
Raises: | pris.ArgException (if arguments are unacceptable) |
Returns the Vector representation of the provided item.
Parameters: | item (Any valid Python type) – The object to be converted. |
---|---|
Returns: | lwsdk.Vector: The Vector representation of item, or Vector() if the conversion fails. |
Raises: | Nothing |