PRIS Common: Common Functionality

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.

exception lwsdk.pris.ArgException

Bases: exceptions.Exception

A exception that is raised when arguments are not acceptable, either by count, type or requirements of other parameters.

args
message
exception lwsdk.pris.InitException

Bases: exceptions.Exception

A exception that is raised when an initialization state does not exist, or cannot be achieved.

args
message
lwsdk.pris.Mesh

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.

lwsdk.pris.angle(point1, point2, axis)

Calculates the angle between two points on the given axis plane.

Parameters:
  • point1 (lwsdk.Vector, sequence[3]) – The first point.
  • point2 (lwsdk.Vector) – The second point.
  • axis (str) – The axis to regard, one of ‘x’, ‘y’ or ‘z’.
Returns:

float: The calculated angle, in degrees.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.append(appendee, *args)

Appends the list of provided items to the appendee.

Parameters:
  • appendee (str, sequence) – The value to which items should be added.
  • args (Any valid Python type) – One or more values to be appended.
Returns:

Returns the first argument to the caller, once processing is complete.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.ascii(char)

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)
lwsdk.pris.audio(file, async=False)

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:
  • file – A path to a WAV audio file.
  • async (bool) – Indicates whether or not to play the audio asynchronously.
Returns:

Nothing

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.binary(value, width=None, leading_zero=True)

Attempts to convert the provided input into a binary-formatted string value.

Note that not all objects will respond to this conversion.

See also hex(), octal()

Parameters:
  • value (Any valid Python type capable of rendering to integer) – The value to be converted.
  • width (int) – The width that the resulting binary string should occupy.
  • leading_zero (bool) – If True, the value should use leading zeros for filler.
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)

lwsdk.pris.center(arg1, arg2=None, arg3=None, arg4=None, arg5=None, arg6=None)

Calculates the center point between two points.

Parameters:
  • arg1 (lwsdk.Vector, sequence[3], sequence[6], float) – The first point, or the ‘X’ value of the first point.
  • arg2 (lwsdk.Vector, sequence[3], float) – The second point, or the ‘Y’ value of the second point.
  • arg3 (float) – The ‘Z’ component of the first point.
  • arg4 (float) – The ‘X’ component of the second point.
  • arg5 (float) – The ‘Y’ component of the second point.
  • arg5 – The ‘Z’ component of the second point.
Returns:

lwsdk.Vector: The calculated center point.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.chdir(path)

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)
lwsdk.pris.clamp(value, lo, hi)

Clamps the provided value between the indicated boundaries.

Parameters:
  • value (int, float) – The value to be clamped.
  • lo (int, float) – The lowest value allowable.
  • hi – The highest value allowable.
Returns:

value: Clamped within the range if required.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.clearimage(id)

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
lwsdk.pris.createsurface(surfname, objname=None)

Creates a unique entry in the surface database of the current object.

Parameters:
  • surfname (str) – The name of the new surface to create.
  • objname (str) – The optional name of the object to which the surface should be associated.
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)

lwsdk.pris.cross3d(v1, v2)

Computes the cross product of a pair of 3D values.

Parameters:
  • v1 (lwsdk.Vector, sequence[3]) – The first 3D vector value.
  • v2 (lwsdk.Vector, sequence[3]) – The second 3D vector value.
Returns:

lwsdk.Vector: The computed cross product of v1 and v2

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.dot3d(v1, v2)

Computes the dot product of a pair of 3D values.

Parameters:
  • v1 (lwsdk.Vector, sequence[3]) – The first 3D vector value.
  • v2 (lwsdk.Vector, sequence[3]) – The second 3D vector value.
Returns:

lwsdk.Vector: The computed dot product of v1 and v2

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.error(msg1, msg2=None)

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.

See also info(), warn()

Parameters:
  • msg1 (str) – The first line of the message.
  • msg2 (str) – The second line of the message, if any.
Returns:

Nothing

Raises :

Exception (to halt the execution of the script)

lwsdk.pris.extent(arg1, arg2=None)

Calculates the bounding volume (extent) of two 3D vector values.

Parameters:
  • arg1 (lwsdk.Vector, sequence[3], sequence[6]) – One or both of the vector values to be used.
  • arg2 (lwsdk.Vector, sequence[3]) – The second vector value to be used.
Returns:

lwsdk.Vector: The extent of the volume as width, height and depth.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.fac(value)

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)
lwsdk.pris.filecopy(frompath, topath)

Copies the contents of a file to a new location.

See also filerename(), filefind(), filedelete(), fileexists(), filestat(), filecrc()

Parameters:
  • frompath – The path to the entry to copy.
  • topath – The new location of the entry.
Returns:

bool: Returns True if the copy succeeded, False otherwise

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.filecrc(path)

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)
lwsdk.pris.filedelete(path)

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)
lwsdk.pris.fileexists(path)

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)
lwsdk.pris.filefind(pattern, allowdupes=False)

Recursively scans a list of application-defined folders for files that match a given pattern.

See also filecopy(), filecrc(), filedelete(), fileexists(), filerename(), filestat()

Parameters:
  • pattern (str) – The pattern to use when selecting files.
  • allowdupes (bool) – If True, duplicates entries are filtered from the resulting sequence.
Returns:

tuple(str): A sequence of files that matched (may be empty).

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.filerename(oldpath, newpath)

Renames an existing file system entry

See also filecopy(), filefind(), filedelete(), fileexists(), filestat(), filecrc()

Parameters:
  • oldpath – The path to the entry to rename.
  • newpath – The new name of the entry.
Returns:

bool: Returns True if the rename succeeded, False otherwise

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.filestat(path)

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)
lwsdk.pris.frac(value)

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)
lwsdk.pris.fullpath(path)

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)
lwsdk.pris.getdir(selector)

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)
lwsdk.pris.getenv(key)

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
lwsdk.pris.getsep()

Returns the path separator character for the current platform.

Returns:str: The separator value (e.g., ‘\’).
Raises :Nothing
lwsdk.pris.globalrecall(key, default=None)

Retrieves a named value from a global database that is available to all scripts.

See also store(), recall(), globalstore()

Parameters:
  • key (str) – The key name that identifies the value to retreive.
  • default (Any valid Python object) – A default value to be returned if the requested value does not exist.
Returns:

Python: A Python object (either the one requested, or the default provided)

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.globalstore(key, value)

Stores a named value to a global database for later recall by any script.

See also store(), recall(), globalrecall()

Parameters:
  • key (str) – The key name that identifies the provided value.
  • value (Any valid Python object) – A value to be stored.
Returns:

bool: True if successful, False otherwise

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.hex(value, width=None, leading_zero=True)

Attempts to convert the provided input into a hexidecimal-formatted string value.

Note that not all objects will respond to this conversion.

See also octal(), binary()

Parameters:
  • value (Any valid Python type capable of rendering to integer) – The value to be converted.
  • width (int) – The width that the resulting hex string should occupy.
  • leading_zero (bool) – If True, the value should use leading zeros for filler.
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)

lwsdk.pris.hostBuild()

Returns the build number of the host application

Returns:int: The build number.
Raises :Nothing
lwsdk.pris.hostVersion()

Returns the major and minor version values of the host application

Returns:tuple(major, minor): The integer major and minor values.
Raises :Nothing
lwsdk.pris.info(msg1, msg2=None)

Displays an information message to the user via LightWaves GUI.

See also warn(), error()

Parameters:
  • msg1 (str) – The first line of the message.
  • msg2 (str) – The second (optional) line of the message.
Returns:

Nothing

Raises :

Nothing

lwsdk.pris.inrange(value, lo, hi)

Tests the provided value for inclusing in the indicated range.

Parameters:
  • value (int, float) – The value to be tested.
  • lo (int, float) – The lowest end of the range.
  • hi – The highest end of the range.
Returns:

bool: Indicating that the value is within the provided range, inclusive.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.integer(value)

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
lwsdk.pris.itemshapedata()

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.
lwsdk.pris.licenseId()

Returns the license id of the host application.

Returns:int: The license id.
Raises :Nothing
lwsdk.pris.loadimage(filename)

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)
lwsdk.pris.matchdirs(path, mask='*')

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:
  • path (str) – The path to scan.
  • mask (str) – The directory name pattern to use (defaults to all)
Returns:

list[str]: A list of direcotry names that matched the pattern in the specified location.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.matchfiles(path, mask='*')

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:
  • path (str) – The path to scan.
  • mask (str) – The file name pattern to use (defaults to all)
Returns:

list[str]: A list of file names that matched the pattern in the specified location.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.mkdir(path)

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)
lwsdk.pris.monend()

Conclude a task in progress.

See also moninit(), monstep()

Returns:Nothing
Raises :Nothing
lwsdk.pris.moninit(steps, desc, title='Progress')

Initialize a progress monitor.

See also monstep(), monend()

Parameters:
  • steps (int) – The number of steps to be completed.
  • desc (str) – A description of the task being monitored.
  • title (str) – An optional title for the progress window.
Returns:

bool: True if the monitor successfully initialized, False otherwise

Raises :

Nothing

lwsdk.pris.monstep(count=1)

Reduces the number of steps remaining in the task.

See also moninit(), monend()

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
lwsdk.pris.normalize(vector)

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)
lwsdk.pris.number(item)

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
lwsdk.pris.octal(value, width=None, leading_zero=True)

Attempts to convert the provided input into an octal-formatted string value.

Note that not all objects will respond to this conversion.

See also hex(), binary()

Parameters:
  • value (Any valid Python type capable of rendering to integer) – The value to be converted.
  • width (int) – The width that the resulting octal string should occupy.
  • leading_zero (bool) – If True, the value should use leading zeros for filler.
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)

lwsdk.pris.parse(sep, value)

Parses a string value using the provided separator character.

Parameters:
  • sep (str) – The character that separates the fields
  • value (str) – The string to be parsed.
Returns:

list[str]: The elements that result from splitting fields using sep

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.platform()

Reports the type of the system on which the script is operating.

Returns:str: One of ‘win32’, ‘win64’, or ‘osx’
Raises :Nothing
lwsdk.pris.randu(seed=None)

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)
lwsdk.pris.recall(key, default=None)

Retrieves a named value from a database that is localized to the executing script.

See also store(), globalstore(), globalrecall()

Parameters:
  • key (str) – The key name that identifies the value to retreive.
  • default (Any valid Python object) – A default value to be returned if the requested value does not exist.
Returns:

Python: A Python object (either the one requested, or the default provided)

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.rmdir(path)

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)
lwsdk.pris.rotate3d(axis, angle, value, origin=None)

Rotate a point or points in 3D space by an offset.

See also translate3d(), scale3d()

Parameters:
  • axis (str) – The axis about which to rotate, one of ‘X’, ‘Y’, or ‘Z’.
  • angle (lwsdk.Vector, sequence[3]) – The angle to apply, in degrees.
  • value (lwsdk.Vector, sequence[lwsdk.Vector]) – The Vector value (or sequence of Vectors) to be modified.
  • origin – An optional origin point to regard in the rotation.
Returns:

lwsdk.Vector, sequence[lwsdk.Vector]: A Vector (or sequence of Vectors) with the rotation applied.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.round(value, digits)

Rounds the provided float value to the number of digits specified.

Parameters:
  • value (lwsdk.Vector, float) – The value to round.
  • digits (int, float) – The number of digits of precision to retain.
Returns:

float: value rounded to the number of significant digits requested

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.runningUnder()

Reports the host application environment under which the script is operating.

Returns:str: One of ‘layout’, ‘modeler’, or ‘screamernet’
Raises :Nothing
lwsdk.pris.scale3d(amount, value)

Scale a point or points in 3D space by an amount.

See also translate3d(), rotate3d()

Parameters:
  • amount (float, lwsdk.Vector, sequence[3]) – The amount by which scale.
  • value (lwsdk.Vector, sequence[lwsdk.Vector]) – The Vector value (or sequence of Vectors) to be modified.
Returns:

lwsdk.Vector, sequence[lwsdk.Vector]: A Vector (or sequence of Vectors) with the scaling applied.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.selector(value, threshold, lo_result, hi_result)

Returns a value selected based on the comparison of a range.

Parameters:
  • value (int, float) – The value to be tested.
  • threshold (int, float) – The threshold against which to test.
  • lo_result (Any valid Python type) – The value to return if value is less than threshold
  • hi_result (Any valid Python type) – The value to return if value is greater than, or equal to, threshold
Returns:

lo_result if value is less than threshold, otherwise hi_result

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.serverlist(klass)

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)
lwsdk.pris.serverpath(klass, name)

Returns the full file-system path to a plug-in with a given name, belonging to a given class type.

See also serverlist()

Parameters:
  • klass (str) – The class of the plug-in (e.g., lwsdk.LWMASTER_HCLASS)
  • name – The name of the plug-in.
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)

lwsdk.pris.size(item)

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
lwsdk.pris.sizeof(item)

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
lwsdk.pris.sleep(seconds)

Pauses processing for the specified number of seconds.

Parameters:seconds (int, float) – The amount of time to pause, in seconds.
Returns:Nothing
Raises :Nothing
lwsdk.pris.spawn(cmd, *args, **kwargs)

Launches an external process.

Parameters:
  • cmd – The command to execute (sans args).
  • args (list) – Any arguments that should be provided to the command.
  • wait (bool) – If present and True, instructs the function to wait until the process terminates, and then return the result code.
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)

lwsdk.pris.split(path)

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
lwsdk.pris.step(comp1, comp2, value)
Parameters:
  • comp1 (int, float) – The first value of the comparison.
  • comp2 (int, float) – The second value of the comparison.
  • value (Any valid Python type) – The value to return if the condition is correct.
Returns:

value if comp2 is less than comp1, otherwise 0

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.store(key, value)

Stores a named value to a database for later recall that is localized to the executing script.

See also recall(), globalstore(), globalrecall()

Parameters:
  • key (str) – The key name that identifies the provided value.
  • value (Any valid Python object) – A value to be stored.
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)

lwsdk.pris.string(item)

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
lwsdk.pris.strleft(value, amount)

Returns a number of characters from the left portion of a string.

See also strright(), strsub()

Parameters:
  • value (str) – The string value to be processed.
  • amount (int) – The number of characters to extract from the left.
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)

lwsdk.pris.strlower(value)

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)
lwsdk.pris.strright(value, amount)

Returns a number of characters from the right portion of a string.

See also strleft(), strsub()

Parameters:
  • value (str) – The string value to be processed.
  • amount (int) – The number of characters to extract from the right.
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)

lwsdk.pris.strsub(value, offset, amount)

Returns a number of characters from an arbitrary offset of a string.

See also strleft(), strright()

Parameters:
  • value (str) – The string value to be processed.
  • offset (int) – The starting offset where extraction should begin.
  • amount (int) – The number of characters to extract from the offset.
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)

lwsdk.pris.strupper(value)

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)
lwsdk.pris.system(cmd)

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)
lwsdk.pris.systemex(cmd)

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)
lwsdk.pris.terminate(pid)

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)
lwsdk.pris.timestart()

Starts tracking elapsed time.

See also timestop()

Returns:Nothing
Raises :Nothing
lwsdk.pris.timestop()

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
lwsdk.pris.translate3d(offset, value)

Translate a point or points in 3D space by an offset.

See also rotate3d(), scale3d()

Parameters:
  • offset (lwsdk.Vector, sequence[3]) – The offset to apply.
  • value (lwsdk.Vector, sequence[lwsdk.Vector]) – The Vector value (or sequence of Vectors) to be modified.
Returns:

lwsdk.Vector, sequence[lwsdk.Vector]: A Vector (or sequence of Vectors) with the offset applied.

Raises :

pris.ArgException (if arguments are unacceptable)

lwsdk.pris.vector(item)

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
lwsdk.pris.wait(pid)

Waits for a process created with spawn() to terminate, and returns the result code.

Parameters:pid (Python object) – The process id of the object created with spawn().
Returns:int: Result code
Raises :pris.ArgException (if arguments are unacceptable)
lwsdk.pris.warn(msg1, msg2=None)

Displays a warning message to the user via LightWaves GUI.

See also info(), error()

Parameters:
  • msg1 (str) – The first line of the message.
  • msg2 (str) – The second (optional) line of the message.
Returns:

Nothing

Raises :

Nothing

Previous topic

The Python Reduced Instruction Set

Next topic

PRIS Modeler: LightWave Modeler Interfaces

This Page