<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/01f9b8a6-3c36-442b-bed3-ec193007d66f/ic_01_idea.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/01f9b8a6-3c36-442b-bed3-ec193007d66f/ic_01_idea.png" width="40px" /> Start with the short introduction to scripts at Create Your First Command

</aside>

<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/844cd1c9-d253-44c5-9200-dc026df980f5/ic_01_idea.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/844cd1c9-d253-44c5-9200-dc026df980f5/ic_01_idea.png" width="40px" /> See Python Script Facilities for information about the script support module

</aside>

Language Safe Code


If you are using unicode characters in your code e.g. __title__ = "测试包", you need to start the script with the line below and save the file in UTF-8 encoding.

# -*- coding: utf-8 -*-

Setting Script Metadata


pyRevit looks for certain global scope variables in each scripts that provide metadata about the script and follow the __<name>__ format.

<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fcd89f7d-2ea6-4f99-95a8-e90cb0a9e80a/alert.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fcd89f7d-2ea6-4f99-95a8-e90cb0a9e80a/alert.png" width="40px" /> It's preferred to use the Bundle Metadata files for this purpose. The convention described here is only for convenience when creating very simple IronPython scripts.

</aside>

<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fcd89f7d-2ea6-4f99-95a8-e90cb0a9e80a/alert.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fcd89f7d-2ea6-4f99-95a8-e90cb0a9e80a/alert.png" width="40px" /> pyRevit reload is required for changes to take effect.

</aside>

Title

Similar to Bundle Metadata

Button Title: When using the bundle name as the button name in Revit UI is not desired, or you want to add a newline character to the command name to better display the butonn name inside Revit UI Panel, you can define the __title__ variable in your script and set it to the desired button title.

__title__ = 'Test\\\\nBundle'

# title can also be in various locales
# pyRevit pulls the correct title based on Revit langauge
__title__  = {
  "en_us": "Test Bundle",
  "chinese_s": "测试包"
}