pycatia.system_interfaces.system_service

Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-09 09:53:18.676780

Warning

The notes denoted “CAA V5 Visual Basic Help” are to be used as reference only. They are there as a guide as to how the visual basic / catscript functions work and thus help debugging in pycatia.

class pycatia.system_interfaces.system_service.SystemService(com_object)

Note

CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780)

System.IUnknown
System.IDispatch
System.CATBaseUnknown
System.CATBaseDispatch
System.AnyObject
SystemService

Represents an object which provides system services.
environ(i_env_string)

Note

CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780))
o Func Environ(CATBSTR iEnvString) As CATBSTR

Returns the value of an environment variable.

Parameters:

iEnvString
The name of the environment variable

Example:
This example retrieves the value of the PATH variable in the Value
string.

Value = CATIA.SystemService.Environ(“PATH”)
Parameters:

i_env_string (str) –

Returns:

str

evaluate(i_script_text: str, i_language: int, i_function_name: str, i_parameters: list)

Note

CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780))
o Func Evaluate(CATBSTR iScriptText,
CATScriptLanguage iLanguage,
CATBSTR iFunctionName,
CATSafeArrayVariant iParameters) As CATVariant

Evaluates a scripted function.

Parameters:

iScriptText
The program text
iLanguage
The language the program is written in
iFunctionName
The name of the function to invoke
iParameters
An array of parameters for the function
oResult
The value returned by the function (if any)

Example:
This example executes the function CATMain from the CodeToEvaluate
string

Dim params()
Dim codeToEvaluate
CodeToEvaluate = “Sub CATMain()” & vbNewLine & _
“MsgBox “ & chr(34) & “Hello World” & chr(34) &
vbNewLine & _
“End Sub”
CATIA.SystemService.Evaluate CodeToEvaluate, CATVBScriptLanguage,
“CATMain”, params
Parameters:
  • i_script_text (str) –

  • i_language (int) – enum cat_script_language

  • i_function_name (str) –

  • i_parameters (list) –

Returns:

None

execute_background_processus(i_executable_path)

Note

CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780))
o Func ExecuteBackgroundProcessus(CATBSTR iExecutablePath) As
long

Executes an asynchronous process. This process is launched in background
and ExecuteBackgroundProcess doesn’t wait for it to complete. If the executable
to run needs a specific environment to works correctly (for example environment
variables like PATH or LD_LIBRARY_PATH correctly set), this environment must
have been set in order to make this method succeed. If this executable needs to
be launched from a window, this method will fail.

Parameters:

iExecutablePath
The path of the executable to run and its arguments If the executable is not present in
the PATH environment variable, you must specify its complete absolute path. If this path
contains blanks, you must enclose it with the simple quote character ‘’’ : for example
CATIA.SystemService.ExecuteBackgroundProcess “‘C:/Program Files/myApp/myApp.exe’ myArg”.

Returns:
Non significative return code. It’s never the asynchronous process
return code

Example:
This example executes the command located at

and doesn’t wait the end of its execution.

CATIA.SystemService.ExecuteBackgroundProcessus “”
Parameters:

i_executable_path (str) –

Returns:

int

execute_processus(i_executable_path)

Note

CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780))
o Func ExecuteProcessus(CATBSTR iExecutablePath) As long

Executes a synchronous process. If this process is succesfully launched,
ExecuteProcessus waits for it to terminate and returns the process return code.
If the executable to run needs a specific environment to works correctly (for
example environment variables like PATH or LD_LIBRARY_PATH correctly set), this
environment must have been set in order to make this method succeed. If this
executable needs to be launched from a window, this method will
fail.

Parameters:

iExecutablePath
The path of the executable to run and its arguments. If the executable is not present in
the PATH environment variable, you must specify its complete absolute path. If this
executable path contains blanks, you must enclose it with the simple quote
character ‘’’ to allow the implementation to follow the whole line to the MS call
(otherwise only the last part will be sent to the MS call) : Additionally, arguments
with blank must be enclosed in double quote in Microsoft call (do not forget to espace
double quote in VBA, with another double quote).
for example CATIA.SystemService.ExecuteProcessus(”’””C:/Program Files/myApp/myApp.exe””’
myArg1 ‘””myAr g2””’”)
will start the command line “C:/Program Files/myApp/myApp.exe” myArg1 “myAr g2”
on Microsoft OS. On Windows, to run a batch file you must execute the command interpreter
: set the executable to cmd.exe set the arguments to the following ones
: /c plus the name of the batch file. For example CATIA.SystemService.ExecuteProcessus
“cmd.exe /c E:/MyBatchFile.bat” On Windows, an argument that contains a blank must be
doubly enclosed ; first with the single quote character then, inside the single enclosing
quote, with the double quote character. For example CATIA.SystemService.ExecuteProcessus
“cmd.exe /c ‘” & Chr$(34) & “E:/My Bat File.bat” & Chr$(34) & “’”

Returns:
The synchronous process return code

Example:
This example executes the command located at

waits for it to end, and returns its return code.

ReturnCode = CATIA.SystemService.ExecuteProcessus(“”)
Parameters:

i_executable_path (str) –

Returns:

int

execute_script(i_library_name: str, i_type: int, i_program_name: str, i_function_name: str, i_parameters: list)

Note

CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780))
o Func ExecuteScript(CATBSTR iLibraryName,
CatScriptLibraryType iType,
CATBSTR iProgramName,
CATBSTR iFunctionName,
CATSafeArrayVariant iParameters) As CATVariant

Executes a scripted function.

Parameters:

iLibraryName
The library in which the script is contained
iLibraryType
The type of the library
iProgramName
The name of the program in the library
iFunctionName
The name of the function to invoke
iParameters
An array of parameters for the function
oResult
The value returned by the function (if any)

Example:
This example executes the function CATMain in the program Macro1.catvbs
contained by Part1.CATPart

Dim params()
CATIA.SystemService.ExecuteScript”Part1.CATPart”,
catScriptLibraryTypeDocument, “Macro1.catvbs”, “CATMain”,
params
Parameters:
  • i_library_name (str) –

  • i_type (int) – enum cat_script_library_type

  • i_program_name (str) –

  • i_function_name (str) –

  • i_parameters (tuple) –

Returns:

None

print(i_string)

Note

CAA V5 Visual Basic Help (2020-06-09 09:53:18.676780))
o Sub Print(CATBSTR iString)

Prints a string on stdout.

Parameters:

iString
The string to print

Example:
This example prints the string “Hello world!”.

CATIA.SystemService.Print(“Hello world!”)
Parameters:

i_string (str) –

Returns:

None