Alias Translations

Introduction

In order to convert a file to a different format, you need to use the Translator class.

Sample Code: Translate a wire file to a CATPart file

Here is a simple piece of code to convert an Alias wire file to a CATPart file:

source_path = "/path/to/file.wire"
destination_path = "/path/to/file.CATPart"

translator = Translator(source_path, destination_path)

# If needed, we can add some extra attributes to the conversion
# Here, for example, we want to use a specific version of CATPart
# To find the list of all the available arguments, please refer to the command line options
translator.add_extra_param("r", 19)

translator.execute()

Translator

class tk_framework_aliastranslations.Translator(source_path, output_path)[source]

Python wrapper to run the Alias file translations inside and outside of Alias.

Note

Because of license issue, only the WREF translation can be run outside of Alias.

Class constructor.

Parameters:
  • source_path – Path to the file we want to translate

  • output_path – Path to the translated file

property translator_path

Path to the executable used to translate the source file

add_extra_param(param_name, param_value)[source]

Add an extra parameter to the translator command line

Parameters:
  • param_name – Name of the parameter

  • param_value – Value of the parameter

is_valid()[source]

Check if it’s possible or not to run the translation according to the current environment

Returns:

False if it’s not possible to run the translation, True otherwise.

execute()[source]

Run the translation command in a subprocess and wait for command to complete.