Getting Started
Getting Started with the Scripting API.
This tutorial introduces the basic concepts and usage patterns of the Scripting API. It covers creating an Application instance, accessing version information, working with projects, and displaying messages to the user.
Prerequisites
- Volvicon application must be running
- A valid license must be active
Quick Tips
- Instantiate the Application: app = api.Application()
- Use snake_case or descriptive names for variables (e.g., app, volume_operations, ai_segmentation).
- Hover over the variable to view available methods and properties. If no tooltip appears, IntelliSense does not recognize the variable name. For details, refer to the documentation.
- All API calls require positional arguments; keyword arguments are not supported.
- Example:
- mask_operations = app.get_mask_operations()
- mask_operations.smooth_mean_filter([mask], 1, 1, 1)
Creating an Application Instance​
# The Application class is the primary entry point for interacting with Volvicon.
# Create an instance to access all API functionality.
#
# For better IntelliSense support, use one of these variable names:
# - app
# - application
# - Application
app = api.Application()
Version Information​
# Get the current version of the application
version = app.get_version()
print(f"Volvicon Version: {version}")
# Get the current working directory
working_dir = app.get_working_directory()
print(f"Working Directory: {working_dir}")
Message Box Display​
# Display informational, warning, and error messages to the user
# Information message (default level)
app.show_message_box(
"This is an informational message.",
"Information"
)
# Warning message
app.show_message_box(
"This is a warning message.",
"Warning",
api.MsgBoxLevel.Warn
)
# Error message
app.show_message_box(
"This is an error message.",
"Error",
api.MsgBoxLevel.Error
)
Question Dialog​
# Display a yes/no question dialog and get user response
response = app.show_question_message_box(
"Do you want to continue with this tutorial?",
"Confirmation"
)
if response:
print("User clicked Yes")
else:
print("User clicked No")
Message Box Suppression​
# A message box blocks the script until somebody clicks a button. That is fine
# while you sit in front of the application, but it stalls a script that runs
# unattended, for example one started with the --py_script command line option.
#
# Suppression lets the script keep going. Every skipped message box is printed
# on this console and written to the application log, so you still see what the
# application had to say.
#
# Available modes:
# - api.MsgBoxSuppression.Off Show every message box. This is the default.
# - api.MsgBoxSuppression.Notifications Skip the boxes that only have to be
# acknowledged. Boxes that ask you to
# choose between outcomes are still shown.
# - api.MsgBoxSuppression.All Skip every box. Each question is answered
# with its default button.
# Read the mode currently in effect
print(f"Message box suppression: {app.get_message_box_suppression()}")
# Skip the boxes that only report something, and keep confirmations interactive
app.set_message_box_suppression(api.MsgBoxSuppression.Notifications)
# This message is printed on the console instead of opening a dialog
app.show_message_box(
"This message is reported on the console because suppression is on.",
"Information"
)
# Careful: this mode also answers confirmations for you. Check the default
# action of each confirmation before enabling this mode.
# app.set_message_box_suppression(api.MsgBoxSuppression.All)
# Back to normal. This is not strictly needed, because the mode is restored
# automatically once the script finishes, but it keeps the intent clear.
app.set_message_box_suppression(api.MsgBoxSuppression.Off)